summaryrefslogtreecommitdiffstats
path: root/net/dcb
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2014-01-15 10:23:39 +0800
committerDavid S. Miller <davem@davemloft.net>2014-01-14 18:50:46 -0800
commitd9ac62be5740272f495154469cc9f77feb8d541a (patch)
tree9ff0ca3ae3c0f647d402baf1cd6d1a3b1b63ba4f /net/dcb
parentebd93a7daf40d61b994b9928dd7bf26e0dcca10d (diff)
downloadlinux-stable-d9ac62be5740272f495154469cc9f77feb8d541a.tar.gz
linux-stable-d9ac62be5740272f495154469cc9f77feb8d541a.tar.bz2
linux-stable-d9ac62be5740272f495154469cc9f77feb8d541a.zip
dcb: use __dev_get_by_name instead of dev_get_by_name to find interface
The following call chain indicates that dcb_doit() is protected under rtnl_lock. So if we use __dev_get_by_name() instead of dev_get_by_name() to find interface handlers in it, this would help us avoid to change interface reference counter. rtnetlink_rcv() rtnl_lock() netlink_rcv_skb() dcb_doit() rtnl_unlock() Cc: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dcb')
-rw-r--r--net/dcb/dcbnl.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 66fbe1948fb5..553644402670 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1688,21 +1688,17 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh)
if (!tb[DCB_ATTR_IFNAME])
return -EINVAL;
- netdev = dev_get_by_name(net, nla_data(tb[DCB_ATTR_IFNAME]));
+ netdev = __dev_get_by_name(net, nla_data(tb[DCB_ATTR_IFNAME]));
if (!netdev)
return -ENODEV;
- if (!netdev->dcbnl_ops) {
- ret = -EOPNOTSUPP;
- goto out;
- }
+ if (!netdev->dcbnl_ops)
+ return -EOPNOTSUPP;
reply_skb = dcbnl_newmsg(fn->type, dcb->cmd, portid, nlh->nlmsg_seq,
nlh->nlmsg_flags, &reply_nlh);
- if (!reply_skb) {
- ret = -ENOBUFS;
- goto out;
- }
+ if (!reply_skb)
+ return -ENOBUFS;
ret = fn->cb(netdev, nlh, nlh->nlmsg_seq, tb, reply_skb);
if (ret < 0) {
@@ -1714,7 +1710,6 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh)
ret = rtnl_unicast(reply_skb, net, portid);
out:
- dev_put(netdev);
return ret;
}