diff options
author | Alan Cox <alan@linux.intel.com> | 2012-09-04 04:13:18 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-04 12:57:35 -0400 |
commit | 6cf5c951175abcec4da470c50565cc0afe6cd11d (patch) | |
tree | 528117e0e3bfbbfe5345a73fdcedcaa7cfeff478 | |
parent | 9fef76857feed8e94ca3a5ee37db644f04a9488b (diff) | |
download | linux-3.10-6cf5c951175abcec4da470c50565cc0afe6cd11d.tar.gz linux-3.10-6cf5c951175abcec4da470c50565cc0afe6cd11d.tar.bz2 linux-3.10-6cf5c951175abcec4da470c50565cc0afe6cd11d.zip |
netrom: copy_datagram_iovec can fail
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>
-rw-r--r-- | net/netrom/af_netrom.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 06592d8b4a2..1b9024ee963 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -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; |