netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@osdl.org>
To: davem@redhat.com
Cc: netdev@oss.sgi.com, shemminger@osdl.org
Subject: [PATCH 4/4] rose check error on memcpy_fromiovec (resend)
Date: Fri, 16 Jan 2004 14:28:21 -0800	[thread overview]
Message-ID: <20040116142821.V19023@osdlab.pdx.osdl.net> (raw)
In-Reply-To: <20040116142723.U19023@osdlab.pdx.osdl.net>; from chrisw@osdl.org on Fri, Jan 16, 2004 at 02:27:23PM -0800

Check the return value on memcpy_fromiovec().

 net/rose/af_rose.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

===== net/rose/af_rose.c 1.37 vs edited =====
--- 1.37/net/rose/af_rose.c	Fri Jan  9 01:56:39 2004
+++ edited/net/rose/af_rose.c	Fri Jan 16 14:15:17 2004
@@ -1083,7 +1083,11 @@
 
 	asmptr = skb->h.raw = skb_put(skb, len);
 
-	memcpy_fromiovec(asmptr, msg->msg_iov, len);
+	err = memcpy_fromiovec(asmptr, msg->msg_iov, len);
+	if (err) {
+		kfree_skb(skb);
+		return err;
+	}
 
 	/*
 	 *	If the Q BIT Include socket option is in force, the first
@@ -1133,8 +1137,10 @@
 		frontlen = skb_headroom(skb);
 
 		while (skb->len > 0) {
-			if ((skbn = sock_alloc_send_skb(sk, frontlen + ROSE_PACLEN, 0, &err)) == NULL)
+			if ((skbn = sock_alloc_send_skb(sk, frontlen + ROSE_PACLEN, 0, &err)) == NULL) {
+				kfree_skb(skb);
 				return err;
+			}
 
 			skbn->sk   = sk;
 			skbn->free = 1;
@@ -1159,7 +1165,7 @@
 		}
 
 		skb->free = 1;
-		kfree_skb(skb, FREE_WRITE);
+		kfree_skb(skb);
 	} else {
 		skb_queue_tail(&sk->sk_write_queue, skb);		/* Throw it on the queue */
 	}

  reply	other threads:[~2004-01-16 22:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-16 22:25 [PATCH 1/4] ax25 check error on memcpy_fromiovec (resend) Chris Wright
2004-01-16 22:26 ` [PATCH 2/4] irda " Chris Wright
2004-01-16 22:27   ` [PATCH 3/4] netrom " Chris Wright
2004-01-16 22:28     ` Chris Wright [this message]
2004-01-20  5:15       ` [PATCH 4/4] rose " David S. 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=20040116142821.V19023@osdlab.pdx.osdl.net \
    --to=chrisw@osdl.org \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    --cc=shemminger@osdl.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).