Message ID | 20210429110833.2181-1-o.rempel@pengutronix.de (mailing list archive) |
---|---|
State | Accepted |
Commit | d27f0201b93cb1016c232c46e0b8e1bf4c02a7ea |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,v1,1/3] net: dsa: ksz: ksz8863_smi_probe: fix possible NULL pointer dereference | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | warning | Series does not have a cover letter |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | fail | 1 blamed authors not CCed: linux@rempel-privat.de; 1 maintainers not CCed: linux@rempel-privat.de |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 37 this patch: 37 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 9 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 30 this patch: 30 |
netdev/header_inline | success | Link |
On Thu, Apr 29, 2021 at 01:08:31PM +0200, Oleksij Rempel wrote: > Fix possible NULL pointer dereference in case devm_kzalloc() failed to > allocate memory. > > Fixes: 60a364760002 ("net: dsa: microchip: Add Microchip KSZ8863 SMI based driver support") > Reported-by: Colin Ian King <colin.king@canonical.com> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
Hello: This series was applied to netdev/net.git (refs/heads/master): On Thu, 29 Apr 2021 13:08:31 +0200 you wrote: > Fix possible NULL pointer dereference in case devm_kzalloc() failed to > allocate memory. > > Fixes: 60a364760002 ("net: dsa: microchip: Add Microchip KSZ8863 SMI based driver support") > Reported-by: Colin Ian King <colin.king@canonical.com> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> > > [...] Here is the summary with links: - [net-next,v1,1/3] net: dsa: ksz: ksz8863_smi_probe: fix possible NULL pointer dereference https://git.kernel.org/netdev/net/c/d27f0201b93c - [net-next,v1,2/3] net: dsa: ksz: ksz8795_spi_probe: fix possible NULL pointer dereference https://git.kernel.org/netdev/net/c/ba46b576a795 - [net-next,v1,3/3] net: dsa: ksz: ksz8863_smi_probe: set proper return value for ksz_switch_alloc() https://git.kernel.org/netdev/net/c/d4eecfb28b96 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/drivers/net/dsa/microchip/ksz8863_smi.c b/drivers/net/dsa/microchip/ksz8863_smi.c index 30d97ea7a949..9fb38e99001a 100644 --- a/drivers/net/dsa/microchip/ksz8863_smi.c +++ b/drivers/net/dsa/microchip/ksz8863_smi.c @@ -147,6 +147,9 @@ static int ksz8863_smi_probe(struct mdio_device *mdiodev) int i; ksz8 = devm_kzalloc(&mdiodev->dev, sizeof(struct ksz8), GFP_KERNEL); + if (!ksz8) + return -ENOMEM; + ksz8->priv = mdiodev; dev = ksz_switch_alloc(&mdiodev->dev, ksz8);
Fix possible NULL pointer dereference in case devm_kzalloc() failed to allocate memory. Fixes: 60a364760002 ("net: dsa: microchip: Add Microchip KSZ8863 SMI based driver support") Reported-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> --- drivers/net/dsa/microchip/ksz8863_smi.c | 3 +++ 1 file changed, 3 insertions(+)