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] [day] [month] [year] [list]
Date:   Mon, 28 Sep 2020 12:33:45 +0200
From:   Ulf Hansson <ulf.hansson@...aro.org>
To:     Kai-Heng Feng <kai.heng.feng@...onical.com>
Cc:     Maxim Levitsky <maximlevitsky@...il.com>,
        Alex Dubov <oakad@...oo.com>,
        "open list:SONY MEMORYSTICK SUBSYSTEM" <linux-mmc@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] memstick: Skip allocating card when removing host

On Fri, 25 Sep 2020 at 10:49, Kai-Heng Feng <kai.heng.feng@...onical.com> wrote:
>
> After commit 6827ca573c03 ("memstick: rtsx_usb_ms: Support runtime power
> management"), removing module rtsx_usb_ms will be stuck.
>
> The deadlock is caused by powering on and powering off at the same time,
> the former one is when memstick_check() is flushed, and the later is called
> by memstick_remove_host().
>
> Soe let's skip allocating card to prevent this issue.
>
> Fixes: 6827ca573c03 ("memstick: rtsx_usb_ms: Support runtime power management")
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@...onical.com>

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe


> ---
>  drivers/memstick/core/memstick.c | 4 ++++
>  include/linux/memstick.h         | 1 +
>  2 files changed, 5 insertions(+)
>
> diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
> index 693ee73eb291..ef03d6fafc5c 100644
> --- a/drivers/memstick/core/memstick.c
> +++ b/drivers/memstick/core/memstick.c
> @@ -441,6 +441,9 @@ static void memstick_check(struct work_struct *work)
>         } else if (host->card->stop)
>                 host->card->stop(host->card);
>
> +       if (host->removing)
> +               goto out_power_off;
> +
>         card = memstick_alloc_card(host);
>
>         if (!card) {
> @@ -545,6 +548,7 @@ EXPORT_SYMBOL(memstick_add_host);
>   */
>  void memstick_remove_host(struct memstick_host *host)
>  {
> +       host->removing = 1;
>         flush_workqueue(workqueue);
>         mutex_lock(&host->lock);
>         if (host->card)
> diff --git a/include/linux/memstick.h b/include/linux/memstick.h
> index da4c65f9435f..ebf73d4ee969 100644
> --- a/include/linux/memstick.h
> +++ b/include/linux/memstick.h
> @@ -281,6 +281,7 @@ struct memstick_host {
>
>         struct memstick_dev *card;
>         unsigned int        retries;
> +       bool removing;
>
>         /* Notify the host that some requests are pending. */
>         void                (*request)(struct memstick_host *host);
> --
> 2.17.1
>

Powered by blists - more mailing lists