net: ipv6: add missing lock in ping_v6_sendmsg
authorLorenzo Colitti <lorenzo@google.com>
Wed, 3 Jul 2013 15:52:49 +0000 (00:52 +0900)
committerDavid S. Miller <davem@davemloft.net>
Thu, 4 Jul 2013 00:40:58 +0000 (17:40 -0700)
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ping.c

index 2b52046e12632e25d9e64e1d2ffb199ea8fb6331..10b975577e91ac872a399a7d7a5dec0a507d4818 100644 (file)
@@ -174,6 +174,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,
@@ -188,6 +189,7 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
                                                 (struct icmp6hdr *) &pfh.icmph,
                                                 len);
        }
+       release_sock(sk);
 
        return err;
 }