From: David Sterba <dsterba@suse.cz>
To: Roi Martin <jroi.martin@gmail.com>
Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: fix uninitialized pointer free on add_inode_ref
Date: Wed, 9 Oct 2024 18:25:41 +0200 [thread overview]
Message-ID: <20241009162541.GL1609@twin.jikos.cz> (raw)
In-Reply-To: <20241009080833.1355894-1-jroi.martin@gmail.com>
On Wed, Oct 09, 2024 at 10:08:33AM +0200, Roi Martin wrote:
> The "add_inode_ref" function does not initializes the "name" struct
> when it is declared. If any of the following calls to
> "read_one_inode" returns NULL,
>
> dir = read_one_inode(root, parent_objectid);
> if (!dir) {
> ret = -ENOENT;
> goto out;
> }
>
> inode = read_one_inode(root, inode_objectid);
> if (!inode) {
> ret = -EIO;
> goto out;
> }
>
> then "name.name" would be freed on "out" before being initialized.
>
> out:
> ...
> kfree(name.name);
>
> This issue was reported by Coverity with CID 1526744.
>
> Signed-off-by: Roi Martin <jroi.martin@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Added to for-next, thanks.
prev parent reply other threads:[~2024-10-09 16:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 8:08 Roi Martin
2024-10-09 14:29 ` Filipe Manana
2024-10-09 16:25 ` David Sterba [this message]
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=20241009162541.GL1609@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=jroi.martin@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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®