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

* Re: [Patch net] sit: use __GFP_NOWARN for user controlled allocation
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Andrey Konovalov @ 2017-06-23 12:21 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev

On Fri, Jun 23, 2017 at 12:29 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> 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.

Thanks!

Tested-by: Andrey Konovalov <andreyknvl.com>

>
> 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	[flat|nested] 4+ messages in thread

* Re: [Patch net] sit: use __GFP_NOWARN for user controlled allocation
  2017-06-23 12:21 ` Andrey Konovalov
@ 2017-06-23 12:22   ` Andrey Konovalov
  0 siblings, 0 replies; 4+ messages in thread
From: Andrey Konovalov @ 2017-06-23 12:22 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev

On Fri, Jun 23, 2017 at 2:21 PM, Andrey Konovalov <andreyknvl@google.com> wrote:
> On Fri, Jun 23, 2017 at 12:29 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> 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.
>
> Thanks!
>
> Tested-by: Andrey Konovalov <andreyknvl.com>

Should be:
Tested-by: Andrey Konovalov <andreyknvl@google.com>

>
>>
>> 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	[flat|nested] 4+ messages in thread

* Re: [Patch net] sit: use __GFP_NOWARN for user controlled allocation
  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 18:08 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2017-06-23 18:08 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, andreyknvl

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Thu, 22 Jun 2017 15:29:33 -0700

> 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>

Applied, thanks.

^ permalink raw reply	[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.