netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ethtool: fix null-ptr-deref on ref tracker
@ 2021-12-14  1:39 Jakub Kicinski
  2021-12-14  4:46 ` Eric Dumazet
  2021-12-14 12:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2021-12-14  1:39 UTC (permalink / raw)
  To: davem; +Cc: eric.dumazet, netdev, Jakub Kicinski

dev can be a NULL here, not all requests set require_dev.

Fixes: e4b8954074f6 ("netlink: add net device refcount tracker to struct ethnl_req_info")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 net/ethtool/netlink.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
index 23f32a995099..767fb3f17267 100644
--- a/net/ethtool/netlink.c
+++ b/net/ethtool/netlink.c
@@ -141,8 +141,10 @@ int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info,
 		return -EINVAL;
 	}
 
-	req_info->dev = dev;
-	netdev_tracker_alloc(dev, &req_info->dev_tracker, GFP_KERNEL);
+	if (dev) {
+		req_info->dev = dev;
+		netdev_tracker_alloc(dev, &req_info->dev_tracker, GFP_KERNEL);
+	}
 	req_info->flags = flags;
 	return 0;
 }
-- 
2.31.1


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

* Re: [PATCH net-next] ethtool: fix null-ptr-deref on ref tracker
  2021-12-14  1:39 [PATCH net-next] ethtool: fix null-ptr-deref on ref tracker Jakub Kicinski
@ 2021-12-14  4:46 ` Eric Dumazet
  2021-12-14 12:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2021-12-14  4:46 UTC (permalink / raw)
  To: Jakub Kicinski, davem; +Cc: netdev


On 12/13/21 5:39 PM, Jakub Kicinski wrote:
> dev can be a NULL here, not all requests set require_dev.
>
> Fixes: e4b8954074f6 ("netlink: add net device refcount tracker to struct ethnl_req_info")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>   net/ethtool/netlink.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
> index 23f32a995099..767fb3f17267 100644
> --- a/net/ethtool/netlink.c
> +++ b/net/ethtool/netlink.c
> @@ -141,8 +141,10 @@ int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info,
>   		return -EINVAL;
>   	}
>   


Oh I am reading your patch after I sent mine.


Please use edumazet@google.com next time, because eric.dumazet@gmail.com has

huge lag (typical vger -> accounts@gmail.com issues)


Reviewed-by: Eric Dumazet <edumazet@google.com>


Thanks !




> -	req_info->dev = dev;
> -	netdev_tracker_alloc(dev, &req_info->dev_tracker, GFP_KERNEL);
> +	if (dev) {
> +		req_info->dev = dev;
> +		netdev_tracker_alloc(dev, &req_info->dev_tracker, GFP_KERNEL);
> +	}
>   	req_info->flags = flags;
>   	return 0;
>   }

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

* Re: [PATCH net-next] ethtool: fix null-ptr-deref on ref tracker
  2021-12-14  1:39 [PATCH net-next] ethtool: fix null-ptr-deref on ref tracker Jakub Kicinski
  2021-12-14  4:46 ` Eric Dumazet
@ 2021-12-14 12:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-14 12:40 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, eric.dumazet, netdev

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon, 13 Dec 2021 17:39:02 -0800 you wrote:
> dev can be a NULL here, not all requests set require_dev.
> 
> Fixes: e4b8954074f6 ("netlink: add net device refcount tracker to struct ethnl_req_info")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>  net/ethtool/netlink.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Here is the summary with links:
  - [net-next] ethtool: fix null-ptr-deref on ref tracker
    https://git.kernel.org/netdev/net-next/c/0976b888a150

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-12-14 12:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14  1:39 [PATCH net-next] ethtool: fix null-ptr-deref on ref tracker Jakub Kicinski
2021-12-14  4:46 ` Eric Dumazet
2021-12-14 12:40 ` patchwork-bot+netdevbpf

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