Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2539856ybt; Tue, 16 Jun 2020 08:35:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxl/GFcrHShDIA3//KE+FwPxrnAj2zF6GQ+X9dNZDZyur24TMHWJV1kkYaH67fHS3Qni+k4 X-Received: by 2002:a05:6402:1d0d:: with SMTP id dg13mr3035441edb.146.1592321730288; Tue, 16 Jun 2020 08:35:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592321730; cv=none; d=google.com; s=arc-20160816; b=EBvxhHaVtudNfAvuN1i0NRxPmo04rpCmTpuLwRRvWb9ozsPEWNpo2Tpy36BUcjiYmv AfG+PkvUbrp00+O+7IQ5HK/RUS8vsKJpMmzIcYFhUWbX78ChHPEJOmKWIZm2CQlhLk8C v0krVrjf5qIX1fhPEfmP0TJEr26fTJnlfOapWQnhmhE+Oq77pEzawGpmYzCGycHTff+u VaifvuBmApsADwQIJL2i2DiFoAfr5LV/sBR5ZXRPnfbbbRIhSBB3rey5uUGjr0IX2kgW qNlS65w8fgwy6ZjzvyN2ZSpshbNLC9SiacGtHS3w+/gkhRySDNX/JeMh/m57I/NQnm+f EiRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=Rapzz6MrSVpeRVwJm6x5SQPvv++uc4wAZZK6zSqqYMI=; b=ykZfShd2m+Iiu8wOGiuaMsEsyuOwBekeCUHjYw+fxpk3qtK7VzZUUfh45ol9tdV84e gpxOOc98rdZGImtuM/DM5o20NSSjRxV1liHVvZy9BAJdcVxsR0A1lHPXCov2gWvkDCEf 6k3GhSYxfOrIS/k7OxDulzuuvDThowdXZlQ+L0lVaSMTc8GHr4sXtIbi7NEnWQmf7gUZ E2fVx34IiQ/ZG7V/E9comtXphm6E4MsR1gnS36tmc30HNfTgKhZK/JXZY2tBgOZkfJSq Hk8OBFBvkF2NZaahY1WsqUBDDS2Lda3FjeyCcrNWHKHoTrycQTR8aqopfIRp2OB14xeY P+og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S7B5R68a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id si8si12045250ejb.7.2020.06.16.08.35.06; Tue, 16 Jun 2020 08:35:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S7B5R68a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729811AbgFPPcT (ORCPT + 99 others); Tue, 16 Jun 2020 11:32:19 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:41495 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729128AbgFPPcT (ORCPT ); Tue, 16 Jun 2020 11:32:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592321538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=Rapzz6MrSVpeRVwJm6x5SQPvv++uc4wAZZK6zSqqYMI=; b=S7B5R68ajDZ20aVoVRUgoDTuoLwFkMtOTrqA6vHi9oj2W4rD3DRtr0CRcpVNvq7GNF0bTZ DnMp69HN873XGajzhbo5Sg9Lw/L3mGh5fbMJDeWvDnp6aJpkoiZjpDTNw889i+qyG9GoXV Xg3rAAyxBPfvmujCuSJOGno7otcAE1Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-387-zn6-aWQrP7aNGDm5Hrovow-1; Tue, 16 Jun 2020 11:32:16 -0400 X-MC-Unique: zn6-aWQrP7aNGDm5Hrovow-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8682F87342B; Tue, 16 Jun 2020 15:32:15 +0000 (UTC) Received: from llong.com (ovpn-114-156.rdu2.redhat.com [10.10.114.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA06B5D9D3; Tue, 16 Jun 2020 15:32:11 +0000 (UTC) From: Waiman Long To: Chris Mason , Josef Bacik , David Sterba Cc: linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, Waiman Long Subject: [PATCH] btrfs: Use kfree() in btrfs_ioctl_get_subvol_info() Date: Tue, 16 Jun 2020 11:31:59 -0400 Message-Id: <20200616153159.10691-1-longman@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 168deb8ef68a..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); - kzfree(subvol_info); + kfree(subvol_info); return ret; } -- 2.18.1