Skip to content

Commit f6614b7

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: cifs: fix a memleak in cifs_setattr_nounix() cifs: make cifs_ioctl handle NULL filp->private_data correctly
2 parents 63bfd73 + 3565bd4 commit f6614b7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

fs/cifs/inode.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2177,7 +2177,6 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
21772177

21782178
setattr_copy(inode, attrs);
21792179
mark_inode_dirty(inode);
2180-
return 0;
21812180

21822181
cifs_setattr_exit:
21832182
kfree(full_path);

fs/cifs/ioctl.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
3838
struct cifs_sb_info *cifs_sb;
3939
#ifdef CONFIG_CIFS_POSIX
4040
struct cifsFileInfo *pSMBFile = filep->private_data;
41-
struct cifsTconInfo *tcon = tlink_tcon(pSMBFile->tlink);
41+
struct cifsTconInfo *tcon;
4242
__u64 ExtAttrBits = 0;
4343
__u64 ExtAttrMask = 0;
44-
__u64 caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
44+
__u64 caps;
4545
#endif /* CONFIG_CIFS_POSIX */
4646

4747
xid = GetXid();
@@ -62,6 +62,10 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
6262
break;
6363
#ifdef CONFIG_CIFS_POSIX
6464
case FS_IOC_GETFLAGS:
65+
if (pSMBFile == NULL)
66+
break;
67+
tcon = tlink_tcon(pSMBFile->tlink);
68+
caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
6569
if (CIFS_UNIX_EXTATTR_CAP & caps) {
6670
rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
6771
&ExtAttrBits, &ExtAttrMask);
@@ -73,6 +77,10 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
7377
break;
7478

7579
case FS_IOC_SETFLAGS:
80+
if (pSMBFile == NULL)
81+
break;
82+
tcon = tlink_tcon(pSMBFile->tlink);
83+
caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
7684
if (CIFS_UNIX_EXTATTR_CAP & caps) {
7785
if (get_user(ExtAttrBits, (int __user *)arg)) {
7886
rc = -EFAULT;

0 commit comments

Comments
 (0)