mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
ionic: catch failure from devlink_alloc
[ Upstream commit4a54903ff6
] 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. Fixes:df69ba4321
("ionic: Add basic framework for IONIC Network device driver") Signed-off-by: Shannon Nelson <shannon.nelson@amd.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6456d80045
commit
5325f50de5
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue