ionic: catch failure from devlink_alloc
Subsystems (3)
PATCH v2 1/1 ionic: catch failure from devlink_alloc
Add a check for NULL on the alloc return. If devlink_alloc() fails and we try to use devlink_priv() on the NULL return, the kernel gets very unhappy and panics. With this fix, the driver load will still fail, but at least it won't panic the kernel.
---
v2 - fixed up the Fixes tag - thanks, Simon
https://lore.kernel.org/netdev/Y%[email protected]/
drivers/net/ethernet/pensando/ionic/ionic_devlink.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/pensando/ionic/ionic_devlink.c +2 -0
@@ -61,6 +61,8 @@ struct ionic *ionic_devlink_alloc(struct device *dev)struct devlink *dl; dl =devlink_alloc (&ionic_dl_ops,sizeof (struct ionic ), dev); +if (!dl) +return NULL ;return devlink_priv (dl); }
Signature · 1 line
2.17.1
Quoted 10 lines · Shannon Nelson
Add a check for NULL on the alloc return. If
devlink_alloc()fails and we try to usedevlink_priv()on the NULL return, the kernel gets very unhappy and panics. With this fix, the driver load will still fail, but at least it won't panic the kernel.Fixes df69ba43217d ("ionic: Add basic framework for IONIC Network device driver")Signed-off-by Shannon Nelson <[email protected]>---
v2 - fixed up the Fixes tag - thanks, Simonhttps://lore.kernel.org/netdev/Y%[email protected]/
Likewise, thanks.
Quoted 7 lines · Tue, May 02, 2023 at 08:35:36PM CEST, [email protected] wrote:
Add a check for NULL on the alloc return. If
devlink_alloc()fails and we try to usedevlink_priv()on the NULL return, the kernel gets very unhappy and panics. With this fix, the driver load will still fail, but at least it won't panic the kernel.Fixes df69ba43217d ("ionic: Add basic framework for IONIC Network device driver")Signed-off-by Shannon Nelson <[email protected]>
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 9 lines · On Tue, 2 May 2023 11:35:36 -0700 you wrote:
Add a check for NULL on the alloc return. If
devlink_alloc()fails and we try to usedevlink_priv()on the NULL return, the kernel gets very unhappy and panics. With this fix, the driver load will still fail, but at least it won't panic the kernel.Fixes df69ba43217d ("ionic: Add basic framework for IONIC Network device driver")Signed-off-by Shannon Nelson <[email protected]>[...]
Here is the summary with links:
- [v2,net] ionic: catch failure from devlink_alloc
https://git.kernel.org/netdev/net/c/4a54903ff68d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html