netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ipv6: seg6_genl_set_tunsrc() must check kmemdup() return value
@ 2017-01-20 15:57 Eric Dumazet
  2017-01-20 16:06 ` David Lebrun
  2017-01-20 16:09 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2017-01-20 15:57 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, David Lebrun

From: Eric Dumazet <edumazet@google.com>

seg6_genl_get_tunsrc() and set_tun_src() do not handle tun_src being
possibly NULL, so we must check kmemdup() return value and abort if
it is NULL

Fixes: 915d7e5e5930 ("ipv6: sr: add code base for control plane support of SR-IPv6")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: David Lebrun <david.lebrun@uclouvain.be>
---
 net/ipv6/seg6.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c
index b172d85c650a376f541ea05d72046c76b8404303..a855eb325b030a666fe92c56a2d432c77d9dfe7a 100644
--- a/net/ipv6/seg6.c
+++ b/net/ipv6/seg6.c
@@ -176,6 +176,8 @@ static int seg6_genl_set_tunsrc(struct sk_buff *skb, struct genl_info *info)
 
 	val = nla_data(info->attrs[SEG6_ATTR_DST]);
 	t_new = kmemdup(val, sizeof(*val), GFP_KERNEL);
+	if (!t_new)
+		return -ENOMEM;
 
 	mutex_lock(&sdata->lock);
 

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

* Re: [PATCH net] ipv6: seg6_genl_set_tunsrc() must check kmemdup() return value
  2017-01-20 15:57 [PATCH net] ipv6: seg6_genl_set_tunsrc() must check kmemdup() return value Eric Dumazet
@ 2017-01-20 16:06 ` David Lebrun
  2017-01-20 16:09 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Lebrun @ 2017-01-20 16:06 UTC (permalink / raw)
  To: Eric Dumazet, David Miller; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]

On 01/20/2017 04:57 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> seg6_genl_get_tunsrc() and set_tun_src() do not handle tun_src being
> possibly NULL, so we must check kmemdup() return value and abort if
> it is NULL
> 
> Fixes: 915d7e5e5930 ("ipv6: sr: add code base for control plane support of SR-IPv6")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: David Lebrun <david.lebrun@uclouvain.be>
> ---
>  net/ipv6/seg6.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c
> index b172d85c650a376f541ea05d72046c76b8404303..a855eb325b030a666fe92c56a2d432c77d9dfe7a 100644
> --- a/net/ipv6/seg6.c
> +++ b/net/ipv6/seg6.c
> @@ -176,6 +176,8 @@ static int seg6_genl_set_tunsrc(struct sk_buff *skb, struct genl_info *info)
>  
>  	val = nla_data(info->attrs[SEG6_ATTR_DST]);
>  	t_new = kmemdup(val, sizeof(*val), GFP_KERNEL);
> +	if (!t_new)
> +		return -ENOMEM;
>  
>  	mutex_lock(&sdata->lock);
>  
> 
> 

Thanks :)

Acked-by: David Lebrun <david.lebrun@uclouvain.be>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

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

* Re: [PATCH net] ipv6: seg6_genl_set_tunsrc() must check kmemdup() return value
  2017-01-20 15:57 [PATCH net] ipv6: seg6_genl_set_tunsrc() must check kmemdup() return value Eric Dumazet
  2017-01-20 16:06 ` David Lebrun
@ 2017-01-20 16:09 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-01-20 16:09 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, david.lebrun

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 20 Jan 2017 07:57:42 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> seg6_genl_get_tunsrc() and set_tun_src() do not handle tun_src being
> possibly NULL, so we must check kmemdup() return value and abort if
> it is NULL
> 
> Fixes: 915d7e5e5930 ("ipv6: sr: add code base for control plane support of SR-IPv6")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied, thanks Eric.

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

end of thread, other threads:[~2017-01-20 16:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-20 15:57 [PATCH net] ipv6: seg6_genl_set_tunsrc() must check kmemdup() return value Eric Dumazet
2017-01-20 16:06 ` David Lebrun
2017-01-20 16:09 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).