aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2009-02-11 08:08:26 -0500
committerSteve French <sfrench@us.ibm.com>2009-02-20 22:37:08 -0500
commit950ec52880fab89b957c7dc45e8b8476dd63741f (patch)
treedfb8bd4bdf0e455fefd453c4e899276641a60394 /fs/cifs
parent132ac7b77cc95a22d6118d327c96586759fbf006 (diff)
cifs: properly handle case where CIFSGetSrvInodeNumber fails
...if it does then we pass a pointer to an unintialized variable for the inode number to cifs_new_inode. Have it pass a NULL pointer instead. Also tweak the function prototypes to reduce the amount of casting. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsproto.h3
-rw-r--r--fs/cifs/inode.c20
-rw-r--r--fs/cifs/readdir.c6
3 files changed, 14 insertions, 15 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 62fd5bd499f6..446e62cbece9 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -92,8 +92,7 @@ extern u64 cifs_UnixTimeToNT(struct timespec);
92extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time); 92extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time);
93extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time); 93extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time);
94 94
95extern struct inode *cifs_new_inode(struct super_block *sb, 95extern struct inode *cifs_new_inode(struct super_block *sb, __u64 *inum);
96 unsigned long *inum);
97extern int cifs_get_inode_info(struct inode **pinode, 96extern int cifs_get_inode_info(struct inode **pinode,
98 const unsigned char *search_path, 97 const unsigned char *search_path,
99 FILE_ALL_INFO *pfile_info, 98 FILE_ALL_INFO *pfile_info,
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index c7674f595adb..475115c7cc79 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -213,7 +213,7 @@ static void fill_fake_finddataunix(FILE_UNIX_BASIC_INFO *pfnd_dat,
213 * guaranteed to be unique. 213 * guaranteed to be unique.
214 */ 214 */
215struct inode * 215struct inode *
216cifs_new_inode(struct super_block *sb, unsigned long *inum) 216cifs_new_inode(struct super_block *sb, __u64 *inum)
217{ 217{
218 struct inode *inode; 218 struct inode *inode;
219 219
@@ -228,7 +228,7 @@ cifs_new_inode(struct super_block *sb, unsigned long *inum)
228 * if serverino is disabled, perhaps we should be using iunique()? 228 * if serverino is disabled, perhaps we should be using iunique()?
229 */ 229 */
230 if (inum && (CIFS_SB(sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) 230 if (inum && (CIFS_SB(sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM))
231 inode->i_ino = *inum; 231 inode->i_ino = (unsigned long) *inum;
232 232
233 /* 233 /*
234 * must set this here instead of cifs_alloc_inode since VFS will 234 * must set this here instead of cifs_alloc_inode since VFS will
@@ -276,8 +276,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
276 276
277 /* get new inode */ 277 /* get new inode */
278 if (*pinode == NULL) { 278 if (*pinode == NULL) {
279 *pinode = cifs_new_inode(sb, (unsigned long *) 279 *pinode = cifs_new_inode(sb, &find_data.UniqueId);
280 &find_data.UniqueId);
281 if (*pinode == NULL) { 280 if (*pinode == NULL) {
282 rc = -ENOMEM; 281 rc = -ENOMEM;
283 goto cgiiu_exit; 282 goto cgiiu_exit;
@@ -499,6 +498,7 @@ int cifs_get_inode_info(struct inode **pinode,
499 /* get new inode */ 498 /* get new inode */
500 if (*pinode == NULL) { 499 if (*pinode == NULL) {
501 __u64 inode_num; 500 __u64 inode_num;
501 __u64 *pinum = &inode_num;
502 502
503 /* Is an i_ino of zero legal? Can we use that to check 503 /* Is an i_ino of zero legal? Can we use that to check
504 if the server supports returning inode numbers? Are 504 if the server supports returning inode numbers? Are
@@ -518,20 +518,20 @@ int cifs_get_inode_info(struct inode **pinode,
518 int rc1 = 0; 518 int rc1 = 0;
519 519
520 rc1 = CIFSGetSrvInodeNumber(xid, pTcon, 520 rc1 = CIFSGetSrvInodeNumber(xid, pTcon,
521 full_path, &inode_num, 521 full_path, pinum,
522 cifs_sb->local_nls, 522 cifs_sb->local_nls,
523 cifs_sb->mnt_cifs_flags & 523 cifs_sb->mnt_cifs_flags &
524 CIFS_MOUNT_MAP_SPECIAL_CHR); 524 CIFS_MOUNT_MAP_SPECIAL_CHR);
525 if (rc1) { 525 if (rc1) {
526 cFYI(1, ("GetSrvInodeNum rc %d", rc1)); 526 cFYI(1, ("GetSrvInodeNum rc %d", rc1));
527 pinum = NULL;
527 /* BB EOPNOSUPP disable SERVER_INUM? */ 528 /* BB EOPNOSUPP disable SERVER_INUM? */
528 } 529 }
529 *pinode = cifs_new_inode(sb, (unsigned long *)
530 &inode_num);
531 } else { 530 } else {
532 *pinode = cifs_new_inode(sb, NULL); 531 pinum = NULL;
533 } 532 }
534 533
534 *pinode = cifs_new_inode(sb, pinum);
535 if (*pinode == NULL) { 535 if (*pinode == NULL) {
536 rc = -ENOMEM; 536 rc = -ENOMEM;
537 goto cgii_exit; 537 goto cgii_exit;
@@ -1148,8 +1148,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
1148 else 1148 else
1149 direntry->d_op = &cifs_dentry_ops; 1149 direntry->d_op = &cifs_dentry_ops;
1150 1150
1151 newinode = cifs_new_inode(inode->i_sb, (unsigned long *) 1151 newinode = cifs_new_inode(inode->i_sb,
1152 &pInfo->UniqueId); 1152 &pInfo->UniqueId);
1153 if (newinode == NULL) { 1153 if (newinode == NULL) {
1154 kfree(pInfo); 1154 kfree(pInfo);
1155 goto mkdir_get_info; 1155 goto mkdir_get_info;
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 02a20221e841..c2c01ff4c32c 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -61,7 +61,7 @@ static inline void dump_cifs_file_struct(struct file *file, char *label)
61static int 61static int
62construct_dentry(struct qstr *qstring, struct file *file, 62construct_dentry(struct qstr *qstring, struct file *file,
63 struct inode **ptmp_inode, struct dentry **pnew_dentry, 63 struct inode **ptmp_inode, struct dentry **pnew_dentry,
64 unsigned long *inum) 64 __u64 *inum)
65{ 65{
66 struct dentry *tmp_dentry = NULL; 66 struct dentry *tmp_dentry = NULL;
67 struct super_block *sb = file->f_path.dentry->d_sb; 67 struct super_block *sb = file->f_path.dentry->d_sb;
@@ -820,7 +820,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
820/* inode num, inode type and filename returned */ 820/* inode num, inode type and filename returned */
821static int cifs_get_name_from_search_buf(struct qstr *pqst, 821static int cifs_get_name_from_search_buf(struct qstr *pqst,
822 char *current_entry, __u16 level, unsigned int unicode, 822 char *current_entry, __u16 level, unsigned int unicode,
823 struct cifs_sb_info *cifs_sb, int max_len, ino_t *pinum) 823 struct cifs_sb_info *cifs_sb, int max_len, __u64 *pinum)
824{ 824{
825 int rc = 0; 825 int rc = 0;
826 unsigned int len = 0; 826 unsigned int len = 0;
@@ -903,7 +903,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
903 struct qstr qstring; 903 struct qstr qstring;
904 struct cifsFileInfo *pCifsF; 904 struct cifsFileInfo *pCifsF;
905 unsigned int obj_type; 905 unsigned int obj_type;
906 ino_t inum; 906 __u64 inum;
907 struct cifs_sb_info *cifs_sb; 907 struct cifs_sb_info *cifs_sb;
908 struct inode *tmp_inode; 908 struct inode *tmp_inode;
909 struct dentry *tmp_dentry; 909 struct dentry *tmp_dentry;