]> 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)
committerWilly Tarreau <w@1wt.eu>
Sat, 27 Aug 2016 09:40:37 +0000 (11:40 +0200)
commit60a8744f15d8bdcab6dc4f21728d8e9cb5e8880f
tree317a16ec6ef876c220dd989bd49405f9547503bd
parent9e10c1166f492b7979a6cf1b71e2ffa19c18e21c
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>
CC: Stable <stable@vger.kernel.org>
Reported-by: Xiaoli Feng <xifeng@redhat.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
fs/cifs/dir.c