]> git.ipfire.org Git - people/arne_f/kernel.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Aug 2016 09:53:20 +0000 (11:53 +0200)
commit30d6d4f221b089022a33e274b31c68840a5f4310
treeb11dddc1dd8fbccac1761c5d832932dcc37feab6
parentaed5492f1739b5e57046ef80afc812b7a907f1e3
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/dir.c