Patch "soc: ti: k3-ringacc: Add try_module_get() to k3_dmaring_request_dual_ring()" has been added to the 6.2-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

    soc: ti: k3-ringacc: Add try_module_get() to k3_dmaring_request_dual_ring()

to the 6.2-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:
     soc-ti-k3-ringacc-add-try_module_get-to-k3_dmaring_r.patch
and it can be found in the queue-6.2 subdirectory.

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



commit 366607d5c260e611778d1727c2d4a9e901a1dc64
Author: Nicolas Frayer <nfrayer@xxxxxxxxxxxx>
Date:   Fri Dec 30 01:14:04 2022 +0100

    soc: ti: k3-ringacc: Add try_module_get() to k3_dmaring_request_dual_ring()
    
    [ Upstream commit 5f1732a8683c1da8faaa90d6ffc3bd6d33013a58 ]
    
    When the k3 ring accelerator driver has been modified to add module build
    support, try_module_get() and module_put() have been added to update the
    module refcnt. One code path has not been updated and it has introduced
    an issue where the refcnt is decremented by module_put() in
    k3_ringacc_ring_free() without being incremented previously.
    Adding try_module_get() to k3_dmaring_request_dual_ring() ensures the
    refcnt is kept up to date.
    
    Fixes: c07f216a8b72 ("soc: ti: k3-ringacc: Allow the driver to be built as module")
    Signed-off-by: Nicolas Frayer <nfrayer@xxxxxxxxxxxx>
    Reviewed-by: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20221230001404.10902-1-nfrayer@xxxxxxxxxxxx
    Signed-off-by: Nishanth Menon <nm@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/soc/ti/k3-ringacc.c b/drivers/soc/ti/k3-ringacc.c
index e01e4d815230a..8f131368a7586 100644
--- a/drivers/soc/ti/k3-ringacc.c
+++ b/drivers/soc/ti/k3-ringacc.c
@@ -406,6 +406,11 @@ static int k3_dmaring_request_dual_ring(struct k3_ringacc *ringacc, int fwd_id,
 
 	mutex_lock(&ringacc->req_lock);
 
+	if (!try_module_get(ringacc->dev->driver->owner)) {
+		ret = -EINVAL;
+		goto err_module_get;
+	}
+
 	if (test_bit(fwd_id, ringacc->rings_inuse)) {
 		ret = -EBUSY;
 		goto error;
@@ -421,6 +426,8 @@ static int k3_dmaring_request_dual_ring(struct k3_ringacc *ringacc, int fwd_id,
 	return 0;
 
 error:
+	module_put(ringacc->dev->driver->owner);
+err_module_get:
 	mutex_unlock(&ringacc->req_lock);
 	return ret;
 }



[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