Patch "devlink: protect devlink dump by the instance lock" has been added to the 6.1-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

    devlink: protect devlink dump by the instance lock

to the 6.1-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:
     devlink-protect-devlink-dump-by-the-instance-lock.patch
and it can be found in the queue-6.1 subdirectory.

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



commit d52ae9da9605f737630d78e8c7665e19f7997f69
Author: Jakub Kicinski <kuba@xxxxxxxxxx>
Date:   Thu Dec 15 20:41:22 2022 -0800

    devlink: protect devlink dump by the instance lock
    
    [ Upstream commit 214964a13ab56a9757d146b79b468a7ca190fbfb ]
    
    Take the instance lock around devlink_nl_fill() when dumping,
    doit takes it already.
    
    We are only dumping basic info so in the worst case we were risking
    data races around the reload statistics. Until the big devlink mutex
    was removed all relevant code was protected by it, so the missing
    instance lock was not exposed.
    
    Fixes: d3efc2a6a6d8 ("net: devlink: remove devlink_mutex")
    Reviewed-by: Jiri Pirko <jiri@xxxxxxxxxx>
    Reviewed-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20221216044122.1863550-1-kuba@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/devlink.c b/net/core/devlink.c
index e8f1af4231db..2aa77d4b80d0 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -1505,10 +1505,13 @@ static int devlink_nl_cmd_get_dumpit(struct sk_buff *msg,
 			continue;
 		}
 
+		devl_lock(devlink);
 		err = devlink_nl_fill(msg, devlink, DEVLINK_CMD_NEW,
 				      NETLINK_CB(cb->skb).portid,
 				      cb->nlh->nlmsg_seq, NLM_F_MULTI);
+		devl_unlock(devlink);
 		devlink_put(devlink);
+
 		if (err)
 			goto out;
 		idx++;



[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