[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1498170573-24082-1-git-send-email-xiyou.wangcong@gmail.com>
Date: Thu, 22 Jun 2017 15:29:33 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: netdev@...r.kernel.org
Cc: Cong Wang <xiyou.wangcong@...il.com>,
Andrey Konovalov <andreyknvl@...gle.com>
Subject: [Patch net] sit: use __GFP_NOWARN for user controlled allocation
The memory allocation size is controlled by user-space,
if it is too large just fail silently and return NULL,
not to mention there is a fallback allocation later.
Reported-by: Andrey Konovalov <andreyknvl@...gle.com>
Cc: Andrey Konovalov <andreyknvl@...gle.com>
Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
---
net/ipv6/sit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 2378503..f8ad158 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -305,7 +305,7 @@ static int ipip6_tunnel_get_prl(struct ip_tunnel *t,
* we try harder to allocate.
*/
kp = (cmax <= 1 || capable(CAP_NET_ADMIN)) ?
- kcalloc(cmax, sizeof(*kp), GFP_KERNEL) :
+ kcalloc(cmax, sizeof(*kp), GFP_KERNEL | __GFP_NOWARN) :
NULL;
rcu_read_lock();
--
2.5.5
Powered by blists - more mailing lists