]> git.baikalelectronics.ru Git - kernel.git/commit
gfs2: Get rid of potential double-freeing in gfs2_create_inode
authorAndreas Gruenbacher <agruenba@redhat.com>
Mon, 26 Nov 2018 17:45:35 +0000 (18:45 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 11 Dec 2018 20:44:29 +0000 (21:44 +0100)
commit912da65db744e38e08ce9cfb69dc96a2b60615c1
treeae5ebad26e35f1445b1295b224d962831124769a
parentf04ac9a534c12a6e4fe8658c2bd0e611c23e03e3
gfs2: Get rid of potential double-freeing in gfs2_create_inode

In gfs2_create_inode, after setting and releasing the acl / default_acl, the
acl / default_acl pointers are not set to NULL as they should be.  In that
state, when the function reaches label fail_free_acls, gfs2_create_inode will
try to release the same acls again.

Fix that by setting the pointers to NULL after releasing the acls.  Slightly
simplify the logic.  Also, posix_acl_release checks for NULL already, so
there is no need to duplicate those checks here.

Fixes: 673b69aa6ca0 ("gfs2: use generic posix ACL infrastructure")
Reported-by: Pan Bian <bianpan2016@163.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: stable@vger.kernel.org # v4.9+
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
fs/gfs2/inode.c