All of lore.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	David Howells <dhowells@redhat.com>,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Joe Perches <joe@perches.com>,
	Matthew Wilcox <willy@infradead.org>,
	David Rientjes <rientjes@google.com>, Chris Mason <clm@fb.com>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Cc: linux-mm@kvack.org, keyrings@vger.kernel.org,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	linux-crypto@vger.kernel.org, linux-btrfs@vger.kernel.org,
	Waiman Long <longman@redhat.com>
Subject: [PATCH v2 3/3] btrfs: Use kfree() in btrfs_ioctl_get_subvol_info()
Date: Tue, 14 Apr 2020 15:29:33 -0400	[thread overview]
Message-ID: <20200414192933.26846-1-longman@redhat.com> (raw)
In-Reply-To: <20200413211550.8307-1-longman@redhat.com>

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 kfree_sensitive() isn't really needed,
use kfree() instead.

Reported-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Waiman Long <longman@redhat.com>
---
 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 eab3f8510426..5070bd2436b7 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);
-	kfree_sensitive(subvol_info);
+	kfree(subvol_info);
 	return ret;
 }
 
-- 
2.18.1


WARNING: multiple messages have this Message-ID (diff)
From: Waiman Long <longman@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	David Howells <dhowells@redhat.com>,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Joe Perches <joe@perches.com>,
	Matthew Wilcox <willy@infradead.org>,
	David Rientjes <rientjes@google.com>, Chris Mason <clm@fb.com>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Cc: linux-mm@kvack.org, keyrings@vger.kernel.org,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	linux-crypto@vger.kernel.org, linux-btrfs@vger.kernel.org,
	Waiman Long <longman@redhat.com>
Subject: [PATCH v2 3/3] btrfs: Use kfree() in btrfs_ioctl_get_subvol_info()
Date: Tue, 14 Apr 2020 19:29:33 +0000	[thread overview]
Message-ID: <20200414192933.26846-1-longman@redhat.com> (raw)
In-Reply-To: <20200413211550.8307-1-longman@redhat.com>

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 kfree_sensitive() isn't really needed,
use kfree() instead.

Reported-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Waiman Long <longman@redhat.com>
---
 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 eab3f8510426..5070bd2436b7 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);
-	kfree_sensitive(subvol_info);
+	kfree(subvol_info);
 	return ret;
 }
 
-- 
2.18.1

  parent reply	other threads:[~2020-04-14 19:30 UTC|newest]

Thread overview: 219+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13 21:15 [PATCH 0/2] mm, treewide: Rename kzfree() to kfree_sensitive() Waiman Long
2020-04-13 21:15 ` [Intel-wired-lan] " Waiman Long
2020-04-13 21:15 ` Waiman Long
2020-04-13 21:15 ` Waiman Long
2020-04-13 21:15 ` Waiman Long
2020-04-13 21:15 ` Waiman Long
2020-04-13 21:15 ` [Cocci] " Waiman Long
2020-04-13 21:15 ` Waiman Long
2020-04-13 21:15 ` Waiman Long
2020-04-13 21:15 ` Waiman Long
2020-04-13 21:15 ` [PATCH 1/2] " Waiman Long
2020-04-13 21:15   ` [Intel-wired-lan] " Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` [Cocci] " Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-14  0:29   ` David Rientjes
2020-04-14  0:29     ` [Intel-wired-lan] " David Rientjes
2020-04-14  0:29     ` David Rientjes
2020-04-14  0:29     ` David Rientjes
2020-04-14  0:29     ` David Rientjes
2020-04-14  0:29     ` David Rientjes
2020-04-14  0:29     ` [Cocci] " David Rientjes
2020-04-14  0:29     ` David Rientjes
2020-04-14  0:29     ` David Rientjes
2020-04-14  0:29     ` David Rientjes
2020-04-14  0:29     ` David Rientjes
2020-04-14  8:32   ` Jason A. Donenfeld
2020-04-14  8:32     ` [Intel-wired-lan] " Jason A. Donenfeld
2020-04-14  8:32     ` Jason A. Donenfeld
2020-04-14  8:32     ` Jason A. Donenfeld
2020-04-14  8:32     ` Jason A. Donenfeld
2020-04-14  8:32     ` Jason A. Donenfeld
2020-04-14  8:32     ` [Cocci] " Jason A. Donenfeld
2020-04-14  8:32     ` Jason A. Donenfeld
2020-04-14  8:32     ` Jason A. Donenfeld
2020-04-14  8:32     ` Jason A. Donenfeld
2020-04-14  9:01   ` Michal Hocko
2020-04-14  9:01     ` [Intel-wired-lan] " Michal Hocko
2020-04-14  9:01     ` Michal Hocko
2020-04-14  9:01     ` Michal Hocko
2020-04-14  9:01     ` Michal Hocko
2020-04-14  9:01     ` Michal Hocko
2020-04-14  9:01     ` [Cocci] " Michal Hocko
2020-04-14  9:01     ` Michal Hocko
2020-04-14  9:01     ` Michal Hocko
2020-04-14  9:01     ` Michal Hocko
2020-04-14 12:48   ` David Sterba
2020-04-14 12:48     ` [Intel-wired-lan] " David Sterba
2020-04-14 12:48     ` David Sterba
2020-04-14 12:48     ` David Sterba
2020-04-14 12:48     ` David Sterba
2020-04-14 12:48     ` David Sterba
2020-04-14 12:48     ` [Cocci] " David Sterba
2020-04-14 12:48     ` David Sterba
2020-04-14 12:48     ` David Sterba
2020-04-14 12:48     ` David Sterba
2020-04-14 18:26     ` Waiman Long
2020-04-14 18:26       ` [Intel-wired-lan] " Waiman Long
2020-04-14 18:26       ` Waiman Long
2020-04-14 18:26       ` Waiman Long
2020-04-14 18:26       ` Waiman Long
2020-04-14 18:26       ` Waiman Long
2020-04-14 18:26       ` [Cocci] " Waiman Long
2020-04-14 18:26       ` Waiman Long
2020-04-14 18:26       ` Waiman Long
2020-04-14 18:26     ` Waiman Long
2020-04-15  5:01   ` Johannes Weiner
2020-04-15  5:01     ` [Intel-wired-lan] " Johannes Weiner
2020-04-15  5:01     ` Johannes Weiner
2020-04-15  5:01     ` Johannes Weiner
2020-04-15  5:01     ` Johannes Weiner
2020-04-15  5:01     ` Johannes Weiner
2020-04-15  5:01     ` [Cocci] " Johannes Weiner
2020-04-15  5:01     ` Johannes Weiner
2020-04-15  5:01     ` Johannes Weiner
2020-04-15  5:01     ` Johannes Weiner
2020-06-15 18:07   ` Dan Carpenter
2020-06-15 18:07     ` [Intel-wired-lan] " Dan Carpenter
2020-06-15 18:07     ` Dan Carpenter
2020-06-15 18:07     ` Dan Carpenter
2020-06-15 18:07     ` Dan Carpenter
2020-06-15 18:07     ` Dan Carpenter
2020-06-15 18:07     ` [Cocci] " Dan Carpenter
2020-06-15 18:07     ` Dan Carpenter
2020-06-15 18:07     ` Dan Carpenter
2020-06-15 18:07     ` Dan Carpenter
2020-06-15 18:39     ` Waiman Long
2020-06-15 18:39       ` [Intel-wired-lan] " Waiman Long
2020-06-15 18:39       ` Waiman Long
2020-06-15 18:39       ` Waiman Long
2020-06-15 18:39       ` Waiman Long
2020-06-15 18:39       ` Waiman Long
2020-06-15 18:39       ` [Cocci] " Waiman Long
2020-06-15 18:39       ` Waiman Long
2020-06-15 18:39       ` Waiman Long
2020-06-15 18:39       ` Waiman Long
2020-04-13 21:15 ` [PATCH 2/2] crypto: Remove unnecessary memzero_explicit() Waiman Long
2020-04-13 21:15   ` [Intel-wired-lan] " Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` [Cocci] " Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:15   ` Waiman Long
2020-04-13 21:31   ` Joe Perches
2020-04-13 21:31     ` [Intel-wired-lan] " Joe Perches
2020-04-13 21:31     ` Joe Perches
2020-04-13 21:31     ` Joe Perches
2020-04-13 21:31     ` Joe Perches
2020-04-13 21:31     ` Joe Perches
2020-04-13 21:31     ` [Cocci] " Joe Perches
2020-04-13 21:31     ` Joe Perches
2020-04-13 21:31     ` Joe Perches
2020-04-13 21:31     ` Joe Perches
2020-04-13 21:31     ` Joe Perches
2020-04-13 21:52     ` Waiman Long
2020-04-13 21:52       ` [Intel-wired-lan] " Waiman Long
2020-04-13 21:52       ` Waiman Long
2020-04-13 21:52       ` Waiman Long
2020-04-13 21:52       ` Waiman Long
2020-04-13 21:52       ` Waiman Long
2020-04-13 21:52       ` Waiman Long
2020-04-13 21:52       ` [Cocci] " Waiman Long
2020-04-13 21:52       ` Waiman Long
2020-04-13 21:52       ` Waiman Long
2020-04-13 21:52       ` Waiman Long
2020-04-13 23:07   ` kbuild test robot
2020-04-13 23:50     ` Waiman Long
2020-04-14  0:01   ` kbuild test robot
2020-04-13 22:28 ` [PATCH v2 " Waiman Long
2020-04-13 22:28   ` [Intel-wired-lan] " Waiman Long
2020-04-13 22:28   ` Waiman Long
2020-04-13 22:28   ` Waiman Long
2020-04-13 22:28   ` Waiman Long
2020-04-13 22:28   ` Waiman Long
2020-04-13 22:28   ` [Cocci] " Waiman Long
2020-04-13 22:28   ` Waiman Long
2020-04-13 22:28   ` Waiman Long
2020-04-13 22:28   ` Waiman Long
2020-04-14  6:08   ` Christophe Leroy
2020-04-14  6:08     ` [Intel-wired-lan] " Christophe Leroy
2020-04-14  6:08     ` Christophe Leroy
2020-04-14  6:08     ` Christophe Leroy
2020-04-14  6:08     ` Christophe Leroy
2020-04-14  6:08     ` Christophe Leroy
2020-04-14  6:08     ` [Cocci] " Christophe Leroy
2020-04-14  6:08     ` Christophe Leroy
2020-04-14  6:08     ` Christophe Leroy
2020-04-14  6:08     ` Christophe Leroy
2020-04-14 16:24     ` Waiman Long
2020-04-14 16:24       ` [Intel-wired-lan] " Waiman Long
2020-04-14 16:24       ` Waiman Long
2020-04-14 16:24       ` Waiman Long
2020-04-14 16:24       ` Waiman Long
2020-04-14 16:24       ` Waiman Long
2020-04-14 16:24       ` [Cocci] " Waiman Long
2020-04-14 16:24       ` Waiman Long
2020-04-14 16:24       ` Waiman Long
2020-04-14 16:24       ` Waiman Long
2020-04-14 19:16       ` Michal Suchánek
2020-04-14 19:16         ` [Intel-wired-lan] " Michal =?unknown-8bit?q?Such=C3=A1nek?=
2020-04-14 19:16         ` Michal Suchánek
2020-04-14 19:16         ` Michal Suchánek
2020-04-14 19:16         ` Michal Suchánek
2020-04-14 19:16         ` Michal Suchánek
2020-04-14 19:16         ` [Cocci] " Michal Suchánek
2020-04-14 19:16         ` Michal Suchánek
2020-04-14 19:16         ` Michal Suchánek
2020-04-14 19:16         ` Michal Suchánek
2020-04-14 19:16         ` Michal Suchánek
2020-04-14 19:37         ` Waiman Long
2020-04-14 19:37           ` [Intel-wired-lan] " Waiman Long
2020-04-14 19:37           ` Waiman Long
2020-04-14 19:37           ` Waiman Long
2020-04-14 19:37           ` Waiman Long
2020-04-14 19:37           ` Waiman Long
2020-04-14 19:37           ` [Cocci] " Waiman Long
2020-04-14 19:37           ` Waiman Long
2020-04-14 19:37           ` Waiman Long
2020-04-14 19:37           ` Waiman Long
2020-04-14 19:37           ` Waiman Long
2020-04-14 19:44           ` Joe Perches
2020-04-14 19:44             ` [Intel-wired-lan] " Joe Perches
2020-04-14 19:44             ` Joe Perches
2020-04-14 19:44             ` Joe Perches
2020-04-14 19:44             ` Joe Perches
2020-04-14 19:44             ` Joe Perches
2020-04-14 19:44             ` [Cocci] " Joe Perches
2020-04-14 19:44             ` Joe Perches
2020-04-14 19:44             ` Joe Perches
2020-04-14 19:44             ` Joe Perches
2020-04-14 19:44             ` Joe Perches
2020-04-14 13:06 ` [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive() David Howells
2020-04-14 13:06   ` [Intel-wired-lan] " David Howells
2020-04-14 13:06   ` David Howells
2020-04-14 13:06   ` David Howells
2020-04-14 13:06   ` David Howells
2020-04-14 13:06   ` David Howells
2020-04-14 13:06   ` [Cocci] " David Howells
2020-04-14 13:06   ` David Howells
2020-04-14 13:06   ` David Howells
2020-04-14 13:06   ` David Howells
2020-04-14 19:29 ` Waiman Long [this message]
2020-04-14 19:29   ` [PATCH v2 3/3] btrfs: Use kfree() in btrfs_ioctl_get_subvol_info() Waiman Long
2020-04-14 20:02 ` [PATCH v3 2/3] crypto: Remove unnecessary memzero_explicit() Waiman Long
2020-04-14 20:02   ` Waiman Long
2020-04-14 20:02   ` Waiman Long
2020-04-14 20:02   ` Waiman Long
2020-04-16  9:06   ` Corentin Labbe
2020-04-16  9:06     ` Corentin Labbe
2020-04-16  9:06     ` Corentin Labbe
2020-04-16  9:06     ` Corentin Labbe

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=20200414192933.26846-1-longman@redhat.com \
    --to=longman@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=clm@fb.com \
    --cc=dhowells@redhat.com \
    --cc=dsterba@suse.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jmorris@namei.org \
    --cc=joe@perches.com \
    --cc=josef@toxicpanda.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=serge@hallyn.com \
    --cc=torvalds@linux-foundation.org \
    --cc=willy@infradead.org \
    --cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.