diff options
Diffstat (limited to 'fs/cifs/xattr.c')
-rw-r--r-- | fs/cifs/xattr.c | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 41f95bf67977..a264b744bb41 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -47,9 +47,10 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name) | |||
47 | #ifdef CONFIG_CIFS_XATTR | 47 | #ifdef CONFIG_CIFS_XATTR |
48 | int xid; | 48 | int xid; |
49 | struct cifs_sb_info *cifs_sb; | 49 | struct cifs_sb_info *cifs_sb; |
50 | struct tcon_link *tlink; | ||
50 | struct cifsTconInfo *pTcon; | 51 | struct cifsTconInfo *pTcon; |
51 | struct super_block *sb; | 52 | struct super_block *sb; |
52 | char *full_path; | 53 | char *full_path = NULL; |
53 | 54 | ||
54 | if (direntry == NULL) | 55 | if (direntry == NULL) |
55 | return -EIO; | 56 | return -EIO; |
@@ -58,16 +59,19 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name) | |||
58 | sb = direntry->d_inode->i_sb; | 59 | sb = direntry->d_inode->i_sb; |
59 | if (sb == NULL) | 60 | if (sb == NULL) |
60 | return -EIO; | 61 | return -EIO; |
61 | xid = GetXid(); | ||
62 | 62 | ||
63 | cifs_sb = CIFS_SB(sb); | 63 | cifs_sb = CIFS_SB(sb); |
64 | pTcon = cifs_sb_tcon(cifs_sb); | 64 | tlink = cifs_sb_tlink(cifs_sb); |
65 | if (IS_ERR(tlink)) | ||
66 | return PTR_ERR(tlink); | ||
67 | pTcon = tlink_tcon(tlink); | ||
68 | |||
69 | xid = GetXid(); | ||
65 | 70 | ||
66 | full_path = build_path_from_dentry(direntry); | 71 | full_path = build_path_from_dentry(direntry); |
67 | if (full_path == NULL) { | 72 | if (full_path == NULL) { |
68 | rc = -ENOMEM; | 73 | rc = -ENOMEM; |
69 | FreeXid(xid); | 74 | goto remove_ea_exit; |
70 | return rc; | ||
71 | } | 75 | } |
72 | if (ea_name == NULL) { | 76 | if (ea_name == NULL) { |
73 | cFYI(1, "Null xattr names not supported"); | 77 | cFYI(1, "Null xattr names not supported"); |
@@ -91,6 +95,7 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name) | |||
91 | remove_ea_exit: | 95 | remove_ea_exit: |
92 | kfree(full_path); | 96 | kfree(full_path); |
93 | FreeXid(xid); | 97 | FreeXid(xid); |
98 | cifs_put_tlink(tlink); | ||
94 | #endif | 99 | #endif |
95 | return rc; | 100 | return rc; |
96 | } | 101 | } |
@@ -102,6 +107,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, | |||
102 | #ifdef CONFIG_CIFS_XATTR | 107 | #ifdef CONFIG_CIFS_XATTR |
103 | int xid; | 108 | int xid; |
104 | struct cifs_sb_info *cifs_sb; | 109 | struct cifs_sb_info *cifs_sb; |
110 | struct tcon_link *tlink; | ||
105 | struct cifsTconInfo *pTcon; | 111 | struct cifsTconInfo *pTcon; |
106 | struct super_block *sb; | 112 | struct super_block *sb; |
107 | char *full_path; | 113 | char *full_path; |
@@ -113,16 +119,19 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, | |||
113 | sb = direntry->d_inode->i_sb; | 119 | sb = direntry->d_inode->i_sb; |
114 | if (sb == NULL) | 120 | if (sb == NULL) |
115 | return -EIO; | 121 | return -EIO; |
116 | xid = GetXid(); | ||
117 | 122 | ||
118 | cifs_sb = CIFS_SB(sb); | 123 | cifs_sb = CIFS_SB(sb); |
119 | pTcon = cifs_sb_tcon(cifs_sb); | 124 | tlink = cifs_sb_tlink(cifs_sb); |
125 | if (IS_ERR(tlink)) | ||
126 | return PTR_ERR(tlink); | ||
127 | pTcon = tlink_tcon(tlink); | ||
128 | |||
129 | xid = GetXid(); | ||
120 | 130 | ||
121 | full_path = build_path_from_dentry(direntry); | 131 | full_path = build_path_from_dentry(direntry); |
122 | if (full_path == NULL) { | 132 | if (full_path == NULL) { |
123 | rc = -ENOMEM; | 133 | rc = -ENOMEM; |
124 | FreeXid(xid); | 134 | goto set_ea_exit; |
125 | return rc; | ||
126 | } | 135 | } |
127 | /* return dos attributes as pseudo xattr */ | 136 | /* return dos attributes as pseudo xattr */ |
128 | /* return alt name if available as pseudo attr */ | 137 | /* return alt name if available as pseudo attr */ |
@@ -132,9 +141,8 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, | |||
132 | returns as xattrs */ | 141 | returns as xattrs */ |
133 | if (value_size > MAX_EA_VALUE_SIZE) { | 142 | if (value_size > MAX_EA_VALUE_SIZE) { |
134 | cFYI(1, "size of EA value too large"); | 143 | cFYI(1, "size of EA value too large"); |
135 | kfree(full_path); | 144 | rc = -EOPNOTSUPP; |
136 | FreeXid(xid); | 145 | goto set_ea_exit; |
137 | return -EOPNOTSUPP; | ||
138 | } | 146 | } |
139 | 147 | ||
140 | if (ea_name == NULL) { | 148 | if (ea_name == NULL) { |
@@ -198,6 +206,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, | |||
198 | set_ea_exit: | 206 | set_ea_exit: |
199 | kfree(full_path); | 207 | kfree(full_path); |
200 | FreeXid(xid); | 208 | FreeXid(xid); |
209 | cifs_put_tlink(tlink); | ||
201 | #endif | 210 | #endif |
202 | return rc; | 211 | return rc; |
203 | } | 212 | } |
@@ -209,6 +218,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
209 | #ifdef CONFIG_CIFS_XATTR | 218 | #ifdef CONFIG_CIFS_XATTR |
210 | int xid; | 219 | int xid; |
211 | struct cifs_sb_info *cifs_sb; | 220 | struct cifs_sb_info *cifs_sb; |
221 | struct tcon_link *tlink; | ||
212 | struct cifsTconInfo *pTcon; | 222 | struct cifsTconInfo *pTcon; |
213 | struct super_block *sb; | 223 | struct super_block *sb; |
214 | char *full_path; | 224 | char *full_path; |
@@ -221,16 +231,18 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
221 | if (sb == NULL) | 231 | if (sb == NULL) |
222 | return -EIO; | 232 | return -EIO; |
223 | 233 | ||
224 | xid = GetXid(); | ||
225 | |||
226 | cifs_sb = CIFS_SB(sb); | 234 | cifs_sb = CIFS_SB(sb); |
227 | pTcon = cifs_sb_tcon(cifs_sb); | 235 | tlink = cifs_sb_tlink(cifs_sb); |
236 | if (IS_ERR(tlink)) | ||
237 | return PTR_ERR(tlink); | ||
238 | pTcon = tlink_tcon(tlink); | ||
239 | |||
240 | xid = GetXid(); | ||
228 | 241 | ||
229 | full_path = build_path_from_dentry(direntry); | 242 | full_path = build_path_from_dentry(direntry); |
230 | if (full_path == NULL) { | 243 | if (full_path == NULL) { |
231 | rc = -ENOMEM; | 244 | rc = -ENOMEM; |
232 | FreeXid(xid); | 245 | goto get_ea_exit; |
233 | return rc; | ||
234 | } | 246 | } |
235 | /* return dos attributes as pseudo xattr */ | 247 | /* return dos attributes as pseudo xattr */ |
236 | /* return alt name if available as pseudo attr */ | 248 | /* return alt name if available as pseudo attr */ |
@@ -323,6 +335,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
323 | get_ea_exit: | 335 | get_ea_exit: |
324 | kfree(full_path); | 336 | kfree(full_path); |
325 | FreeXid(xid); | 337 | FreeXid(xid); |
338 | cifs_put_tlink(tlink); | ||
326 | #endif | 339 | #endif |
327 | return rc; | 340 | return rc; |
328 | } | 341 | } |
@@ -333,6 +346,7 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size) | |||
333 | #ifdef CONFIG_CIFS_XATTR | 346 | #ifdef CONFIG_CIFS_XATTR |
334 | int xid; | 347 | int xid; |
335 | struct cifs_sb_info *cifs_sb; | 348 | struct cifs_sb_info *cifs_sb; |
349 | struct tcon_link *tlink; | ||
336 | struct cifsTconInfo *pTcon; | 350 | struct cifsTconInfo *pTcon; |
337 | struct super_block *sb; | 351 | struct super_block *sb; |
338 | char *full_path; | 352 | char *full_path; |
@@ -346,18 +360,20 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size) | |||
346 | return -EIO; | 360 | return -EIO; |
347 | 361 | ||
348 | cifs_sb = CIFS_SB(sb); | 362 | cifs_sb = CIFS_SB(sb); |
349 | pTcon = cifs_sb_tcon(cifs_sb); | ||
350 | |||
351 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) | 363 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) |
352 | return -EOPNOTSUPP; | 364 | return -EOPNOTSUPP; |
353 | 365 | ||
366 | tlink = cifs_sb_tlink(cifs_sb); | ||
367 | if (IS_ERR(tlink)) | ||
368 | return PTR_ERR(tlink); | ||
369 | pTcon = tlink_tcon(tlink); | ||
370 | |||
354 | xid = GetXid(); | 371 | xid = GetXid(); |
355 | 372 | ||
356 | full_path = build_path_from_dentry(direntry); | 373 | full_path = build_path_from_dentry(direntry); |
357 | if (full_path == NULL) { | 374 | if (full_path == NULL) { |
358 | rc = -ENOMEM; | 375 | rc = -ENOMEM; |
359 | FreeXid(xid); | 376 | goto list_ea_exit; |
360 | return rc; | ||
361 | } | 377 | } |
362 | /* return dos attributes as pseudo xattr */ | 378 | /* return dos attributes as pseudo xattr */ |
363 | /* return alt name if available as pseudo attr */ | 379 | /* return alt name if available as pseudo attr */ |
@@ -370,8 +386,10 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size) | |||
370 | cifs_sb->mnt_cifs_flags & | 386 | cifs_sb->mnt_cifs_flags & |
371 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 387 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
372 | 388 | ||
389 | list_ea_exit: | ||
373 | kfree(full_path); | 390 | kfree(full_path); |
374 | FreeXid(xid); | 391 | FreeXid(xid); |
392 | cifs_put_tlink(tlink); | ||
375 | #endif | 393 | #endif |
376 | return rc; | 394 | return rc; |
377 | } | 395 | } |