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: <CALs4sv3KEk9vEeC88iEMXsGqv99caOJk8bj1Dx519yUFvMfSsw@mail.gmail.com>
Date:   Mon, 20 Feb 2023 19:56:14 +0530
From:   Pavan Chebbi <pavan.chebbi@...adcom.com>
To:     Jiri Pirko <jiri@...nulli.us>
Cc:     netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
        linux-kselftest@...r.kernel.org, shuah@...nel.org,
        amirtz@...dia.com
Subject: Re: [patch net] sefltests: netdevsim: wait for devlink instance after
 netns removal

On Mon, Feb 20, 2023 at 6:54 PM Jiri Pirko <jiri@...nulli.us> wrote:
>
> From: Jiri Pirko <jiri@...dia.com>
>
> When devlink instance is put into network namespace and that network
> namespace gets deleted, devlink instance is moved back into init_ns.
> This is done as a part of cleanup_net() routine. Since cleanup_net()
> is called asynchronously from workqueue, there is no guarantee that
> the devlink instance move is done after "ip netns del" returns.
>
> So fix this race by making sure that the devlink instance is present
> before any other operation.
>
> Reported-by: Amir Tzin <amirtz@...dia.com>
> Fixes: b74c37fd35a2 ("selftests: netdevsim: add tests for devlink reload with resources")
> Signed-off-by: Jiri Pirko <jiri@...dia.com>
> ---
>  .../selftests/drivers/net/netdevsim/devlink.sh | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
> index a08c02abde12..7f7d20f22207 100755
> --- a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
> +++ b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
> @@ -17,6 +17,18 @@ SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/
>  DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV_NAME/
>  DL_HANDLE=netdevsim/$DEV_NAME
>
> +wait_for_devlink()
> +{
> +       "$@" | grep -q $DL_HANDLE
> +}
> +
> +devlink_wait()
> +{
> +       local timeout=$1
> +
> +       busywait "$timeout" wait_for_devlink devlink dev
> +}
> +
>  fw_flash_test()
>  {
>         RET=0
> @@ -256,6 +268,9 @@ netns_reload_test()
>         ip netns del testns2
>         ip netns del testns1
>
> +       # Wait until netns async cleanup is done.
> +       devlink_wait 2000
> +
>         log_test "netns reload test"
>  }
>
> @@ -348,6 +363,9 @@ resource_test()
>         ip netns del testns2
>         ip netns del testns1
>
> +       # Wait until netns async cleanup is done.
> +       devlink_wait 2000
> +
>         log_test "resource test"
>  }
>
> --
> 2.39.0
>

Looks good to me.
Reviewed-by: Pavan Chebbi <pavan.chebbi@...adcom.com>

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4209 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ