Skip to content

Commit

Permalink
netrom: copy_datagram_iovec can fail
Browse files Browse the repository at this point in the history
Check for an error from this and if so bail properly.

Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Alan Cox authored and davem330 committed Sep 4, 2012
1 parent 9fef768 commit 6cf5c95
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/netrom/af_netrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6cf5c95

Please sign in to comment.