All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: netlink: Fix uninit-value in netlink_recvmsg()
@ 2019-12-06 13:49 Håkon Bugge
  2019-12-06 18:20 ` Sergei Shtylyov
  2019-12-06 18:47 ` Eric Dumazet
  0 siblings, 2 replies; 6+ messages in thread
From: Håkon Bugge @ 2019-12-06 13:49 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev

If skb_recv_datagram() returns NULL, netlink_recvmsg() will return an
arbitrarily value.

Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
---
 net/netlink/af_netlink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 90b2ab9dd449..bb7276f9c9f8 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1936,6 +1936,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
 		return -EOPNOTSUPP;
 
 	copied = 0;
+	err = 0;
 
 	skb = skb_recv_datagram(sk, flags, noblock, &err);
 	if (skb == NULL)
-- 
2.20.1


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

* Re: [PATCH net] net: netlink: Fix uninit-value in netlink_recvmsg()
  2019-12-06 13:49 [PATCH net] net: netlink: Fix uninit-value in netlink_recvmsg() Håkon Bugge
@ 2019-12-06 18:20 ` Sergei Shtylyov
  2019-12-06 18:45   ` Håkon Bugge
  2019-12-06 18:47 ` Eric Dumazet
  1 sibling, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2019-12-06 18:20 UTC (permalink / raw)
  To: Håkon Bugge, David S . Miller; +Cc: netdev

Hello!

On 12/06/2019 04:49 PM, Håkon Bugge wrote:

> If skb_recv_datagram() returns NULL, netlink_recvmsg() will return an
> arbitrarily value.

   Arbitrary?

> Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
> ---
>  net/netlink/af_netlink.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> index 90b2ab9dd449..bb7276f9c9f8 100644
> --- a/net/netlink/af_netlink.c
> +++ b/net/netlink/af_netlink.c
> @@ -1936,6 +1936,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>  		return -EOPNOTSUPP;
>  
>  	copied = 0;
> +	err = 0;
>  
>  	skb = skb_recv_datagram(sk, flags, noblock, &err);
>  	if (skb == NULL)

MBR, Sergei

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

* Re: [PATCH net] net: netlink: Fix uninit-value in netlink_recvmsg()
  2019-12-06 18:20 ` Sergei Shtylyov
@ 2019-12-06 18:45   ` Håkon Bugge
  2019-12-06 18:57     ` Sergei Shtylyov
  0 siblings, 1 reply; 6+ messages in thread
From: Håkon Bugge @ 2019-12-06 18:45 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: David S . Miller, netdev



> On 6 Dec 2019, at 19:20, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
> 
> Hello!
> 
> On 12/06/2019 04:49 PM, Håkon Bugge wrote:
> 
>> If skb_recv_datagram() returns NULL, netlink_recvmsg() will return an
>> arbitrarily value.
> 
>   Arbitrary?

is an adjective. Since I described the verb *return*, I assumed the adverb, arbitrarily, is correct, But english is not my native language.

Thxs, Håkon

> 
>> Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
>> ---
>> net/netlink/af_netlink.c | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
>> index 90b2ab9dd449..bb7276f9c9f8 100644
>> --- a/net/netlink/af_netlink.c
>> +++ b/net/netlink/af_netlink.c
>> @@ -1936,6 +1936,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>> 		return -EOPNOTSUPP;
>> 
>> 	copied = 0;
>> +	err = 0;
>> 
>> 	skb = skb_recv_datagram(sk, flags, noblock, &err);
>> 	if (skb == NULL)
> 
> MBR, Sergei


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

* Re: [PATCH net] net: netlink: Fix uninit-value in netlink_recvmsg()
  2019-12-06 13:49 [PATCH net] net: netlink: Fix uninit-value in netlink_recvmsg() Håkon Bugge
  2019-12-06 18:20 ` Sergei Shtylyov
@ 2019-12-06 18:47 ` Eric Dumazet
  2019-12-06 19:07   ` Håkon Bugge
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2019-12-06 18:47 UTC (permalink / raw)
  To: Håkon Bugge, David S . Miller; +Cc: netdev



On 12/6/19 5:49 AM, Håkon Bugge wrote:
> If skb_recv_datagram() returns NULL, netlink_recvmsg() will return an
> arbitrarily value.
> 
> Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
> ---
>  net/netlink/af_netlink.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> index 90b2ab9dd449..bb7276f9c9f8 100644
> --- a/net/netlink/af_netlink.c
> +++ b/net/netlink/af_netlink.c
> @@ -1936,6 +1936,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>  		return -EOPNOTSUPP;
>  
>  	copied = 0;
> +	err = 0;
>  
>  	skb = skb_recv_datagram(sk, flags, noblock, &err);
>  	if (skb == NULL)
> 

Please provide a Fixes: tag

By doing the research, you probably would find there is no bug.

err is set in skb_recv_datagram() when there is no packet to read.


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

* Re: [PATCH net] net: netlink: Fix uninit-value in netlink_recvmsg()
  2019-12-06 18:45   ` Håkon Bugge
@ 2019-12-06 18:57     ` Sergei Shtylyov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2019-12-06 18:57 UTC (permalink / raw)
  To: Håkon Bugge; +Cc: David S . Miller, netdev

On 12/06/2019 09:45 PM, Håkon Bugge wrote:

>>> If skb_recv_datagram() returns NULL, netlink_recvmsg() will return an
>>> arbitrarily value.
>>
>>   Arbitrary?
> 
> is an adjective.

   Yes. And it goes with the "value" noun.

> Since I described the verb *return*, I assumed the adverb,
> arbitrarily, is correct,

   In that case, it's misplaced, it should go before the verb.

> But english is not my native language.

   Not mine as well. :-)

> Thxs, Håkon

MBR, Sergei


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

* Re: [PATCH net] net: netlink: Fix uninit-value in netlink_recvmsg()
  2019-12-06 18:47 ` Eric Dumazet
@ 2019-12-06 19:07   ` Håkon Bugge
  0 siblings, 0 replies; 6+ messages in thread
From: Håkon Bugge @ 2019-12-06 19:07 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S . Miller, netdev



> On 6 Dec 2019, at 19:47, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> 
> 
> 
> On 12/6/19 5:49 AM, Håkon Bugge wrote:
>> If skb_recv_datagram() returns NULL, netlink_recvmsg() will return an
>> arbitrarily value.
>> 
>> Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
>> ---
>> net/netlink/af_netlink.c | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
>> index 90b2ab9dd449..bb7276f9c9f8 100644
>> --- a/net/netlink/af_netlink.c
>> +++ b/net/netlink/af_netlink.c
>> @@ -1936,6 +1936,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>> 		return -EOPNOTSUPP;
>> 
>> 	copied = 0;
>> +	err = 0;
>> 
>> 	skb = skb_recv_datagram(sk, flags, noblock, &err);
>> 	if (skb == NULL)
>> 
> 
> Please provide a Fixes: tag
> 
> By doing the research, you probably would find there is no bug.
> 
> err is set in skb_recv_datagram() when there is no packet to read.

yes, you are right, by bad.


Håkon



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

end of thread, other threads:[~2019-12-06 19:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 13:49 [PATCH net] net: netlink: Fix uninit-value in netlink_recvmsg() Håkon Bugge
2019-12-06 18:20 ` Sergei Shtylyov
2019-12-06 18:45   ` Håkon Bugge
2019-12-06 18:57     ` Sergei Shtylyov
2019-12-06 18:47 ` Eric Dumazet
2019-12-06 19:07   ` Håkon Bugge

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.