[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240319185711.GA14596@suse.cz>
Date: Tue, 19 Mar 2024 19:57:11 +0100
From: David Sterba <dsterba@...e.cz>
To: Maximilian Heyne <mheyne@...zon.de>
Cc: stable@...r.kernel.org, Chris Mason <clm@...com>,
Josef Bacik <josef@...icpanda.com>, David Sterba <dsterba@...e.com>,
Filipe Manana <fdmanana@...e.com>, Qu Wenruo <wqu@...e.com>,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4.19 5.4 5.15] btrfs: defrag: fix memory leak in
btrfs_ioctl_defrag
On Tue, Mar 19, 2024 at 05:00:55PM +0000, Maximilian Heyne wrote:
> Prior to commit c853a5783ebe ("btrfs: allocate
> btrfs_ioctl_defrag_range_args on stack") range is allocated on the heap
> and must be freed. However, commit 173431b274a9 ("btrfs: defrag: reject
> unknown flags of btrfs_ioctl_defrag_range_args") didn't take care of
> this when it was backported to kernel < 5.15.
>
> Add a kfree on the error path for stable kernels that lack
> commit c853a5783ebe ("btrfs: allocate btrfs_ioctl_defrag_range_args on
> stack").
>
> This bug was discovered and resolved using Coverity Static Analysis
> Security Testing (SAST) by Synopsys, Inc.
Good catch, thanks.
The affected versions are as you say 4.19, 5.4, 5.15, the fixup is
sufficient and minimal fix, c853a5783ebe is reasonably safe for backport
too.
Powered by blists - more mailing lists