]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cifs: Check for existing directory when opening file with O_CREAT
authorSachin Prabhu <sprabhu@redhat.com>
Thu, 7 Jul 2016 20:28:27 +0000 (21:28 +0100)
committerJiri Slaby <jslaby@suse.cz>
Fri, 19 Aug 2016 07:51:14 +0000 (09:51 +0200)
commit856101261eaa4e9da8ba71ce0252df551a170a0c
treee4667759d864a9971922e074fc50620ca22f7a6f
parentf01e595635c55d732fba1b0d2542994fb7c5b9ce
cifs: Check for existing directory when opening file with O_CREAT

commit 8d9535b6efd86e6c07da59f97e68f44efb7fe080 upstream.

When opening a file with O_CREAT flag, check to see if the file opened
is an existing directory.

This prevents the directory from being opened which subsequently causes
a crash when the close function for directories cifs_closedir() is called
which frees up the file->private_data memory while the file is still
listed on the open file list for the tcon.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Reported-by: Xiaoli Feng <xifeng@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
fs/cifs/dir.c