Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2505462ybt; Tue, 16 Jun 2020 07:49:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEiELG1LBj1z5VqiLDDwTYscGsbyG04gkA9Dt9JSwzCyDFKDeLPN7j8IPcqP6LN54DIHIT X-Received: by 2002:a17:907:40ed:: with SMTP id nn21mr3168610ejb.71.1592318944695; Tue, 16 Jun 2020 07:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592318944; cv=none; d=google.com; s=arc-20160816; b=qoLsEO4lEBaF0b4mQKQcG3o/LDyruSsFWu6kbmIQxQH2z4wvACfU+yVBlIRHHLU+1S DEfzXxSl18E8d8yz4QXjAwTddcnmKvdbYDU/luFygI/orl89ff+uRPXvElZKoTHNdgCC d3GZH3AtJd4fl6UGXt3MdeY4Tn5dBiKQ/eo4Llw6k5dfbpqTyJkBviHPo3M3w8rVcn0L J1/wEBIpjvtBXWGjQdg302cCCmJ0YqL5A0ouQ4ciqDVl4+7uVSg4L+iDYi5vTo3HYeGB w/tvtf+7BUuF2wbNyBr2DfIkxt2kHI6C4VI4tGQ3XwrJuEWQpPdbXnkU6WVePeqdZSKI UghA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :reply-to:message-id:subject:cc:to:from:date; bh=4K0eW0ggifXqVlYAC35Vz14GwOf9aNQMjH56rndewAg=; b=c53yo+ibV8P54CNwZnQ9Hv0Sv7te6qz3JdTOq5J35cA5cr9LelAoCiNWelLlxDvS1V 75mzgoa8TswgR2FwaROQNbjWLk3isC9JJ1QaVJNC7bmak11IBuakpzuYy5OK2qlduce3 CRGvU3zuICoujRXffiwjysTedL3yW7b/eclCgx0FmhWPYJDSHva56b0jFyqc80FWsJhR FkfuJL2D91s1FgwQWvh9woYg4zsn4B5zPXg6Xsx+lGqpuKgNhog15ZjF5usW+z/epHEA TXSJ/LAMsLpjeQs3utPpuxiyso7G2MaVMDQMSS9g3TgJWhbXdzXcGdNHKkOey7hua4th Vywg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si10523850ejj.723.2020.06.16.07.48.31; Tue, 16 Jun 2020 07:49:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728803AbgFPOsV (ORCPT + 99 others); Tue, 16 Jun 2020 10:48:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:37776 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728501AbgFPOsV (ORCPT ); Tue, 16 Jun 2020 10:48:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3F73AAAE8; Tue, 16 Jun 2020 14:48:18 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 50CC9DA7C3; Tue, 16 Jun 2020 16:48:04 +0200 (CEST) Date: Tue, 16 Jun 2020 16:48:04 +0200 From: David Sterba To: Waiman Long Cc: Andrew Morton , David Howells , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , Linus Torvalds , Joe Perches , Matthew Wilcox , David Rientjes , Michal Hocko , Johannes Weiner , Dan Carpenter , David Sterba , "Jason A . Donenfeld" , linux-mm@kvack.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-pm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-amlogic@lists.infradead.org, linux-mediatek@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-ppp@vger.kernel.org, wireguard@lists.zx2c4.com, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-fscrypt@vger.kernel.org, ecryptfs@vger.kernel.org, kasan-dev@googlegroups.com, linux-bluetooth@vger.kernel.org, linux-wpan@vger.kernel.org, linux-sctp@vger.kernel.org, linux-nfs@vger.kernel.org, tipc-discussion@lists.sourceforge.net, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org Subject: Re: [PATCH v4 3/3] btrfs: Use kfree() in btrfs_ioctl_get_subvol_info() Message-ID: <20200616144804.GD27795@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Waiman Long , Andrew Morton , David Howells , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , Linus Torvalds , Joe Perches , Matthew Wilcox , David Rientjes , Michal Hocko , Johannes Weiner , Dan Carpenter , "Jason A . Donenfeld" , linux-mm@kvack.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-pm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-amlogic@lists.infradead.org, linux-mediatek@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-ppp@vger.kernel.org, wireguard@lists.zx2c4.com, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-fscrypt@vger.kernel.org, ecryptfs@vger.kernel.org, kasan-dev@googlegroups.com, linux-bluetooth@vger.kernel.org, linux-wpan@vger.kernel.org, linux-sctp@vger.kernel.org, linux-nfs@vger.kernel.org, tipc-discussion@lists.sourceforge.net, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org References: <20200616015718.7812-1-longman@redhat.com> <20200616015718.7812-4-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200616015718.7812-4-longman@redhat.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Mon, Jun 15, 2020 at 09:57:18PM -0400, Waiman Long wrote: > 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 > Signed-off-by: Waiman Long > --- > 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 f1dd9e4271e9..e8f7c5f00894 100644 > --- a/fs/btrfs/ioctl.c > +++ b/fs/btrfs/ioctl.c > @@ -2692,7 +2692,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); I would rather merge a patch doing to kzfree -> kfree instead of doing the middle step to switch it to kfree_sensitive. If it would help integration of your patchset I can push it to the next rc so there are no kzfree left in the btrfs code. Treewide change like that can take time so it would be one less problem to care about for you.