net: ipv6: add missing lock in ping_v6_sendmsg
Lorenzo Colitti [Wed, 3 Jul 2013 15:52:49 +0000 (00:52 +0900)]
Bug: 9469865
Bug 1412141
Change-Id: I5e9db559d22e35d27fa1df948b70c70ed8b42115
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3a018d2e8fc2910e5fb2077cde81cad659e2c7f9)
Reviewed-on: http://git-master/r/336271
(cherry picked from commit 71e8c301dce8ee85ee26eedb808b939084f14b45)
Reviewed-on: http://git-master/r/353232
Reviewed-by: Nitin Bindal <nbindal@nvidia.com>
Tested-by: Nitin Bindal <nbindal@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>

net/ipv6/ping.c

index 502fc23..23d35b5 100644 (file)
@@ -197,6 +197,7 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
        if (hlimit < 0)
                hlimit = ip6_dst_hoplimit(dst);
 
+       lock_sock(sk);
        err = ip6_append_data(sk, ping_getfrag, &pfh, len,
                              0, hlimit,
                              np->tclass, NULL, &fl6, rt,
@@ -211,6 +212,7 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
                                                 (struct icmp6hdr *) &pfh.icmph,
                                                 len);
        }
+       release_sock(sk);
 
        return err;
 }