All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch net] sit: use __GFP_NOWARN for user controlled allocation
@ 2017-06-22 22:29 Cong Wang
  2017-06-23 12:21 ` Andrey Konovalov
  2017-06-23 18:08 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Cong Wang @ 2017-06-22 22:29 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang, Andrey Konovalov

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@google.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-23 18:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-22 22:29 [Patch net] sit: use __GFP_NOWARN for user controlled allocation Cong Wang
2017-06-23 12:21 ` Andrey Konovalov
2017-06-23 12:22   ` Andrey Konovalov
2017-06-23 18:08 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.