From: Alan Cox Date: Tue, 4 Sep 2012 04:13:18 +0000 (+0000) Subject: netrom: copy_datagram_iovec can fail X-Git-Tag: v3.2.31~8 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=85c5e1ba63575f0d345969f8adfa501f9cf99037;p=karo-tx-linux.git netrom: copy_datagram_iovec can fail [ Upstream commit 6cf5c951175abcec4da470c50565cc0afe6cd11d ] Check for an error from this and if so bail properly. Signed-off-by: Alan Cox Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings --- diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 732152f718e0..f1563823696a 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -1170,7 +1170,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;