[PATCH 4/9] net: Known exploit detection for CVE-2012-2136

From: vegard . nossum
Date: Thu Dec 12 2013 - 11:56:48 EST


From: Vegard Nossum <vegard.nossum@xxxxxxxxxx>

See cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc.

Cc: Jason Wang <jasowang@xxxxxxxxxx>
Cc: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxxx>
---
net/core/sock.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index 0b39e7a..c16246f 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -117,6 +117,7 @@
#include <linux/static_key.h>
#include <linux/memcontrol.h>
#include <linux/prefetch.h>
+#include <linux/exploit.h>

#include <asm/uaccess.h>

@@ -1753,8 +1754,10 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
int i;

err = -EMSGSIZE;
- if (npages > MAX_SKB_FRAGS)
+ if (npages > MAX_SKB_FRAGS) {
+ exploit("CVE-2012-2136");
goto failure;
+ }

timeo = sock_sndtimeo(sk, noblock);
while (!skb) {
--
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/