]> www.infradead.org Git - users/jedix/linux-maple.git/commit
locks: use file_inode()
authorMiklos Szeredi <mszeredi@redhat.com>
Fri, 1 Jul 2016 12:56:07 +0000 (14:56 +0200)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 22:21:58 +0000 (17:21 -0500)
commitcd1c4dfbe8b1e9809309dbcffc4d8b0f24b86f6e
tree78ebe6daef8267bc94f93f7f642ccb3a9f67417d
parentd0ea0d5e9ebf8450f4222b536c19c1f1be149374
locks: use file_inode()

Orabug: 25308036

[ Upstream commit 6343a2120862f7023006c8091ad95c1f16a32077 ]

(Another one for the f_path debacle.)

ltp fcntl33 testcase caused an Oops in selinux_file_send_sigiotask.

The reason is that generic_add_lease() used filp->f_path.dentry->inode
while all the others use file_inode().  This makes a difference for files
opened on overlayfs since the former will point to the overlay inode the
latter to the underlying inode.

So generic_add_lease() added the lease to the overlay inode and
generic_delete_lease() removed it from the underlying inode.  When the file
was released the lease remained on the overlay inode's lock list, resulting
in use after free.

Reported-by: Eryu Guan <eguan@redhat.com>
Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay and f_inode to the underlay")
Cc: <stable@vger.kernel.org>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit a1f678e55da552523dd45a531580a7e533b3bd8f)
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
fs/locks.c