Commit 6cf5c951175abcec4da470c50565cc0afe6cd11d

Authored by Alan Cox
Committed by David S. Miller
1 parent 9fef76857f

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>

Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff

net/netrom/af_netrom.c
... ... @@ -1169,7 +1169,12 @@
1169 1169 msg->msg_flags |= MSG_TRUNC;
1170 1170 }
1171 1171  
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 + }
1173 1178  
1174 1179 if (sax != NULL) {
1175 1180 sax->sax25_family = AF_NETROM;