Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1610118

Re: [PATCH] shmem: fix __shmem_file_setup error path leaks

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH] shmem: fix __shmem_file_setup error path leaks
Date 2017-03-27 23:30 +0200
Message-ID <tpKn8-5RA-17@gated-at.bofh.it> (permalink)
References <tpGjv-305-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Mar 27, 2017 at 10:05:34AM -0700, Vito Caputo wrote:
> The existing path and memory cleanups appear to be in reverse order, and
> there's no iput() potentially leaking the inode in the last two error gotos.
> 
> Also make put_memory shmem_unacct_size() conditional on !inode since if we
> entered cleanup at put_inode, shmem_evict_inode() occurs via
> iput()->iput_final(), which performs the shmem_unacct_size() for us.
> 
> Signed-off-by: Vito Caputo <vcaputo@pengaru.com>
> ---
> 
> This caught my eye while looking through the memfd_create() implementation.
> Included patch was compile tested only...

Obviously so, since you've just introduced a double iput() there.  After
        d_instantiate(path.dentry, inode);
dropping the reference to path.dentry (done by path_put(&path)) will drop
the reference to inode transferred into that dentry by d_instantiate().
NAK.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] shmem: fix __shmem_file_setup error path leaks Vito Caputo <vcaputo@pengaru.com> - 2017-03-27 19:10 +0200
  Re: [PATCH] shmem: fix __shmem_file_setup error path leaks Al Viro <viro@ZenIV.linux.org.uk> - 2017-03-27 23:30 +0200
    Re: [PATCH] shmem: fix __shmem_file_setup error path leaks vcaputo@pengaru.com - 2017-03-28 03:00 +0200
  Re: [PATCH] shmem: fix __shmem_file_setup error path leaks "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2017-03-28 06:00 +0200

csiph-web