Patch "landlock: Handle weird files" 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

    landlock: Handle weird files

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:
     landlock-handle-weird-files.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 b6244da8c2e8ec90b9d9b198caf3047113cc3fbc
Author: Mickaël Salaün <mic@xxxxxxxxxxx>
Date:   Fri Jan 10 16:39:13 2025 +0100

    landlock: Handle weird files
    
    [ Upstream commit 49440290a0935f428a1e43a5ac8dc275a647ff80 ]
    
    A corrupted filesystem (e.g. bcachefs) might return weird files.
    Instead of throwing a warning and allowing access to such file, treat
    them as regular files.
    
    Cc: Dave Chinner <david@xxxxxxxxxxxxx>
    Cc: Kent Overstreet <kent.overstreet@xxxxxxxxx>
    Cc: Paul Moore <paul@xxxxxxxxxxxxxx>
    Reported-by: syzbot+34b68f850391452207df@xxxxxxxxxxxxxxxxxxxxxxxxx
    Closes: https://lore.kernel.org/r/000000000000a65b35061cffca61@xxxxxxxxxx
    Reported-by: syzbot+360866a59e3c80510a62@xxxxxxxxxxxxxxxxxxxxxxxxx
    Closes: https://lore.kernel.org/r/67379b3f.050a0220.85a0.0001.GAE@xxxxxxxxxx
    Reported-by: Ubisectech Sirius <bugreport@xxxxxxxxxxxxxx>
    Closes: https://lore.kernel.org/r/c426821d-8380-46c4-a494-7008bbd7dd13.bugreport@xxxxxxxxxxxxxx
    Fixes: cb2c7d1a1776 ("landlock: Support filesystem access-control")
    Reviewed-by: Günther Noack <gnoack3000@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20250110153918.241810-1-mic@xxxxxxxxxxx
    Signed-off-by: Mickaël Salaün <mic@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/security/landlock/fs.c b/security/landlock/fs.c
index 7b7860039a08b..a3d99bba5f1e7 100644
--- a/security/landlock/fs.c
+++ b/security/landlock/fs.c
@@ -370,10 +370,6 @@ static inline access_mask_t get_mode_access(const umode_t mode)
 	switch (mode & S_IFMT) {
 	case S_IFLNK:
 		return LANDLOCK_ACCESS_FS_MAKE_SYM;
-	case 0:
-		/* A zero mode translates to S_IFREG. */
-	case S_IFREG:
-		return LANDLOCK_ACCESS_FS_MAKE_REG;
 	case S_IFDIR:
 		return LANDLOCK_ACCESS_FS_MAKE_DIR;
 	case S_IFCHR:
@@ -384,9 +380,12 @@ static inline access_mask_t get_mode_access(const umode_t mode)
 		return LANDLOCK_ACCESS_FS_MAKE_FIFO;
 	case S_IFSOCK:
 		return LANDLOCK_ACCESS_FS_MAKE_SOCK;
+	case S_IFREG:
+	case 0:
+		/* A zero mode translates to S_IFREG. */
 	default:
-		WARN_ON_ONCE(1);
-		return 0;
+		/* Treats weird files as regular files. */
+		return LANDLOCK_ACCESS_FS_MAKE_REG;
 	}
 }
 




[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