]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
netrom: copy_datagram_iovec can fail
authorAlan Cox <alan@linux.intel.com>
Tue, 4 Sep 2012 04:13:18 +0000 (04:13 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Sep 2012 16:57:35 +0000 (12:57 -0400)
Check for an error from this and if so bail properly.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netrom/af_netrom.c

index 06592d8b4a2b4eba33d9e71e44fc75ca206b38a8..1b9024ee963c64f33b9240a0726dd67b83711567 100644 (file)
@@ -1169,7 +1169,12 @@ static int nr_recvmsg(struct kiocb *iocb, struct socket *sock,
                msg->msg_flags |= MSG_TRUNC;
        }
 
-       skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
+       er = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
+       if (er < 0) {
+               skb_free_datagram(sk, skb);
+               release_sock(sk);
+               return er;
+       }
 
        if (sax != NULL) {
                sax->sax25_family = AF_NETROM;