Patch "afs: Fix mmap" 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

    afs: Fix mmap

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:
     afs-fix-mmap.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 c2019975611f5beb89f05001afd9fd0edcccd2ed
Author: David Howells <dhowells@xxxxxxxxxx>
Date:   Tue Dec 14 09:22:12 2021 +0000

    afs: Fix mmap
    
    [ Upstream commit 1744a22ae948799da7927b53ec97ccc877ff9d61 ]
    
    Fix afs_add_open_map() to check that the vnode isn't already on the list
    when it adds it.  It's possible that afs_drop_open_mmap() decremented
    the cb_nr_mmap counter, but hadn't yet got into the locked section to
    remove it.
    
    Also vnode->cb_mmap_link should be initialised, so fix that too.
    
    Fixes: 6e0e99d58a65 ("afs: Fix mmap coherency vs 3rd-party changes")
    Reported-by: kafs-testing+fedora34_64checkkafs-build-300@xxxxxxxxxxxx
    Suggested-by: Marc Dionne <marc.dionne@xxxxxxxxxxxx>
    Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
    Tested-by: kafs-testing+fedora34_64checkkafs-build-300@xxxxxxxxxxxx
    cc: linux-afs@xxxxxxxxxxxxxxxxxxx
    Link: https://lore.kernel.org/r/686465.1639435380@xxxxxxxxxxxxxxxxxxxxxx/ # v1
    Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/afs/file.c b/fs/afs/file.c
index e6c447ae91f38..b165377179c3c 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -502,8 +502,9 @@ static void afs_add_open_mmap(struct afs_vnode *vnode)
 	if (atomic_inc_return(&vnode->cb_nr_mmap) == 1) {
 		down_write(&vnode->volume->cell->fs_open_mmaps_lock);
 
-		list_add_tail(&vnode->cb_mmap_link,
-			      &vnode->volume->cell->fs_open_mmaps);
+		if (list_empty(&vnode->cb_mmap_link))
+			list_add_tail(&vnode->cb_mmap_link,
+				      &vnode->volume->cell->fs_open_mmaps);
 
 		up_write(&vnode->volume->cell->fs_open_mmaps_lock);
 	}
diff --git a/fs/afs/super.c b/fs/afs/super.c
index d110def8aa8eb..34c68724c98be 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -667,6 +667,7 @@ static void afs_i_init_once(void *_vnode)
 	INIT_LIST_HEAD(&vnode->pending_locks);
 	INIT_LIST_HEAD(&vnode->granted_locks);
 	INIT_DELAYED_WORK(&vnode->lock_work, afs_lock_work);
+	INIT_LIST_HEAD(&vnode->cb_mmap_link);
 	seqlock_init(&vnode->cb_lock);
 }
 



[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