From: David S. Miller Date: Thu, 7 Oct 2010 02:39:31 +0000 (-0700) Subject: Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=69259abb64d4da77273bf59accfc9fa79e7165f4;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Merge branch 'master' of /linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/pcmcia/pcnet_cs.c net/caif/caif_socket.c --- 69259abb64d4da77273bf59accfc9fa79e7165f4 diff --cc net/caif/caif_socket.c index abcba5358b63,4bf28f25f368..2eca2dd0000f --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c @@@ -888,14 -897,23 +889,22 @@@ static int caif_connect(struct socket * cf_sk->sk.sk_state = CAIF_DISCONNECTED; goto out; } - dev = dev_get_by_index(sock_net(sk), ifindex); + + err = -ENODEV; + rcu_read_lock(); + dev = dev_get_by_index_rcu(sock_net(sk), ifindex); + if (!dev) { + rcu_read_unlock(); + goto out; + } cf_sk->headroom = LL_RESERVED_SPACE_EXTRA(dev, headroom); + mtu = dev->mtu; + rcu_read_unlock(); + cf_sk->tailroom = tailroom; - cf_sk->maxframe = dev->mtu - (headroom + tailroom); - dev_put(dev); + cf_sk->maxframe = mtu - (headroom + tailroom); if (cf_sk->maxframe < 1) { - pr_warning("CAIF: %s(): CAIF Interface MTU too small (%u)\n", - __func__, mtu); + pr_warn("CAIF Interface MTU too small (%d)\n", dev->mtu); - err = -ENODEV; goto out; }