lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJeaaVhXU0VHZ0QF5-juS+xXRjk2rXfY2W+_GsJL_yXbA@mail.gmail.com>
Date: Fri, 22 Nov 2024 00:41:14 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Breno Leitao <leitao@...ian.org>
Cc: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, 
	Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, 
	Michal Kubiak <michal.kubiak@...el.com>, netdev@...r.kernel.org, 
	linux-kernel@...r.kernel.org, kernel-team@...a.com, 
	Herbert Xu <herbert@...dor.apana.org.au>
Subject: Re: [PATCH net] netpoll: Use rtnl_dereference() for npinfo pointer access

On Thu, Nov 21, 2024 at 3:59 PM Breno Leitao <leitao@...ian.org> wrote:
>
> In the __netpoll_setup() function, when accessing the device's npinfo
> pointer, replace rcu_access_pointer() with rtnl_dereference(). This
> change is more appropriate, as suggested by Herbert Xu.
>
> The function is called with the RTNL mutex held, and the pointer is
> being dereferenced later, so, dereference earlier and just reuse the
> pointer for the if/else.
>
> The replacement ensures correct pointer access while maintaining
> the existing locking and RCU semantics of the netpoll subsystem.
>
> Fixes: c75964e40e69 ("netpoll: Use rtnl_dereference() for npinfo pointer access")

This seems wrong. This sha1 does not exist, and the title is this patch.

We do not send a patch saying it is fixing itself.

I would suggest instead :

Fixes: c69c5e10adb9 ("netpoll: Use rcu_access_pointer() in __netpoll_setup")

> Suggested-by: Herbert Xu <herbert@...dor.apana.org.au>
> Signed-off-by: Breno Leitao <leitao@...ian.org>
> ---
>  net/core/netpoll.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> index 45fb60bc4803958eb07d4038028269fc0c19622e..30152811e0903a369ccca30500e11e696be158fd 100644
> --- a/net/core/netpoll.c
> +++ b/net/core/netpoll.c
> @@ -626,7 +626,8 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev)
>                 goto out;
>         }
>
> -       if (!rcu_access_pointer(ndev->npinfo)) {
> +       npinfo = rtnl_dereference(ndev->npinfo);
> +       if (!npinfo) {
>                 npinfo = kmalloc(sizeof(*npinfo), GFP_KERNEL);
>                 if (!npinfo) {
>                         err = -ENOMEM;
> @@ -646,7 +647,6 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev)
>                                 goto free_npinfo;
>                 }
>         } else {
> -               npinfo = rtnl_dereference(ndev->npinfo);
>                 refcount_inc(&npinfo->refcnt);
>         }
>
>
> ---
> base-commit: 66418447d27b7f4c027587582a133dd0bc0a663b
> change-id: 20241121-netpoll_rcu_herbet_fix-3f0a433b7860
>
> Best regards,
> --
> Breno Leitao <leitao@...ian.org>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ