Patch "remoteproc: stm32_rproc: Add mutex protection for workqueue" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    remoteproc: stm32_rproc: Add mutex protection for workqueue

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     remoteproc-stm32_rproc-add-mutex-protection-for-work.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 83d1fe186a86fd374115618892ff960304156692
Author: Arnaud Pouliquen <arnaud.pouliquen@xxxxxxxxxxx>
Date:   Fri Mar 31 18:06:34 2023 +0200

    remoteproc: stm32_rproc: Add mutex protection for workqueue
    
    [ Upstream commit 35bdafda40cc343ad2ba2cce105eba03a70241cc ]
    
    The workqueue may execute late even after remoteproc is stopped or
    stopping, some resources (rpmsg device and endpoint) have been
    released in rproc_stop_subdevices(), then rproc_vq_interrupt()
    accessing these resources will cause kernel dump.
    
    Call trace:
    virtqueue_add_inbuf
    virtqueue_add_inbuf
    rpmsg_recv_single
    rpmsg_recv_done
    vring_interrupt
    stm32_rproc_mb_vq_work
    process_one_work
    worker_thread
    kthread
    
    Suggested-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
    Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230331160634.3113031-1-arnaud.pouliquen@xxxxxxxxxxx
    Signed-off-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c
index 24760d8ea6374..df784fec124f6 100644
--- a/drivers/remoteproc/stm32_rproc.c
+++ b/drivers/remoteproc/stm32_rproc.c
@@ -301,8 +301,16 @@ static void stm32_rproc_mb_vq_work(struct work_struct *work)
 	struct stm32_mbox *mb = container_of(work, struct stm32_mbox, vq_work);
 	struct rproc *rproc = dev_get_drvdata(mb->client.dev);
 
+	mutex_lock(&rproc->lock);
+
+	if (rproc->state != RPROC_RUNNING)
+		goto unlock_mutex;
+
 	if (rproc_vq_interrupt(rproc, mb->vq_id) == IRQ_NONE)
 		dev_dbg(&rproc->dev, "no message found in vq%d\n", mb->vq_id);
+
+unlock_mutex:
+	mutex_unlock(&rproc->lock);
 }
 
 static void stm32_rproc_mb_callback(struct mbox_client *cl, void *data)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux