All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 2/2] mmc: queue: Cancel recovery work on cleanup
@ 2022-10-07 15:43 Christian Löhle
  2022-10-08 11:31 ` Adrian Hunter
  2022-10-13 14:20 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Löhle @ 2022-10-07 15:43 UTC (permalink / raw)
  To: Adrian Hunter, Ulf Hansson, Linux MMC List, linux-kernel

To prevent any recovery work running after the queue cleanup cancel it.
Any recovery running post-cleanup dereferenced mq->card as NULL
and was not meaningful to begin with.

Cc: stable@vger.kernel.org

Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
---
-v2: Use cancel instead of flush

 drivers/mmc/core/queue.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index fefaa901b50f..86be55d7cf55 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -493,6 +493,13 @@ void mmc_cleanup_queue(struct mmc_queue *mq)
 	if (blk_queue_quiesced(q))
 		blk_mq_unquiesce_queue(q);
 
+	/*
+	 * If the recovery completes the last (and only remaining) request in
+	 * the queue, and the card has been removed, we could end up here with
+	 * the recovery not quite finished yet, so cancel it.
+	 */
+	cancel_work_sync(&mq->recovery_work);
+
 	blk_mq_free_tag_set(&mq->tag_set);
 
 	/*
-- 
2.37.3

Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCHv2 2/2] mmc: queue: Cancel recovery work on cleanup
  2022-10-07 15:43 [PATCHv2 2/2] mmc: queue: Cancel recovery work on cleanup Christian Löhle
@ 2022-10-08 11:31 ` Adrian Hunter
  2022-10-13 14:20 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2022-10-08 11:31 UTC (permalink / raw)
  To: Christian Löhle, Ulf Hansson, Linux MMC List, linux-kernel

On 7/10/22 18:43, Christian Löhle wrote:
> To prevent any recovery work running after the queue cleanup cancel it.
> Any recovery running post-cleanup dereferenced mq->card as NULL
> and was not meaningful to begin with.
> 
> Cc: stable@vger.kernel.org
> 
> Signed-off-by: Christian Loehle <cloehle@hyperstone.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> -v2: Use cancel instead of flush
> 
>  drivers/mmc/core/queue.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
> index fefaa901b50f..86be55d7cf55 100644
> --- a/drivers/mmc/core/queue.c
> +++ b/drivers/mmc/core/queue.c
> @@ -493,6 +493,13 @@ void mmc_cleanup_queue(struct mmc_queue *mq)
>  	if (blk_queue_quiesced(q))
>  		blk_mq_unquiesce_queue(q);
>  
> +	/*
> +	 * If the recovery completes the last (and only remaining) request in
> +	 * the queue, and the card has been removed, we could end up here with
> +	 * the recovery not quite finished yet, so cancel it.
> +	 */
> +	cancel_work_sync(&mq->recovery_work);
> +
>  	blk_mq_free_tag_set(&mq->tag_set);
>  
>  	/*


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv2 2/2] mmc: queue: Cancel recovery work on cleanup
  2022-10-07 15:43 [PATCHv2 2/2] mmc: queue: Cancel recovery work on cleanup Christian Löhle
  2022-10-08 11:31 ` Adrian Hunter
@ 2022-10-13 14:20 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2022-10-13 14:20 UTC (permalink / raw)
  To: Christian Löhle; +Cc: Adrian Hunter, Linux MMC List, linux-kernel

On Fri, 7 Oct 2022 at 17:43, Christian Löhle <CLoehle@hyperstone.com> wrote:
>
> To prevent any recovery work running after the queue cleanup cancel it.
> Any recovery running post-cleanup dereferenced mq->card as NULL
> and was not meaningful to begin with.
>
> Cc: stable@vger.kernel.org
>
> Signed-off-by: Christian Loehle <cloehle@hyperstone.com>

Applied for fixes, thanks!

Kind regards
Uffe


> ---
> -v2: Use cancel instead of flush
>
>  drivers/mmc/core/queue.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
> index fefaa901b50f..86be55d7cf55 100644
> --- a/drivers/mmc/core/queue.c
> +++ b/drivers/mmc/core/queue.c
> @@ -493,6 +493,13 @@ void mmc_cleanup_queue(struct mmc_queue *mq)
>         if (blk_queue_quiesced(q))
>                 blk_mq_unquiesce_queue(q);
>
> +       /*
> +        * If the recovery completes the last (and only remaining) request in
> +        * the queue, and the card has been removed, we could end up here with
> +        * the recovery not quite finished yet, so cancel it.
> +        */
> +       cancel_work_sync(&mq->recovery_work);
> +
>         blk_mq_free_tag_set(&mq->tag_set);
>
>         /*
> --
> 2.37.3
>
> Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
> Managing Director: Dr. Jan Peter Berns.
> Commercial register of local courts: Freiburg HRB381782
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-13 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-07 15:43 [PATCHv2 2/2] mmc: queue: Cancel recovery work on cleanup Christian Löhle
2022-10-08 11:31 ` Adrian Hunter
2022-10-13 14:20 ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.