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: <CANn89i+3SDjwYb=0CAuGgUyGieCqHKso9cHCf=iSKYhV3rdi=Q@mail.gmail.com>
Date:   Thu, 20 Apr 2023 18:51:52 +0200
From:   Eric Dumazet <edumazet@...gle.com>
To:     Leon Romanovsky <leon@...nel.org>
Cc:     Steffen Klassert <steffen.klassert@...unet.com>,
        Leon Romanovsky <leonro@...dia.com>,
        "David S. Miller" <davem@...emloft.net>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        Paolo Abeni <pabeni@...hat.com>, Raed Salem <raeds@...dia.com>
Subject: Re: [PATCH xfrm 1/2] xfrm: release all offloaded policy memory

On Wed, Apr 19, 2023 at 2:19 PM Leon Romanovsky <leon@...nel.org> wrote:
>
> From: Leon Romanovsky <leonro@...dia.com>
>
> Failure to add offloaded policy will cause to the following
> error once user will try to reload driver.
>
> Unregister_netdevice: waiting for eth3 to become free. Usage count = 2
>
> This was caused by xfrm_dev_policy_add() which increments reference
> to net_device. That reference was supposed to be decremented
> in xfrm_dev_policy_free(). However the latter wasn't called.
>
>  unregister_netdevice: waiting for eth3 to become free. Usage count = 2
>  leaked reference.
>   xfrm_dev_policy_add+0xff/0x3d0
>   xfrm_policy_construct+0x352/0x420
>   xfrm_add_policy+0x179/0x320
>   xfrm_user_rcv_msg+0x1d2/0x3d0
>   netlink_rcv_skb+0xe0/0x210
>   xfrm_netlink_rcv+0x45/0x50
>   netlink_unicast+0x346/0x490
>   netlink_sendmsg+0x3b0/0x6c0
>   sock_sendmsg+0x73/0xc0
>   sock_write_iter+0x13b/0x1f0
>   vfs_write+0x528/0x5d0
>   ksys_write+0x120/0x150
>   do_syscall_64+0x3d/0x90
>   entry_SYSCALL_64_after_hwframe+0x46/0xb0
>
> Fixes: 919e43fad516 ("xfrm: add an interface to offload policy")
> Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> ---

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

While reviewing this patch, I also saw xfrm_dev_policy_add() could use
GFP_KERNEL ?

diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
index bef28c6187ebdd0cfc34c8594aab96ac0b13dd24..508c96c90b3911eb88063ad680c77af2b317c95f
100644
--- a/net/xfrm/xfrm_device.c
+++ b/net/xfrm/xfrm_device.c
@@ -363,7 +363,7 @@ int xfrm_dev_policy_add(struct net *net, struct
xfrm_policy *xp,
        }

        xdo->dev = dev;
-       netdev_tracker_alloc(dev, &xdo->dev_tracker, GFP_ATOMIC);
+       netdev_tracker_alloc(dev, &xdo->dev_tracker, GFP_KERNEL);
        xdo->real_dev = dev;
        xdo->type = XFRM_DEV_OFFLOAD_PACKET;
        switch (dir) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ