Patch "kernfs: fix missing kernfs_idr_lock to remove an ID from the IDR" has been added to the 5.15-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

    kernfs: fix missing kernfs_idr_lock to remove an ID from the IDR

to the 5.15-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:
     kernfs-fix-missing-kernfs_idr_lock-to-remove-an-id-f.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 59a4599e4027a0c1c4838a34e9f0a3234f14e757
Author: Muchun Song <muchun.song@xxxxxxxxx>
Date:   Tue May 23 10:40:17 2023 +0800

    kernfs: fix missing kernfs_idr_lock to remove an ID from the IDR
    
    [ Upstream commit 30480b988f88c279752f3202a26b6fee5f586aef ]
    
    The root->ino_idr is supposed to be protected by kernfs_idr_lock, fix
    it.
    
    Fixes: 488dee96bb62 ("kernfs: allow creating kernfs objects with arbitrary uid/gid")
    Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
    Acked-by: Tejun Heo <tj@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230523024017.24851-1-songmuchun@xxxxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 90677cfbcf9c2..6a1cb2a182b67 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -637,7 +637,9 @@ static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root,
 	return kn;
 
  err_out3:
+	spin_lock(&kernfs_idr_lock);
 	idr_remove(&root->ino_idr, (u32)kernfs_ino(kn));
+	spin_unlock(&kernfs_idr_lock);
  err_out2:
 	kmem_cache_free(kernfs_node_cache, kn);
  err_out1:



[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