]> www.infradead.org Git - users/jedix/linux-maple.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)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 22:22:06 +0000 (17:22 -0500)
commiteef9408229e9ea6841eab00d6fe73b530215c6e4
tree1d37fc674c2f9a3b3b1c5e955847f89d944965be
parentc3ed9f0f7245789cc11e21abe0fda6efbf8188d2
cifs: Check for existing directory when opening file with O_CREAT

Orabug: 25308121

[ Upstream commit 8d9535b6efd86e6c07da59f97e68f44efb7fe080 ]

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: Sasha Levin <alexander.levin@verizon.com>
(cherry picked from commit 9b01eafbc9514e71056e0a1a4714606385a431a4)
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
fs/cifs/dir.c