Patch "net/sunrpc: fix reference count leaks in rpc_sysfs_xprt_state_change" has been added to the 5.16-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

    net/sunrpc: fix reference count leaks in rpc_sysfs_xprt_state_change

to the 5.16-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:
     net-sunrpc-fix-reference-count-leaks-in-rpc_sysfs_xp.patch
and it can be found in the queue-5.16 subdirectory.

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



commit d8da015bc9a1c88d2462226a0e61936072eceed8
Author: Xiyu Yang <xiyuyang19@xxxxxxxxxxxx>
Date:   Thu Sep 9 12:32:38 2021 +0800

    net/sunrpc: fix reference count leaks in rpc_sysfs_xprt_state_change
    
    [ Upstream commit 776d794f28c95051bc70405a7b1fa40115658a18 ]
    
    The refcount leak issues take place in an error handling path. When the
    3rd argument buf doesn't match with "offline", "online" or "remove", the
    function simply returns -EINVAL and forgets to decrease the reference
    count of a rpc_xprt object and a rpc_xprt_switch object increased by
    rpc_sysfs_xprt_kobj_get_xprt() and
    rpc_sysfs_xprt_kobj_get_xprt_switch(), causing reference count leaks of
    both unused objects.
    
    Fix this issue by jumping to the error handling path labelled with
    out_put when buf matches none of "offline", "online" or "remove".
    
    Signed-off-by: Xiyu Yang <xiyuyang19@xxxxxxxxxxxx>
    Signed-off-by: Xin Xiong <xiongx18@xxxxxxxxxxxx>
    Signed-off-by: Xin Tan <tanxin.ctf@xxxxxxxxx>
    Signed-off-by: Anna Schumaker <Anna.Schumaker@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c
index 2766dd21935b8..77e7d011c1ab1 100644
--- a/net/sunrpc/sysfs.c
+++ b/net/sunrpc/sysfs.c
@@ -295,8 +295,10 @@ static ssize_t rpc_sysfs_xprt_state_change(struct kobject *kobj,
 		online = 1;
 	else if (!strncmp(buf, "remove", 6))
 		remove = 1;
-	else
-		return -EINVAL;
+	else {
+		count = -EINVAL;
+		goto out_put;
+	}
 
 	if (wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_KILLABLE)) {
 		count = -EINTR;



[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