Skip to content

Commit

Permalink
caif: __dev_get_by_index instead of dev_get_by_index to find interface
Browse files Browse the repository at this point in the history
The following call chains indicate that chnl_net_open() is under
rtnl_lock protection as __dev_open() is protected by rtnl_lock.
So if __dev_get_by_index() instead of dev_get_by_index() is used
to find interface handler in it, this would help us avoid to change
interface reference counter.

__dev_open()
  chnl_net_open()

Cc: Dmitry Tarnyagin <[email protected]>
Signed-off-by: Ying Xue <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ying-xue authored and davem330 committed Jan 15, 2014
1 parent 16b7769 commit a74e942
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/caif/chnl_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ static int chnl_net_open(struct net_device *dev)
goto error;
}

lldev = dev_get_by_index(dev_net(dev), llifindex);
lldev = __dev_get_by_index(dev_net(dev), llifindex);

if (lldev == NULL) {
pr_debug("no interface?\n");
Expand All @@ -307,7 +307,6 @@ static int chnl_net_open(struct net_device *dev)
mtu = min_t(int, dev->mtu, lldev->mtu - (headroom + tailroom));
mtu = min_t(int, GPRS_PDP_MTU, mtu);
dev_set_mtu(dev, mtu);
dev_put(lldev);

if (mtu < 100) {
pr_warn("CAIF Interface MTU too small (%d)\n", mtu);
Expand Down

0 comments on commit a74e942

Please sign in to comment.