Commit 58c3b421 authored by Sergey Ryazanov's avatar Sergey Ryazanov Committed by David S. Miller

wwan: core: require WWAN netdev setup callback existence

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: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
Reviewed-by: default avatarLoic Poulain <loic.poulain@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 355a4e7e
...@@ -917,7 +917,7 @@ int wwan_register_ops(struct device *parent, const struct wwan_ops *ops, ...@@ -917,7 +917,7 @@ int wwan_register_ops(struct device *parent, const struct wwan_ops *ops,
{ {
struct wwan_device *wwandev; struct wwan_device *wwandev;
if (WARN_ON(!parent || !ops)) if (WARN_ON(!parent || !ops || !ops->setup))
return -EINVAL; return -EINVAL;
wwandev = wwan_create_dev(parent); wwandev = wwan_create_dev(parent);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment