aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-10-21 09:04:48 -0400
committerDavid Howells <dhowells@redhat.com>2015-10-21 10:18:36 -0400
commit146aa8b1453bd8f1ff2304ffb71b4ee0eb9acdcc (patch)
treea89ef2cd2e8029b0c09a58739cca0e7e2e68f4db /fs/cifs
parent4adc605edc5f744dcf432241b5996ff6a13d868c (diff)
KEYS: Merge the type-specific data with the payload data
Merge the type-specific data with the payload data into one four-word chunk as it seems pointless to keep them separate. Use user_key_payload() for accessing the payloads of overloaded user-defined keys. Signed-off-by: David Howells <dhowells@redhat.com> cc: linux-cifs@vger.kernel.org cc: ecryptfs@vger.kernel.org cc: linux-ext4@vger.kernel.org cc: linux-f2fs-devel@lists.sourceforge.net cc: linux-nfs@vger.kernel.org cc: ceph-devel@vger.kernel.org cc: linux-ima-devel@lists.sourceforge.net
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifs_spnego.c6
-rw-r--r--fs/cifs/cifsacl.c25
-rw-r--r--fs/cifs/connect.c9
-rw-r--r--fs/cifs/sess.c2
-rw-r--r--fs/cifs/smb2pdu.c2
5 files changed, 22 insertions, 22 deletions
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c
index f4cf200b3c76..6908080e9b6d 100644
--- a/fs/cifs/cifs_spnego.c
+++ b/fs/cifs/cifs_spnego.c
@@ -42,7 +42,7 @@ cifs_spnego_key_instantiate(struct key *key, struct key_preparsed_payload *prep)
42 goto error; 42 goto error;
43 43
44 /* attach the data */ 44 /* attach the data */
45 key->payload.data = payload; 45 key->payload.data[0] = payload;
46 ret = 0; 46 ret = 0;
47 47
48error: 48error:
@@ -52,7 +52,7 @@ error:
52static void 52static void
53cifs_spnego_key_destroy(struct key *key) 53cifs_spnego_key_destroy(struct key *key)
54{ 54{
55 kfree(key->payload.data); 55 kfree(key->payload.data[0]);
56} 56}
57 57
58 58
@@ -167,7 +167,7 @@ cifs_get_spnego_key(struct cifs_ses *sesInfo)
167 167
168#ifdef CONFIG_CIFS_DEBUG2 168#ifdef CONFIG_CIFS_DEBUG2
169 if (cifsFYI && !IS_ERR(spnego_key)) { 169 if (cifsFYI && !IS_ERR(spnego_key)) {
170 struct cifs_spnego_msg *msg = spnego_key->payload.data; 170 struct cifs_spnego_msg *msg = spnego_key->payload.data[0];
171 cifs_dump_mem("SPNEGO reply blob:", msg->data, min(1024U, 171 cifs_dump_mem("SPNEGO reply blob:", msg->data, min(1024U,
172 msg->secblob_len + msg->sesskey_len)); 172 msg->secblob_len + msg->sesskey_len));
173 } 173 }
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 1ea780bc6376..3f93125916bf 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -58,16 +58,15 @@ cifs_idmap_key_instantiate(struct key *key, struct key_preparsed_payload *prep)
58 * dereference payload.data! 58 * dereference payload.data!
59 */ 59 */
60 if (prep->datalen <= sizeof(key->payload)) { 60 if (prep->datalen <= sizeof(key->payload)) {
61 key->payload.value = 0; 61 key->payload.data[0] = NULL;
62 memcpy(&key->payload.value, prep->data, prep->datalen); 62 memcpy(&key->payload, prep->data, prep->datalen);
63 key->datalen = prep->datalen; 63 } else {
64 return 0; 64 payload = kmemdup(prep->data, prep->datalen, GFP_KERNEL);
65 if (!payload)
66 return -ENOMEM;
67 key->payload.data[0] = payload;
65 } 68 }
66 payload = kmemdup(prep->data, prep->datalen, GFP_KERNEL);
67 if (!payload)
68 return -ENOMEM;
69 69
70 key->payload.data = payload;
71 key->datalen = prep->datalen; 70 key->datalen = prep->datalen;
72 return 0; 71 return 0;
73} 72}
@@ -76,7 +75,7 @@ static inline void
76cifs_idmap_key_destroy(struct key *key) 75cifs_idmap_key_destroy(struct key *key)
77{ 76{
78 if (key->datalen > sizeof(key->payload)) 77 if (key->datalen > sizeof(key->payload))
79 kfree(key->payload.data); 78 kfree(key->payload.data[0]);
80} 79}
81 80
82static struct key_type cifs_idmap_key_type = { 81static struct key_type cifs_idmap_key_type = {
@@ -233,8 +232,8 @@ id_to_sid(unsigned int cid, uint sidtype, struct cifs_sid *ssid)
233 * it could be. 232 * it could be.
234 */ 233 */
235 ksid = sidkey->datalen <= sizeof(sidkey->payload) ? 234 ksid = sidkey->datalen <= sizeof(sidkey->payload) ?
236 (struct cifs_sid *)&sidkey->payload.value : 235 (struct cifs_sid *)&sidkey->payload :
237 (struct cifs_sid *)sidkey->payload.data; 236 (struct cifs_sid *)sidkey->payload.data[0];
238 237
239 ksid_size = CIFS_SID_BASE_SIZE + (ksid->num_subauth * sizeof(__le32)); 238 ksid_size = CIFS_SID_BASE_SIZE + (ksid->num_subauth * sizeof(__le32));
240 if (ksid_size > sidkey->datalen) { 239 if (ksid_size > sidkey->datalen) {
@@ -307,14 +306,14 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
307 if (sidtype == SIDOWNER) { 306 if (sidtype == SIDOWNER) {
308 kuid_t uid; 307 kuid_t uid;
309 uid_t id; 308 uid_t id;
310 memcpy(&id, &sidkey->payload.value, sizeof(uid_t)); 309 memcpy(&id, &sidkey->payload.data[0], sizeof(uid_t));
311 uid = make_kuid(&init_user_ns, id); 310 uid = make_kuid(&init_user_ns, id);
312 if (uid_valid(uid)) 311 if (uid_valid(uid))
313 fuid = uid; 312 fuid = uid;
314 } else { 313 } else {
315 kgid_t gid; 314 kgid_t gid;
316 gid_t id; 315 gid_t id;
317 memcpy(&id, &sidkey->payload.value, sizeof(gid_t)); 316 memcpy(&id, &sidkey->payload.data[0], sizeof(gid_t));
318 gid = make_kgid(&init_user_ns, id); 317 gid = make_kgid(&init_user_ns, id);
319 if (gid_valid(gid)) 318 if (gid_valid(gid))
320 fgid = gid; 319 fgid = gid;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 773f4dc77630..3f2228570d44 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2325,13 +2325,14 @@ static int
2325cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) 2325cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
2326{ 2326{
2327 int rc = 0; 2327 int rc = 0;
2328 char *desc, *delim, *payload; 2328 const char *delim, *payload;
2329 char *desc;
2329 ssize_t len; 2330 ssize_t len;
2330 struct key *key; 2331 struct key *key;
2331 struct TCP_Server_Info *server = ses->server; 2332 struct TCP_Server_Info *server = ses->server;
2332 struct sockaddr_in *sa; 2333 struct sockaddr_in *sa;
2333 struct sockaddr_in6 *sa6; 2334 struct sockaddr_in6 *sa6;
2334 struct user_key_payload *upayload; 2335 const struct user_key_payload *upayload;
2335 2336
2336 desc = kmalloc(CIFSCREDS_DESC_SIZE, GFP_KERNEL); 2337 desc = kmalloc(CIFSCREDS_DESC_SIZE, GFP_KERNEL);
2337 if (!desc) 2338 if (!desc)
@@ -2374,14 +2375,14 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
2374 } 2375 }
2375 2376
2376 down_read(&key->sem); 2377 down_read(&key->sem);
2377 upayload = key->payload.data; 2378 upayload = user_key_payload(key);
2378 if (IS_ERR_OR_NULL(upayload)) { 2379 if (IS_ERR_OR_NULL(upayload)) {
2379 rc = upayload ? PTR_ERR(upayload) : -EINVAL; 2380 rc = upayload ? PTR_ERR(upayload) : -EINVAL;
2380 goto out_key_put; 2381 goto out_key_put;
2381 } 2382 }
2382 2383
2383 /* find first : in payload */ 2384 /* find first : in payload */
2384 payload = (char *)upayload->data; 2385 payload = upayload->data;
2385 delim = strnchr(payload, upayload->datalen, ':'); 2386 delim = strnchr(payload, upayload->datalen, ':');
2386 cifs_dbg(FYI, "payload=%s\n", payload); 2387 cifs_dbg(FYI, "payload=%s\n", payload);
2387 if (!delim) { 2388 if (!delim) {
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index bce6fdcd5d48..59727e32ed0f 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -988,7 +988,7 @@ sess_auth_kerberos(struct sess_data *sess_data)
988 goto out; 988 goto out;
989 } 989 }
990 990
991 msg = spnego_key->payload.data; 991 msg = spnego_key->payload.data[0];
992 /* 992 /*
993 * check version field to make sure that cifs.upcall is 993 * check version field to make sure that cifs.upcall is
994 * sending us a response in an expected form 994 * sending us a response in an expected form
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index ce83e2edbe0a..52d14c9cf052 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -660,7 +660,7 @@ ssetup_ntlmssp_authenticate:
660 goto ssetup_exit; 660 goto ssetup_exit;
661 } 661 }
662 662
663 msg = spnego_key->payload.data; 663 msg = spnego_key->payload.data[0];
664 /* 664 /*
665 * check version field to make sure that cifs.upcall is 665 * check version field to make sure that cifs.upcall is
666 * sending us a response in an expected form 666 * sending us a response in an expected form