net/dcb: check for detached device before executing callbacks
Subsystems (2)
PATCH 1/1 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 <[email protected]>
Signed-off-by Denis Kirjanov <[email protected]>
--- net/dcb/dcbnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/dcb/dcbnl.c +1 -1
@@ -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)
Signature · 1 line
2.30.2
Paolo Abeni
maintainerHi,
Quoted 7 lines · Denis Kirjanov
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 <[email protected]>Signed-off-by Denis Kirjanov <[email protected]>
The patch LGTM, but please fix the patch sender to match the patch author to make checkpatch happy.
./scripts/checkpatch.pl --strict --git HEAD^..
before the submission is your friend:)
Also please add the target tree ('net') in the subj prefix when you will submit the next revision.
Thanks!
Paolo