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>
This commit is contained in:
parent
132ac7b77c
commit
950ec52880
|
@ -92,8 +92,7 @@ extern u64 cifs_UnixTimeToNT(struct timespec);
|
||||||
extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time);
|
extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time);
|
||||||
extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time);
|
extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time);
|
||||||
|
|
||||||
extern struct inode *cifs_new_inode(struct super_block *sb,
|
extern struct inode *cifs_new_inode(struct super_block *sb, __u64 *inum);
|
||||||
unsigned long *inum);
|
|
||||||
extern int cifs_get_inode_info(struct inode **pinode,
|
extern int cifs_get_inode_info(struct inode **pinode,
|
||||||
const unsigned char *search_path,
|
const unsigned char *search_path,
|
||||||
FILE_ALL_INFO *pfile_info,
|
FILE_ALL_INFO *pfile_info,
|
||||||
|
|
|
@ -213,7 +213,7 @@ static void fill_fake_finddataunix(FILE_UNIX_BASIC_INFO *pfnd_dat,
|
||||||
* guaranteed to be unique.
|
* guaranteed to be unique.
|
||||||
*/
|
*/
|
||||||
struct inode *
|
struct inode *
|
||||||
cifs_new_inode(struct super_block *sb, unsigned long *inum)
|
cifs_new_inode(struct super_block *sb, __u64 *inum)
|
||||||
{
|
{
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ cifs_new_inode(struct super_block *sb, unsigned long *inum)
|
||||||
* if serverino is disabled, perhaps we should be using iunique()?
|
* if serverino is disabled, perhaps we should be using iunique()?
|
||||||
*/
|
*/
|
||||||
if (inum && (CIFS_SB(sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM))
|
if (inum && (CIFS_SB(sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM))
|
||||||
inode->i_ino = *inum;
|
inode->i_ino = (unsigned long) *inum;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* must set this here instead of cifs_alloc_inode since VFS will
|
* 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,
|
||||||
|
|
||||||
/* get new inode */
|
/* get new inode */
|
||||||
if (*pinode == NULL) {
|
if (*pinode == NULL) {
|
||||||
*pinode = cifs_new_inode(sb, (unsigned long *)
|
*pinode = cifs_new_inode(sb, &find_data.UniqueId);
|
||||||
&find_data.UniqueId);
|
|
||||||
if (*pinode == NULL) {
|
if (*pinode == NULL) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto cgiiu_exit;
|
goto cgiiu_exit;
|
||||||
|
@ -499,6 +498,7 @@ int cifs_get_inode_info(struct inode **pinode,
|
||||||
/* get new inode */
|
/* get new inode */
|
||||||
if (*pinode == NULL) {
|
if (*pinode == NULL) {
|
||||||
__u64 inode_num;
|
__u64 inode_num;
|
||||||
|
__u64 *pinum = &inode_num;
|
||||||
|
|
||||||
/* Is an i_ino of zero legal? Can we use that to check
|
/* Is an i_ino of zero legal? Can we use that to check
|
||||||
if the server supports returning inode numbers? Are
|
if the server supports returning inode numbers? Are
|
||||||
|
@ -518,20 +518,20 @@ int cifs_get_inode_info(struct inode **pinode,
|
||||||
int rc1 = 0;
|
int rc1 = 0;
|
||||||
|
|
||||||
rc1 = CIFSGetSrvInodeNumber(xid, pTcon,
|
rc1 = CIFSGetSrvInodeNumber(xid, pTcon,
|
||||||
full_path, &inode_num,
|
full_path, pinum,
|
||||||
cifs_sb->local_nls,
|
cifs_sb->local_nls,
|
||||||
cifs_sb->mnt_cifs_flags &
|
cifs_sb->mnt_cifs_flags &
|
||||||
CIFS_MOUNT_MAP_SPECIAL_CHR);
|
CIFS_MOUNT_MAP_SPECIAL_CHR);
|
||||||
if (rc1) {
|
if (rc1) {
|
||||||
cFYI(1, ("GetSrvInodeNum rc %d", rc1));
|
cFYI(1, ("GetSrvInodeNum rc %d", rc1));
|
||||||
|
pinum = NULL;
|
||||||
/* BB EOPNOSUPP disable SERVER_INUM? */
|
/* BB EOPNOSUPP disable SERVER_INUM? */
|
||||||
}
|
}
|
||||||
*pinode = cifs_new_inode(sb, (unsigned long *)
|
|
||||||
&inode_num);
|
|
||||||
} else {
|
} else {
|
||||||
*pinode = cifs_new_inode(sb, NULL);
|
pinum = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*pinode = cifs_new_inode(sb, pinum);
|
||||||
if (*pinode == NULL) {
|
if (*pinode == NULL) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto cgii_exit;
|
goto cgii_exit;
|
||||||
|
@ -1148,8 +1148,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
|
||||||
else
|
else
|
||||||
direntry->d_op = &cifs_dentry_ops;
|
direntry->d_op = &cifs_dentry_ops;
|
||||||
|
|
||||||
newinode = cifs_new_inode(inode->i_sb, (unsigned long *)
|
newinode = cifs_new_inode(inode->i_sb,
|
||||||
&pInfo->UniqueId);
|
&pInfo->UniqueId);
|
||||||
if (newinode == NULL) {
|
if (newinode == NULL) {
|
||||||
kfree(pInfo);
|
kfree(pInfo);
|
||||||
goto mkdir_get_info;
|
goto mkdir_get_info;
|
||||||
|
|
|
@ -61,7 +61,7 @@ static inline void dump_cifs_file_struct(struct file *file, char *label)
|
||||||
static int
|
static int
|
||||||
construct_dentry(struct qstr *qstring, struct file *file,
|
construct_dentry(struct qstr *qstring, struct file *file,
|
||||||
struct inode **ptmp_inode, struct dentry **pnew_dentry,
|
struct inode **ptmp_inode, struct dentry **pnew_dentry,
|
||||||
unsigned long *inum)
|
__u64 *inum)
|
||||||
{
|
{
|
||||||
struct dentry *tmp_dentry = NULL;
|
struct dentry *tmp_dentry = NULL;
|
||||||
struct super_block *sb = file->f_path.dentry->d_sb;
|
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,
|
||||||
/* inode num, inode type and filename returned */
|
/* inode num, inode type and filename returned */
|
||||||
static int cifs_get_name_from_search_buf(struct qstr *pqst,
|
static int cifs_get_name_from_search_buf(struct qstr *pqst,
|
||||||
char *current_entry, __u16 level, unsigned int unicode,
|
char *current_entry, __u16 level, unsigned int unicode,
|
||||||
struct cifs_sb_info *cifs_sb, int max_len, ino_t *pinum)
|
struct cifs_sb_info *cifs_sb, int max_len, __u64 *pinum)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
unsigned int len = 0;
|
unsigned int len = 0;
|
||||||
|
@ -903,7 +903,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
|
||||||
struct qstr qstring;
|
struct qstr qstring;
|
||||||
struct cifsFileInfo *pCifsF;
|
struct cifsFileInfo *pCifsF;
|
||||||
unsigned int obj_type;
|
unsigned int obj_type;
|
||||||
ino_t inum;
|
__u64 inum;
|
||||||
struct cifs_sb_info *cifs_sb;
|
struct cifs_sb_info *cifs_sb;
|
||||||
struct inode *tmp_inode;
|
struct inode *tmp_inode;
|
||||||
struct dentry *tmp_dentry;
|
struct dentry *tmp_dentry;
|
||||||
|
|
Loading…
Reference in New Issue