[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240624134607.1701-1-dkirjanov@suse.de>
Date: Mon, 24 Jun 2024 09:46:07 -0400
From: Denis Kirjanov <kirjanov@...il.com>
To: netdev@...r.kernel.org
Cc: Denis Kirjanov <dkirjanov@...e.de>,
Hannes Reinecke <hare@...e.de>
Subject: [PATCH] net/dcb: check for detached device before executing callbacks
When a netdevice is detached there is no point in trying to execute
the dcb callbacks; at best they will return stale information, and
at worst crash the machine.
Fixes: 2f90b8657ec94 ("ixgbe: this patch adds support for DCB to the kernel and ixgbe driver")
Signed-off-by: Hannes Reinecke <hare@...e.de>
Signed-off-by: Denis Kirjanov <dkirjanov@...e.de>
---
net/dcb/dcbnl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 2e6b8c8fd2de..80b3b6ba5d3c 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1943,7 +1943,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
return -EINVAL;
netdev = __dev_get_by_name(net, nla_data(tb[DCB_ATTR_IFNAME]));
- if (!netdev)
+ if (!netdev || !netif_device_present(netdev))
return -ENODEV;
if (!netdev->dcbnl_ops)
--
2.30.2
Powered by blists - more mailing lists