summaryrefslogtreecommitdiff
path: root/net/smc
diff options
context:
space:
mode:
authorUrsula Braun <ubraun@linux.vnet.ibm.com>2017-10-11 14:47:23 +0300
committerDavid S. Miller <davem@davemloft.net>2017-10-12 22:20:27 +0300
commit43e2ada3e06aefe3596be75bd05b34ef14fd1f7c (patch)
tree1f6ee517e6b34cfa5f115847c2bc6467f2a449c2 /net/smc
parentd921c420d2efa5731011b922e5a2f2ad33203c0b (diff)
downloadlinux-43e2ada3e06aefe3596be75bd05b34ef14fd1f7c.tar.xz
net/smc: dev_put for netdev after usage of ib_query_gid()
For RoCEs ib_query_gid() takes a reference count on the net_device. This reference count must be decreased by the caller. Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Reported-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Parav Pandit <parav@mellanox.com> Fixes: 0cfdd8f92cac ("smc: connection and link group creation") Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc')
-rw-r--r--net/smc/smc_core.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 20b66e79c5d6..5f6a20084157 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -380,10 +380,14 @@ static int smc_link_determine_gid(struct smc_link_group *lgr)
if (ib_query_gid(lnk->smcibdev->ibdev, lnk->ibport, i, &gid,
&gattr))
continue;
- if (gattr.ndev &&
- (vlan_dev_vlan_id(gattr.ndev) == lgr->vlan_id)) {
- lnk->gid = gid;
- return 0;
+ if (gattr.ndev) {
+ if (is_vlan_dev(gattr.ndev) &&
+ vlan_dev_vlan_id(gattr.ndev) == lgr->vlan_id) {
+ lnk->gid = gid;
+ dev_put(gattr.ndev);
+ return 0;
+ }
+ dev_put(gattr.ndev);
}
}
return -ENODEV;