Subject: [PATCH 1/4] ax25 check error on memcpy_fromiovec

From: Chris Wright <[email-masked]>
Date: Mon, 8 Dec 2003 20:23:02 -0800

Check the return value on memcpy_fromiovec().

===== net/ax25/af_ax25.c 1.33 vs edited =====
--- 1.33/net/ax25/af_ax25.c	Tue Oct  7 06:27:14 2003
+++ edited/net/ax25/af_ax25.c	Fri Dec  5 16:43:44 2003
@@ -1534,7 +1534,12 @@
 	SOCK_DEBUG(sk, "AX.25: Appending user data\n");
 
 	/* User data follows immediately after the AX.25 data */
-	memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len);
+	if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
+		err = -EFAULT;
+		kfree_skb(skb);
+		goto out;
+	}
+
 	skb->nh.raw = skb->data;
 
 	/* Add the PID if one is not supplied by the user in the skb */