]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: dp83822: Fix null pointer access on DP83825/DP83826 devices
authorAndre Kalb <andre.kalb@sma.de>
Wed, 25 Jan 2023 18:23:26 +0000 (19:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:05 +0000 (11:28 +0100)
commit861de8b25979fcc6af38dde9e66a165f4b66993f
tree3c1fcc760b03423e4c00e11db406bffde50181b1
parent4883a65baf4fca8d447763a7d3ceade184b0b007
net: phy: dp83822: Fix null pointer access on DP83825/DP83826 devices

[ Upstream commit 422ae7d9c7221e8d4c8526d0f54106307d69d2dc ]

The probe() function is only used for the DP83822 PHY, leaving the
private data pointer uninitialized for the smaller DP83825/26 models.
While all uses of the private data structure are hidden in 82822 specific
callbacks, configuring the interrupt is shared across all models.
This causes a NULL pointer dereference on the smaller PHYs as it accesses
the private data unchecked. Verifying the pointer avoids that.

Fixes: b0f7bf02bef7 ("net: phy: DP83822: Add ability to advertise Fiber connection")
Signed-off-by: Andre Kalb <andre.kalb@sma.de>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/Y9FzniUhUtbaGKU7@pc6682
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/phy/dp83822.c