From 8cc236db1a91d0c91651595ba75942a583008455 Mon Sep 17 00:00:00 2001 From: Loic Poulain Date: Thu, 22 Jul 2021 20:21:05 +0200 Subject: wwan: core: Fix missing RTM_NEWLINK event for default link A wwan link created via the wwan_create_default_link procedure is never notified to the user (RTM_NEWLINK), causing issues with user tools relying on such event to track network links (NetworkManager). This is because the procedure misses a call to rtnl_configure_link(), which sets the link as initialized and notifies the new link (cf proper usage in __rtnl_newlink()). Cc: stable@vger.kernel.org Fixes: ca374290aaad ("wwan: core: support default netdev creation") Suggested-by: Sergey Ryazanov Signed-off-by: Loic Poulain Acked-by: Sergey Ryazanov Signed-off-by: David S. Miller --- drivers/net/wwan/wwan_core.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/net/wwan/wwan_core.c') diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index 3e16c318e705..674a81d79db3 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -984,6 +984,8 @@ static void wwan_create_default_link(struct wwan_device *wwandev, goto unlock; } + rtnl_configure_link(dev, NULL); /* Link initialized, notify new link */ + unlock: rtnl_unlock(); -- cgit v1.2.3 From 0de6fd5fd51c8c3bbc8e023111ea4fba9b72816b Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Wed, 11 Aug 2021 16:39:32 +0300 Subject: wwan: core: Unshadow error code returned by ida_alloc_range() ida_alloc_range() may return other than -ENOMEM error code. Unshadow it in the wwan_create_port(). Signed-off-by: Andy Shevchenko Reviewed-by: Sergey Ryazanov Reviewed-by: Loic Poulain Signed-off-by: David S. Miller --- drivers/net/wwan/wwan_core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers/net/wwan/wwan_core.c') diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index 674a81d79db3..5f9f57e59b70 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -355,8 +355,8 @@ struct wwan_port *wwan_create_port(struct device *parent, { struct wwan_device *wwandev; struct wwan_port *port; - int minor, err = -ENOMEM; char namefmt[0x20]; + int minor, err; if (type > WWAN_PORT_MAX || !ops) return ERR_PTR(-EINVAL); @@ -370,11 +370,14 @@ struct wwan_port *wwan_create_port(struct device *parent, /* A port is exposed as character device, get a minor */ minor = ida_alloc_range(&minors, 0, WWAN_MAX_MINORS - 1, GFP_KERNEL); - if (minor < 0) + if (minor < 0) { + err = minor; goto error_wwandev_remove; + } port = kzalloc(sizeof(*port), GFP_KERNEL); if (!port) { + err = -ENOMEM; ida_free(&minors, minor); goto error_wwandev_remove; } -- cgit v1.2.3