[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241009162541.GL1609@twin.jikos.cz>
Date: Wed, 9 Oct 2024 18:25:41 +0200
From: David Sterba <dsterba@...e.cz>
To: Roi Martin <jroi.martin@...il.com>
Cc: clm@...com, josef@...icpanda.com, dsterba@...e.com,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: fix uninitialized pointer free on add_inode_ref
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@...il.com>
Reviewed-by: David Sterba <dsterba@...e.com>
Added to for-next, thanks.
Powered by blists - more mailing lists