From: Sergey Ryazanov Date: Mon, 21 Jun 2021 22:50:53 +0000 (+0300) Subject: wwan: core: require WWAN netdev setup callback existence X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=58c3b421c62edd30b0b660e3e6711ad91842c271;p=linux.git 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: Sergey Ryazanov Reviewed-by: Loic Poulain Signed-off-by: David S. Miller --- diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index 688a7278a396c..1bd472195813f 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -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);