[kernel] r19120 - in dists/sid/linux/debian: . patches patches/bugfix/all

Ben Hutchings benh at alioth.debian.org
Mon Jun 11 01:14:38 UTC 2012


Author: benh
Date: Mon Jun 11 01:14:36 2012
New Revision: 19120

Log:
net: sock: validate data_len before allocating skb in sock_alloc_send_pskb() (CVE-2012-2136)

Added:
   dists/sid/linux/debian/patches/bugfix/all/net-sock-validate-data_len-before-allocating-skb-in-.patch
Modified:
   dists/sid/linux/debian/changelog
   dists/sid/linux/debian/patches/series

Modified: dists/sid/linux/debian/changelog
==============================================================================
--- dists/sid/linux/debian/changelog	Mon Jun 11 00:50:22 2012	(r19119)
+++ dists/sid/linux/debian/changelog	Mon Jun 11 01:14:36 2012	(r19120)
@@ -49,6 +49,8 @@
   * linux-source: Add single patch for each featureset
   * [x86] Enable CRASH_DUMP, PROC_VMCORE (Closes: #623177)
   * media/dvb: Enable DVB_DDBRIDGE as module (Closes: #676952)
+  * net: sock: validate data_len before allocating skb in
+    sock_alloc_send_pskb() (CVE-2012-2136)
 
   [ Bastian Blank ]
   * [s390/s390x,s390x/s390x] Build debugging symbols.

Added: dists/sid/linux/debian/patches/bugfix/all/net-sock-validate-data_len-before-allocating-skb-in-.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux/debian/patches/bugfix/all/net-sock-validate-data_len-before-allocating-skb-in-.patch	Mon Jun 11 01:14:36 2012	(r19120)
@@ -0,0 +1,48 @@
+From: Jason Wang <jasowang at redhat.com>
+Date: Wed, 30 May 2012 21:18:10 +0000
+Subject: net: sock: validate data_len before allocating skb in
+ sock_alloc_send_pskb()
+
+commit cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc upstream.
+
+We need to validate the number of pages consumed by data_len, otherwise frags
+array could be overflowed by userspace. So this patch validate data_len and
+return -EMSGSIZE when data_len may occupies more frags than MAX_SKB_FRAGS.
+
+Signed-off-by: Jason Wang <jasowang at redhat.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ net/core/sock.c |    7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/net/core/sock.c b/net/core/sock.c
+index 653f8c0..9e5b71f 100644
+--- a/net/core/sock.c
++++ b/net/core/sock.c
+@@ -1592,6 +1592,11 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
+ 	gfp_t gfp_mask;
+ 	long timeo;
+ 	int err;
++	int npages = (data_len + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
++
++	err = -EMSGSIZE;
++	if (npages > MAX_SKB_FRAGS)
++		goto failure;
+ 
+ 	gfp_mask = sk->sk_allocation;
+ 	if (gfp_mask & __GFP_WAIT)
+@@ -1610,14 +1615,12 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
+ 		if (atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
+ 			skb = alloc_skb(header_len, gfp_mask);
+ 			if (skb) {
+-				int npages;
+ 				int i;
+ 
+ 				/* No pages, we're done... */
+ 				if (!data_len)
+ 					break;
+ 
+-				npages = (data_len + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
+ 				skb->truesize += data_len;
+ 				skb_shinfo(skb)->nr_frags = npages;
+ 				for (i = 0; i < npages; i++) {

Modified: dists/sid/linux/debian/patches/series
==============================================================================
--- dists/sid/linux/debian/patches/series	Mon Jun 11 00:50:22 2012	(r19119)
+++ dists/sid/linux/debian/patches/series	Mon Jun 11 01:14:36 2012	(r19120)
@@ -317,3 +317,4 @@
 
 bugfix/all/NFSv4-Reduce-the-footprint-of-the-idmapper.patch
 bugfix/all/NFSv4-Further-reduce-the-footprint-of-the-idmapper.patch
+bugfix/all/net-sock-validate-data_len-before-allocating-skb-in-.patch



More information about the Kernel-svn-changes mailing list