Skip to content

Commit

Permalink
wwan: core: require WWAN netdev setup callback existence
Browse files Browse the repository at this point in the history
The setup callback will be unconditionally passed to the
alloc_netdev_mqs(), where the NULL pointer dereference will cause the
kernel panic. So refuse to register WWAN netdev ops with warning
generation if the setup callback is not provided.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sergey Ryazanov authored and David S. Miller committed Jun 22, 2021
1 parent 355a4e7 commit 58c3b42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/wwan/wwan_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ int wwan_register_ops(struct device *parent, const struct wwan_ops *ops,
{
struct wwan_device *wwandev;

if (WARN_ON(!parent || !ops))
if (WARN_ON(!parent || !ops || !ops->setup))
return -EINVAL;

wwandev = wwan_create_dev(parent);
Expand Down

0 comments on commit 58c3b42

Please sign in to comment.