Commit 77970693 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

cifs: check for private_data before trying to put it

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: default avatarBen Greear <greearb@candelatech.com>
CC: Stable <stable@kernel.org>
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent a6360dd3
......@@ -575,8 +575,10 @@ static int cifs_reopen_file(struct cifsFileInfo *pCifsFile, bool can_flush)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment