]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
cifs: fix creating sockets when using sfu mount options
authorSteve French <stfrench@microsoft.com>
Wed, 29 May 2024 23:16:56 +0000 (18:16 -0500)
committerSteve French <stfrench@microsoft.com>
Fri, 31 May 2024 15:55:15 +0000 (10:55 -0500)
When running fstest generic/423 with sfu mount option, it
was being skipped due to inability to create sockets:

  generic/423  [not run] cifs does not support mknod/mkfifo

which can also be easily reproduced with their af_unix tool:

  ./src/af_unix /mnt1/socket-two bind: Operation not permitted

Fix sfu mount option to allow creating and reporting sockets.

Cc: stable@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifspdu.h
fs/smb/client/inode.c
fs/smb/client/smb2ops.c

index c46d418c1c0c3ea065eaa5d4f4f751750df90080..a2072ab9e586d0d3ba34afe5bcab985b38537202 100644 (file)
@@ -2574,7 +2574,7 @@ typedef struct {
 
 
 struct win_dev {
-       unsigned char type[8]; /* IntxCHR or IntxBLK or LnxFIFO*/
+       unsigned char type[8]; /* IntxCHR or IntxBLK or LnxFIFO or LnxSOCK */
        __le64 major;
        __le64 minor;
 } __attribute__((packed));
index 262576573eb5182b8a1729677e1b98e7bdee66a3..4a8aa1de95223dfc487e577e476be18d677b6477 100644 (file)
@@ -606,6 +606,10 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
                                mnr = le64_to_cpu(*(__le64 *)(pbuf+16));
                                fattr->cf_rdev = MKDEV(mjr, mnr);
                        }
+               } else if (memcmp("LnxSOCK", pbuf, 8) == 0) {
+                       cifs_dbg(FYI, "Socket\n");
+                       fattr->cf_mode |= S_IFSOCK;
+                       fattr->cf_dtype = DT_SOCK;
                } else if (memcmp("IntxLNK", pbuf, 7) == 0) {
                        cifs_dbg(FYI, "Symlink\n");
                        fattr->cf_mode |= S_IFLNK;
index 4ce6c3121a7ef17866be79561fa4589360967a17..c8e536540895a2e6378ec16b640752134742d134 100644 (file)
@@ -4997,6 +4997,9 @@ static int __cifs_sfu_make_node(unsigned int xid, struct inode *inode,
                pdev.major = cpu_to_le64(MAJOR(dev));
                pdev.minor = cpu_to_le64(MINOR(dev));
                break;
+       case S_IFSOCK:
+               strscpy(pdev.type, "LnxSOCK");
+               break;
        case S_IFIFO:
                strscpy(pdev.type, "LnxFIFO");
                break;