Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.7 11/53] btrfs: use kfree() in btrfs_ioctl_get_subvol_info()
       [not found] <20200702012202.2700645-1-sashal@kernel.org>
@ 2020-07-02  1:21 ` Sasha Levin
  2020-07-02  8:25   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2020-07-02  1:21 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Waiman Long, David Sterba, Sasha Levin, linux-btrfs

From: Waiman Long <longman@redhat.com>

[ Upstream commit b091f7fede97cc64f7aaad3eeb37965aebee3082 ]

In btrfs_ioctl_get_subvol_info(), there is a classic case where kzalloc()
was incorrectly paired with kzfree(). According to David Sterba, there
isn't any sensitive information in the subvol_info that needs to be
cleared before freeing. So kzfree() isn't really needed, use kfree()
instead.

Signed-off-by: Waiman Long <longman@redhat.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/btrfs/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 40b729dce91cd..5070bd2436b76 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2691,7 +2691,7 @@ static int btrfs_ioctl_get_subvol_info(struct file *file, void __user *argp)
 	btrfs_put_root(root);
 out_free:
 	btrfs_free_path(path);
-	kzfree(subvol_info);
+	kfree(subvol_info);
 	return ret;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH AUTOSEL 5.7 11/53] btrfs: use kfree() in btrfs_ioctl_get_subvol_info()
  2020-07-02  1:21 ` [PATCH AUTOSEL 5.7 11/53] btrfs: use kfree() in btrfs_ioctl_get_subvol_info() Sasha Levin
@ 2020-07-02  8:25   ` David Sterba
  2020-07-09 22:28     ` Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2020-07-02  8:25 UTC (permalink / raw)
  To: Sasha Levin; +Cc: linux-kernel, stable, Waiman Long, David Sterba, linux-btrfs

On Wed, Jul 01, 2020 at 09:21:20PM -0400, Sasha Levin wrote:
> From: Waiman Long <longman@redhat.com>
> 
> [ Upstream commit b091f7fede97cc64f7aaad3eeb37965aebee3082 ]
> 
> In btrfs_ioctl_get_subvol_info(), there is a classic case where kzalloc()
> was incorrectly paired with kzfree(). According to David Sterba, there
> isn't any sensitive information in the subvol_info that needs to be
> cleared before freeing. So kzfree() isn't really needed, use kfree()
> instead.

I don't think this patch is necessary for any stable tree, it's meant
only to ease merging a tree-wide patchset to rename kzfree.  In btrfs
code there was no point using it so it's plain kfree.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH AUTOSEL 5.7 11/53] btrfs: use kfree() in btrfs_ioctl_get_subvol_info()
  2020-07-02  8:25   ` David Sterba
@ 2020-07-09 22:28     ` Sasha Levin
  0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2020-07-09 22:28 UTC (permalink / raw)
  To: dsterba, linux-kernel, stable, Waiman Long, David Sterba,
	linux-btrfs

On Thu, Jul 02, 2020 at 10:25:58AM +0200, David Sterba wrote:
>On Wed, Jul 01, 2020 at 09:21:20PM -0400, Sasha Levin wrote:
>> From: Waiman Long <longman@redhat.com>
>>
>> [ Upstream commit b091f7fede97cc64f7aaad3eeb37965aebee3082 ]
>>
>> In btrfs_ioctl_get_subvol_info(), there is a classic case where kzalloc()
>> was incorrectly paired with kzfree(). According to David Sterba, there
>> isn't any sensitive information in the subvol_info that needs to be
>> cleared before freeing. So kzfree() isn't really needed, use kfree()
>> instead.
>
>I don't think this patch is necessary for any stable tree, it's meant
>only to ease merging a tree-wide patchset to rename kzfree.  In btrfs
>code there was no point using it so it's plain kfree.

I've dropped it, thanks!

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-09 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200702012202.2700645-1-sashal@kernel.org>
2020-07-02  1:21 ` [PATCH AUTOSEL 5.7 11/53] btrfs: use kfree() in btrfs_ioctl_get_subvol_info() Sasha Levin
2020-07-02  8:25   ` David Sterba
2020-07-09 22:28     ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox