Skip to content

Commit

Permalink
net/smc: dev_put for netdev after usage of ib_query_gid()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reported-by: Parav Pandit <[email protected]>
Reviewed-by: Parav Pandit <[email protected]>
Fixes: 0cfdd8f ("smc: connection and link group creation")
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Ursula Braun authored and davem330 committed Oct 12, 2017
1 parent d921c42 commit 43e2ada
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions net/smc/smc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 43e2ada

Please sign in to comment.