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

vegard.nossum
2013-12-12T16:56:31Z

From: Vegard Nossum <vegard.nossum@oracle.com>

See cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc.

Cc: Jason Wang <jasowang@redhat.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
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