cifs: Improve guard for excluding $LXDEV xattr
authorPali Rohár <pali@kernel.org>
Thu, 12 Sep 2024 13:06:22 +0000 (15:06 +0200)
committerSteve French <stfrench@microsoft.com>
Mon, 25 Nov 2024 20:50:32 +0000 (14:50 -0600)
$LXDEV xattr is for storing block/char device's major and minor number.
Change guard which excludes storing $LXDEV xattr to explicitly filter
everything except block and char device. Current guard is opposite, which
is currently correct but is less-safe. This change is required for adding
support for creating WSL-style symlinks as symlinks also do not use
device's major and minor numbers.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/reparse.c

index 722c9be..732b3b5 100644 (file)
@@ -378,8 +378,8 @@ static int wsl_set_xattrs(struct inode *inode, umode_t _mode,
 
        memset(iov, 0, sizeof(*iov));
 
-       /* Exclude $LXDEV xattr for sockets and fifos */
-       if (S_ISSOCK(_mode) || S_ISFIFO(_mode))
+       /* Exclude $LXDEV xattr for non-device files */
+       if (!S_ISBLK(_mode) && !S_ISCHR(_mode))
                num_xattrs = ARRAY_SIZE(xattrs) - 1;
        else
                num_xattrs = ARRAY_SIZE(xattrs);