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: <CAPhsuW6Q6Mf=GqRcGbMrrU_4gPvyOdJz2ZkEKZVOT=mfeQtpjg@mail.gmail.com>
Date:   Mon, 21 Aug 2023 17:13:30 -0700
From:   Song Liu <song@...nel.org>
To:     Yu Kuai <yukuai1@...weicloud.com>
Cc:     xni@...hat.com, linux-raid@...r.kernel.org,
        linux-kernel@...r.kernel.org, yukuai3@...wei.com,
        yi.zhang@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH -next 3/7] md: don't rely on 'mddev->pers' to be set in mddev_suspend()

On Thu, Aug 3, 2023 at 6:30 AM Yu Kuai <yukuai1@...weicloud.com> wrote:
>
> From: Yu Kuai <yukuai3@...wei.com>
>
> Now that active io is initialized when mddev is allocated, it's safe to
> call mddev_suspend() before 'mddev->pers' is set.
>
> This also prevent null-ptr-def in some cases that caller doesn't
> guarantee 'mddev->pers' to be set.

This description is a little confusing (to me at least). Please revise it.

Other than that, the set looks good to me.

Thanks,
Song

>
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
> ---
>  drivers/md/md.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 897e94a9e47d..f14f2f0a9484 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -448,7 +448,7 @@ void mddev_suspend(struct mddev *mddev)
>         set_bit(MD_ALLOW_SB_UPDATE, &mddev->flags);
>         percpu_ref_kill(&mddev->active_io);
>
> -       if (mddev->pers->prepare_suspend)
> +       if (mddev->pers && mddev->pers->prepare_suspend)
>                 mddev->pers->prepare_suspend(mddev);
>
>         wait_event(mddev->sb_wait, percpu_ref_is_zero(&mddev->active_io));
> --
> 2.39.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ