diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-04-05 16:23:47 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-21 14:32:20 -0700 |
commit | 7cb41edf395b70a6e48162382c5577967ce92bbf (patch) | |
tree | 36603a6cf5fb361d7cbbdaa6caad4f9f8377c027 /fs | |
parent | 1bd6bcd950ab6bd208a4748ff593d612a21b4284 (diff) | |
download | lwn-7cb41edf395b70a6e48162382c5577967ce92bbf.tar.gz lwn-7cb41edf395b70a6e48162382c5577967ce92bbf.zip |
cifs: check for private_data before trying to put it
commit 7797069305d13252fd66cf722aa8f2cbeb3c95cd upstream.
cifs_close doesn't check that the filp->private_data is non-NULL before
trying to put it. That can cause an oops in certain error conditions
that can occur on open or lookup before the private_data is set.
Reported-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/file.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index e964b1cd5dd0..7b2e8ec2709b 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -575,8 +575,10 @@ reopen_error_exit: int cifs_close(struct inode *inode, struct file *file) { - cifsFileInfo_put(file->private_data); - file->private_data = NULL; + if (file->private_data != NULL) { + cifsFileInfo_put(file->private_data); + file->private_data = NULL; + } /* return code from the ->release op is always ignored */ return 0; |