[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210615003016.477-4-ryazanov.s.a@gmail.com>
Date: Tue, 15 Jun 2021 03:30:09 +0300
From: Sergey Ryazanov <ryazanov.s.a@...il.com>
To: Loic Poulain <loic.poulain@...aro.org>,
Johannes Berg <johannes@...solutions.net>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org
Subject: [PATCH net-next 03/10] 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 <ryazanov.s.a@...il.com>
---
drivers/net/wwan/wwan_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
index 00b514b01d91..259d49f78998 100644
--- a/drivers/net/wwan/wwan_core.c
+++ b/drivers/net/wwan/wwan_core.c
@@ -909,7 +909,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);
--
2.26.3
Powered by blists - more mailing lists