Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag '4.17-rc4-SMB3-Fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
"Some small SMB3 fixes for 4.17-rc5, some for stable"

* tag '4.17-rc4-SMB3-Fixes' of git://git.samba.org/sfrench/cifs-2.6:
smb3: directory sync should not return an error
cifs: smb2ops: Fix listxattr() when there are no EAs
cifs: smbd: Enable signing with smbdirect
cifs: Allocate validate negotiation request through kmalloc

+57 -43
+13
fs/cifs/cifsfs.c
··· 1047 1047 return rc; 1048 1048 } 1049 1049 1050 + /* 1051 + * Directory operations under CIFS/SMB2/SMB3 are synchronous, so fsync() 1052 + * is a dummy operation. 1053 + */ 1054 + static int cifs_dir_fsync(struct file *file, loff_t start, loff_t end, int datasync) 1055 + { 1056 + cifs_dbg(FYI, "Sync directory - name: %pD datasync: 0x%x\n", 1057 + file, datasync); 1058 + 1059 + return 0; 1060 + } 1061 + 1050 1062 static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off, 1051 1063 struct file *dst_file, loff_t destoff, 1052 1064 size_t len, unsigned int flags) ··· 1193 1181 .copy_file_range = cifs_copy_file_range, 1194 1182 .clone_file_range = cifs_clone_file_range, 1195 1183 .llseek = generic_file_llseek, 1184 + .fsync = cifs_dir_fsync, 1196 1185 }; 1197 1186 1198 1187 static void
-8
fs/cifs/connect.c
··· 1977 1977 goto cifs_parse_mount_err; 1978 1978 } 1979 1979 1980 - #ifdef CONFIG_CIFS_SMB_DIRECT 1981 - if (vol->rdma && vol->sign) { 1982 - cifs_dbg(VFS, "Currently SMB direct doesn't support signing." 1983 - " This is being fixed\n"); 1984 - goto cifs_parse_mount_err; 1985 - } 1986 - #endif 1987 - 1988 1980 #ifndef CONFIG_KEYS 1989 1981 /* Muliuser mounts require CONFIG_KEYS support */ 1990 1982 if (vol->multiuser) {
+6
fs/cifs/smb2ops.c
··· 589 589 590 590 SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); 591 591 592 + /* 593 + * If ea_name is NULL (listxattr) and there are no EAs, return 0 as it's 594 + * not an error. Otherwise, the specified ea_name was not found. 595 + */ 592 596 if (!rc) 593 597 rc = move_smb2_ea_to_cifs(ea_data, buf_size, smb2_data, 594 598 SMB2_MAX_EA_BUF, ea_name); 599 + else if (!ea_name && rc == -ENODATA) 600 + rc = 0; 595 601 596 602 kfree(smb2_data); 597 603 return rc;
+38 -35
fs/cifs/smb2pdu.c
··· 730 730 731 731 int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) 732 732 { 733 - int rc = 0; 734 - struct validate_negotiate_info_req vneg_inbuf; 733 + int rc; 734 + struct validate_negotiate_info_req *pneg_inbuf; 735 735 struct validate_negotiate_info_rsp *pneg_rsp = NULL; 736 736 u32 rsplen; 737 737 u32 inbuflen; /* max of 4 dialects */ 738 738 739 739 cifs_dbg(FYI, "validate negotiate\n"); 740 - 741 - #ifdef CONFIG_CIFS_SMB_DIRECT 742 - if (tcon->ses->server->rdma) 743 - return 0; 744 - #endif 745 740 746 741 /* In SMB3.11 preauth integrity supersedes validate negotiate */ 747 742 if (tcon->ses->server->dialect == SMB311_PROT_ID) ··· 760 765 if (tcon->ses->session_flags & SMB2_SESSION_FLAG_IS_NULL) 761 766 cifs_dbg(VFS, "Unexpected null user (anonymous) auth flag sent by server\n"); 762 767 763 - vneg_inbuf.Capabilities = 768 + pneg_inbuf = kmalloc(sizeof(*pneg_inbuf), GFP_NOFS); 769 + if (!pneg_inbuf) 770 + return -ENOMEM; 771 + 772 + pneg_inbuf->Capabilities = 764 773 cpu_to_le32(tcon->ses->server->vals->req_capabilities); 765 - memcpy(vneg_inbuf.Guid, tcon->ses->server->client_guid, 774 + memcpy(pneg_inbuf->Guid, tcon->ses->server->client_guid, 766 775 SMB2_CLIENT_GUID_SIZE); 767 776 768 777 if (tcon->ses->sign) 769 - vneg_inbuf.SecurityMode = 778 + pneg_inbuf->SecurityMode = 770 779 cpu_to_le16(SMB2_NEGOTIATE_SIGNING_REQUIRED); 771 780 else if (global_secflags & CIFSSEC_MAY_SIGN) 772 - vneg_inbuf.SecurityMode = 781 + pneg_inbuf->SecurityMode = 773 782 cpu_to_le16(SMB2_NEGOTIATE_SIGNING_ENABLED); 774 783 else 775 - vneg_inbuf.SecurityMode = 0; 784 + pneg_inbuf->SecurityMode = 0; 776 785 777 786 778 787 if (strcmp(tcon->ses->server->vals->version_string, 779 788 SMB3ANY_VERSION_STRING) == 0) { 780 - vneg_inbuf.Dialects[0] = cpu_to_le16(SMB30_PROT_ID); 781 - vneg_inbuf.Dialects[1] = cpu_to_le16(SMB302_PROT_ID); 782 - vneg_inbuf.DialectCount = cpu_to_le16(2); 789 + pneg_inbuf->Dialects[0] = cpu_to_le16(SMB30_PROT_ID); 790 + pneg_inbuf->Dialects[1] = cpu_to_le16(SMB302_PROT_ID); 791 + pneg_inbuf->DialectCount = cpu_to_le16(2); 783 792 /* structure is big enough for 3 dialects, sending only 2 */ 784 - inbuflen = sizeof(struct validate_negotiate_info_req) - 2; 793 + inbuflen = sizeof(*pneg_inbuf) - 794 + sizeof(pneg_inbuf->Dialects[0]); 785 795 } else if (strcmp(tcon->ses->server->vals->version_string, 786 796 SMBDEFAULT_VERSION_STRING) == 0) { 787 - vneg_inbuf.Dialects[0] = cpu_to_le16(SMB21_PROT_ID); 788 - vneg_inbuf.Dialects[1] = cpu_to_le16(SMB30_PROT_ID); 789 - vneg_inbuf.Dialects[2] = cpu_to_le16(SMB302_PROT_ID); 790 - vneg_inbuf.DialectCount = cpu_to_le16(3); 797 + pneg_inbuf->Dialects[0] = cpu_to_le16(SMB21_PROT_ID); 798 + pneg_inbuf->Dialects[1] = cpu_to_le16(SMB30_PROT_ID); 799 + pneg_inbuf->Dialects[2] = cpu_to_le16(SMB302_PROT_ID); 800 + pneg_inbuf->DialectCount = cpu_to_le16(3); 791 801 /* structure is big enough for 3 dialects */ 792 - inbuflen = sizeof(struct validate_negotiate_info_req); 802 + inbuflen = sizeof(*pneg_inbuf); 793 803 } else { 794 804 /* otherwise specific dialect was requested */ 795 - vneg_inbuf.Dialects[0] = 805 + pneg_inbuf->Dialects[0] = 796 806 cpu_to_le16(tcon->ses->server->vals->protocol_id); 797 - vneg_inbuf.DialectCount = cpu_to_le16(1); 807 + pneg_inbuf->DialectCount = cpu_to_le16(1); 798 808 /* structure is big enough for 3 dialects, sending only 1 */ 799 - inbuflen = sizeof(struct validate_negotiate_info_req) - 4; 809 + inbuflen = sizeof(*pneg_inbuf) - 810 + sizeof(pneg_inbuf->Dialects[0]) * 2; 800 811 } 801 812 802 813 rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID, 803 814 FSCTL_VALIDATE_NEGOTIATE_INFO, true /* is_fsctl */, 804 - (char *)&vneg_inbuf, sizeof(struct validate_negotiate_info_req), 805 - (char **)&pneg_rsp, &rsplen); 815 + (char *)pneg_inbuf, inbuflen, (char **)&pneg_rsp, &rsplen); 806 816 807 817 if (rc != 0) { 808 818 cifs_dbg(VFS, "validate protocol negotiate failed: %d\n", rc); 809 - return -EIO; 819 + rc = -EIO; 820 + goto out_free_inbuf; 810 821 } 811 822 812 - if (rsplen != sizeof(struct validate_negotiate_info_rsp)) { 823 + rc = -EIO; 824 + if (rsplen != sizeof(*pneg_rsp)) { 813 825 cifs_dbg(VFS, "invalid protocol negotiate response size: %d\n", 814 826 rsplen); 815 827 816 828 /* relax check since Mac returns max bufsize allowed on ioctl */ 817 - if ((rsplen > CIFSMaxBufSize) 818 - || (rsplen < sizeof(struct validate_negotiate_info_rsp))) 819 - goto err_rsp_free; 829 + if (rsplen > CIFSMaxBufSize || rsplen < sizeof(*pneg_rsp)) 830 + goto out_free_rsp; 820 831 } 821 832 822 833 /* check validate negotiate info response matches what we got earlier */ ··· 839 838 goto vneg_out; 840 839 841 840 /* validate negotiate successful */ 841 + rc = 0; 842 842 cifs_dbg(FYI, "validate negotiate info successful\n"); 843 - kfree(pneg_rsp); 844 - return 0; 843 + goto out_free_rsp; 845 844 846 845 vneg_out: 847 846 cifs_dbg(VFS, "protocol revalidation - security settings mismatch\n"); 848 - err_rsp_free: 847 + out_free_rsp: 849 848 kfree(pneg_rsp); 850 - return -EIO; 849 + out_free_inbuf: 850 + kfree(pneg_inbuf); 851 + return rc; 851 852 } 852 853 853 854 enum securityEnum