From: David Disseldorp <ddiss@suse.de>
To: Stanislav Goriainov <goriainov@ispras.ru>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org,
ldv-project@linuxtesting.org
Subject: Re: [PATCH] ovl: Fix potential memory leak
Date: Mon, 22 Aug 2022 15:57:34 +0200 [thread overview]
Message-ID: <20220822155734.0a188325@echidna.suse.de> (raw)
In-Reply-To: <20220822115257.7457-1-goriainov@ispras.ru>
On Mon, 22 Aug 2022 14:52:57 +0300, Stanislav Goriainov wrote:
> ovl: Fix potential memory leak in ovl_lookup()
>
> If memory for uperredirect was allocated with kstrdup()
> in upperdir != NULL and d.redirect != NULL path,
> it may be lost when upperredirect is reassigned later.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Stanislav Goriainov <goriainov@ispras.ru>
> ---
> fs/overlayfs/namei.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
> index 69dc577974f8..226c69812379 100644
> --- a/fs/overlayfs/namei.c
> +++ b/fs/overlayfs/namei.c
> @@ -1085,6 +1085,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
> .mnt = ovl_upper_mnt(ofs),
> };
>
> + kfree(upperredirect);
> upperredirect = ovl_get_redirect_xattr(ofs, &upperpath, 0);
> if (IS_ERR(upperredirect)) {
> err = PTR_ERR(upperredirect);
This probably deserves a:
Fixes: 0a2d0d3f2f291 ("ovl: Check redirect on index as well")
Looks fine otherwise.
Reviewed-by: David Disseldorp <ddiss@suse.de>
next prev parent reply other threads:[~2022-08-22 13:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-22 11:52 Stanislav Goriainov
2022-08-22 13:57 ` David Disseldorp [this message]
2022-08-22 15:24 ` Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220822155734.0a188325@echidna.suse.de \
--to=ddiss@suse.de \
--cc=goriainov@ispras.ru \
--cc=ldv-project@linuxtesting.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®