Patch "memfd: check for non-NULL file_seals in memfd_create() syscall" 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

    memfd: check for non-NULL file_seals in memfd_create() syscall

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:
     memfd-check-for-non-null-file_seals-in-memfd_create-.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 1ca0db34e8a081f5e10f55d4866410143ce976e5
Author: Roberto Sassu <roberto.sassu@xxxxxxxxxx>
Date:   Wed Jun 7 15:24:27 2023 +0200

    memfd: check for non-NULL file_seals in memfd_create() syscall
    
    [ Upstream commit 935d44acf621aa0688fef8312dec3e5940f38f4e ]
    
    Ensure that file_seals is non-NULL before using it in the memfd_create()
    syscall.  One situation in which memfd_file_seals_ptr() could return a
    NULL pointer when CONFIG_SHMEM=n, oopsing the kernel.
    
    Link: https://lkml.kernel.org/r/20230607132427.2867435-1-roberto.sassu@xxxxxxxxxxxxxxx
    Fixes: 47b9012ecdc7 ("shmem: add sealing support to hugetlb-backed memfd")
    Signed-off-by: Roberto Sassu <roberto.sassu@xxxxxxxxxx>
    Cc: Marc-Andr Lureau <marcandre.lureau@xxxxxxxxxx>
    Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
    Cc: <stable@xxxxxxxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/mm/memfd.c b/mm/memfd.c
index 475d095dd7f53..a73af8be9c285 100644
--- a/mm/memfd.c
+++ b/mm/memfd.c
@@ -330,7 +330,8 @@ SYSCALL_DEFINE2(memfd_create,
 
 	if (flags & MFD_ALLOW_SEALING) {
 		file_seals = memfd_file_seals_ptr(file);
-		*file_seals &= ~F_SEAL_SEAL;
+		if (file_seals)
+			*file_seals &= ~F_SEAL_SEAL;
 	}
 
 	fd_install(fd, file);



[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