From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: netdev@vger.kernel.org
Subject: [PATCH] netrom: copy_datagram_iovec can fail
Date: Tue, 04 Sep 2012 15:13:18 +0100 [thread overview]
Message-ID: <20120904141315.26374.38822.stgit@localhost.localdomain> (raw)
From: Alan Cox <alan@linux.intel.com>
Check for an error from this and if so bail properly.
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
net/netrom/af_netrom.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 06592d8..1b9024e 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;
next reply other threads:[~2012-09-04 13:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-04 14:13 Alan Cox [this message]
2012-09-04 16:58 ` [PATCH] netrom: copy_datagram_iovec can fail David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120904141315.26374.38822.stgit@localhost.localdomain \
--to=alan@lxorguk.ukuu.org.uk \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).