Skip to content

Commit 6cf5c95

Browse files
Alan Coxdavem330
Alan Cox
authored andcommitted
netrom: copy_datagram_iovec can fail
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]>
1 parent 9fef768 commit 6cf5c95

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/netrom/af_netrom.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,12 @@ static int nr_recvmsg(struct kiocb *iocb, struct socket *sock,
11691169
msg->msg_flags |= MSG_TRUNC;
11701170
}
11711171

1172-
skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
1172+
er = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
1173+
if (er < 0) {
1174+
skb_free_datagram(sk, skb);
1175+
release_sock(sk);
1176+
return er;
1177+
}
11731178

11741179
if (sax != NULL) {
11751180
sax->sax25_family = AF_NETROM;

0 commit comments

Comments
 (0)