aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-30 00:09:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-30 00:09:57 -0500
commit5faa0154fe333e11ae3826296e08eada1d1d2ec8 (patch)
treeeeb9478cc870d9f781d6ba66071bb5f29b14b33b /fs
parentb9d4a35f0a5dd25b85462741a8fb539b355ea95c (diff)
parent9e6d722f3d91c94f2a303d67ddd8fb1ca4c0d375 (diff)
Merge branch 'for-linus' of git://git.samba.org/sfrench/cifs-2.6
Pull CIFS fixes from Steve French: "A set of three minor cifs fixes" * 'for-linus' of git://git.samba.org/sfrench/cifs-2.6: cifs: make new inode cache when file type is different Fix signed/unsigned pointer warning Convert MessageID in smb2_hdr to LE
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsglob.h6
-rw-r--r--fs/cifs/netmisc.c12
-rw-r--r--fs/cifs/readdir.c10
-rw-r--r--fs/cifs/smb2misc.c12
-rw-r--r--fs/cifs/smb2ops.c3
-rw-r--r--fs/cifs/smb2pdu.h2
-rw-r--r--fs/cifs/smb2transport.c2
7 files changed, 28 insertions, 19 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 6e139111fdb2..22b289a3b1c4 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -661,16 +661,16 @@ set_credits(struct TCP_Server_Info *server, const int val)
661 server->ops->set_credits(server, val); 661 server->ops->set_credits(server, val);
662} 662}
663 663
664static inline __u64 664static inline __le64
665get_next_mid64(struct TCP_Server_Info *server) 665get_next_mid64(struct TCP_Server_Info *server)
666{ 666{
667 return server->ops->get_next_mid(server); 667 return cpu_to_le64(server->ops->get_next_mid(server));
668} 668}
669 669
670static inline __le16 670static inline __le16
671get_next_mid(struct TCP_Server_Info *server) 671get_next_mid(struct TCP_Server_Info *server)
672{ 672{
673 __u16 mid = get_next_mid64(server); 673 __u16 mid = server->ops->get_next_mid(server);
674 /* 674 /*
675 * The value in the SMB header should be little endian for easy 675 * The value in the SMB header should be little endian for easy
676 * on-the-wire decoding. 676 * on-the-wire decoding.
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index b333ff60781d..abae6dd2c6b9 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -926,6 +926,7 @@ cifs_NTtimeToUnix(__le64 ntutc)
926 926
927 /* Subtract the NTFS time offset, then convert to 1s intervals. */ 927 /* Subtract the NTFS time offset, then convert to 1s intervals. */
928 s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; 928 s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET;
929 u64 abs_t;
929 930
930 /* 931 /*
931 * Unfortunately can not use normal 64 bit division on 32 bit arch, but 932 * Unfortunately can not use normal 64 bit division on 32 bit arch, but
@@ -933,13 +934,14 @@ cifs_NTtimeToUnix(__le64 ntutc)
933 * to special case them 934 * to special case them
934 */ 935 */
935 if (t < 0) { 936 if (t < 0) {
936 t = -t; 937 abs_t = -t;
937 ts.tv_nsec = (long)(do_div(t, 10000000) * 100); 938 ts.tv_nsec = (long)(do_div(abs_t, 10000000) * 100);
938 ts.tv_nsec = -ts.tv_nsec; 939 ts.tv_nsec = -ts.tv_nsec;
939 ts.tv_sec = -t; 940 ts.tv_sec = -abs_t;
940 } else { 941 } else {
941 ts.tv_nsec = (long)do_div(t, 10000000) * 100; 942 abs_t = t;
942 ts.tv_sec = t; 943 ts.tv_nsec = (long)do_div(abs_t, 10000000) * 100;
944 ts.tv_sec = abs_t;
943 } 945 }
944 946
945 return ts; 947 return ts;
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 8eaf20a80649..c295338e0a98 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -69,7 +69,8 @@ static inline void dump_cifs_file_struct(struct file *file, char *label)
69 * Attempt to preload the dcache with the results from the FIND_FIRST/NEXT 69 * Attempt to preload the dcache with the results from the FIND_FIRST/NEXT
70 * 70 *
71 * Find the dentry that matches "name". If there isn't one, create one. If it's 71 * Find the dentry that matches "name". If there isn't one, create one. If it's
72 * a negative dentry or the uniqueid changed, then drop it and recreate it. 72 * a negative dentry or the uniqueid or filetype(mode) changed,
73 * then drop it and recreate it.
73 */ 74 */
74static void 75static void
75cifs_prime_dcache(struct dentry *parent, struct qstr *name, 76cifs_prime_dcache(struct dentry *parent, struct qstr *name,
@@ -97,8 +98,11 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
97 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) 98 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM))
98 fattr->cf_uniqueid = CIFS_I(inode)->uniqueid; 99 fattr->cf_uniqueid = CIFS_I(inode)->uniqueid;
99 100
100 /* update inode in place if i_ino didn't change */ 101 /* update inode in place
101 if (CIFS_I(inode)->uniqueid == fattr->cf_uniqueid) { 102 * if both i_ino and i_mode didn't change */
103 if (CIFS_I(inode)->uniqueid == fattr->cf_uniqueid &&
104 (inode->i_mode & S_IFMT) ==
105 (fattr->cf_mode & S_IFMT)) {
102 cifs_fattr_to_inode(inode, fattr); 106 cifs_fattr_to_inode(inode, fattr);
103 goto out; 107 goto out;
104 } 108 }
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index f1cefc9763ed..689f035915cf 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -32,12 +32,14 @@
32static int 32static int
33check_smb2_hdr(struct smb2_hdr *hdr, __u64 mid) 33check_smb2_hdr(struct smb2_hdr *hdr, __u64 mid)
34{ 34{
35 __u64 wire_mid = le64_to_cpu(hdr->MessageId);
36
35 /* 37 /*
36 * Make sure that this really is an SMB, that it is a response, 38 * Make sure that this really is an SMB, that it is a response,
37 * and that the message ids match. 39 * and that the message ids match.
38 */ 40 */
39 if ((*(__le32 *)hdr->ProtocolId == SMB2_PROTO_NUMBER) && 41 if ((*(__le32 *)hdr->ProtocolId == SMB2_PROTO_NUMBER) &&
40 (mid == hdr->MessageId)) { 42 (mid == wire_mid)) {
41 if (hdr->Flags & SMB2_FLAGS_SERVER_TO_REDIR) 43 if (hdr->Flags & SMB2_FLAGS_SERVER_TO_REDIR)
42 return 0; 44 return 0;
43 else { 45 else {
@@ -51,11 +53,11 @@ check_smb2_hdr(struct smb2_hdr *hdr, __u64 mid)
51 if (*(__le32 *)hdr->ProtocolId != SMB2_PROTO_NUMBER) 53 if (*(__le32 *)hdr->ProtocolId != SMB2_PROTO_NUMBER)
52 cifs_dbg(VFS, "Bad protocol string signature header %x\n", 54 cifs_dbg(VFS, "Bad protocol string signature header %x\n",
53 *(unsigned int *) hdr->ProtocolId); 55 *(unsigned int *) hdr->ProtocolId);
54 if (mid != hdr->MessageId) 56 if (mid != wire_mid)
55 cifs_dbg(VFS, "Mids do not match: %llu and %llu\n", 57 cifs_dbg(VFS, "Mids do not match: %llu and %llu\n",
56 mid, hdr->MessageId); 58 mid, wire_mid);
57 } 59 }
58 cifs_dbg(VFS, "Bad SMB detected. The Mid=%llu\n", hdr->MessageId); 60 cifs_dbg(VFS, "Bad SMB detected. The Mid=%llu\n", wire_mid);
59 return 1; 61 return 1;
60} 62}
61 63
@@ -95,7 +97,7 @@ smb2_check_message(char *buf, unsigned int length)
95{ 97{
96 struct smb2_hdr *hdr = (struct smb2_hdr *)buf; 98 struct smb2_hdr *hdr = (struct smb2_hdr *)buf;
97 struct smb2_pdu *pdu = (struct smb2_pdu *)hdr; 99 struct smb2_pdu *pdu = (struct smb2_pdu *)hdr;
98 __u64 mid = hdr->MessageId; 100 __u64 mid = le64_to_cpu(hdr->MessageId);
99 __u32 len = get_rfc1002_length(buf); 101 __u32 len = get_rfc1002_length(buf);
100 __u32 clc_len; /* calculated length */ 102 __u32 clc_len; /* calculated length */
101 int command; 103 int command;
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 93fd0586f9ec..96b5d40a2ece 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -176,10 +176,11 @@ smb2_find_mid(struct TCP_Server_Info *server, char *buf)
176{ 176{
177 struct mid_q_entry *mid; 177 struct mid_q_entry *mid;
178 struct smb2_hdr *hdr = (struct smb2_hdr *)buf; 178 struct smb2_hdr *hdr = (struct smb2_hdr *)buf;
179 __u64 wire_mid = le64_to_cpu(hdr->MessageId);
179 180
180 spin_lock(&GlobalMid_Lock); 181 spin_lock(&GlobalMid_Lock);
181 list_for_each_entry(mid, &server->pending_mid_q, qhead) { 182 list_for_each_entry(mid, &server->pending_mid_q, qhead) {
182 if ((mid->mid == hdr->MessageId) && 183 if ((mid->mid == wire_mid) &&
183 (mid->mid_state == MID_REQUEST_SUBMITTED) && 184 (mid->mid_state == MID_REQUEST_SUBMITTED) &&
184 (mid->command == hdr->Command)) { 185 (mid->command == hdr->Command)) {
185 spin_unlock(&GlobalMid_Lock); 186 spin_unlock(&GlobalMid_Lock);
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index ce858477002a..70867d54fb8b 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -110,7 +110,7 @@ struct smb2_hdr {
110 __le16 CreditRequest; /* CreditResponse */ 110 __le16 CreditRequest; /* CreditResponse */
111 __le32 Flags; 111 __le32 Flags;
112 __le32 NextCommand; 112 __le32 NextCommand;
113 __u64 MessageId; /* opaque - so can stay little endian */ 113 __le64 MessageId;
114 __le32 ProcessId; 114 __le32 ProcessId;
115 __u32 TreeId; /* opaque - so do not make little endian */ 115 __u32 TreeId; /* opaque - so do not make little endian */
116 __u64 SessionId; /* opaque - so do not make little endian */ 116 __u64 SessionId; /* opaque - so do not make little endian */
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c
index 5111e7272db6..d4c5b6f109a7 100644
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -490,7 +490,7 @@ smb2_mid_entry_alloc(const struct smb2_hdr *smb_buffer,
490 return temp; 490 return temp;
491 else { 491 else {
492 memset(temp, 0, sizeof(struct mid_q_entry)); 492 memset(temp, 0, sizeof(struct mid_q_entry));
493 temp->mid = smb_buffer->MessageId; /* always LE */ 493 temp->mid = le64_to_cpu(smb_buffer->MessageId);
494 temp->pid = current->pid; 494 temp->pid = current->pid;
495 temp->command = smb_buffer->Command; /* Always LE */ 495 temp->command = smb_buffer->Command; /* Always LE */
496 temp->when_alloc = jiffies; 496 temp->when_alloc = jiffies;