Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1239281pxa; Thu, 20 Aug 2020 06:29:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylLy+/h6+aQ8LAruuqHCiwQWGEGagtfhxpwnIV2IaU78u59wDn1lTNcTc4pBmUsFcEMN78 X-Received: by 2002:a17:906:fa0c:: with SMTP id lo12mr3439204ejb.390.1597930172018; Thu, 20 Aug 2020 06:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597930172; cv=none; d=google.com; s=arc-20160816; b=ulOhGiW1RBOEhuuOpiAbhaXDD2u351LnPBdJko54sdY/xiFeyRUohs1km1v3crwLCX OemfpRekQiILZnBh6xNI6QNtvT+IcfN/L388Z+/8XcaqYdbDDgsCheyMp/ZqWK1SwipO +RBn/lGqijp8HuxDl89KxydyhuCdQjndUqfxFB4PrTFOQcpg0nQnLsFQK7gbUc+y3F/y AjmPZNaN0yTFBYQZQhUL1kp3glyzQR1fbeG34KA4UDVQ8GhWs7j7FHA71SmCbcdT0Bub xFDgOvhXpDPGB+8iSpusBsm9EnGgbM9lx9uY/9QUk+NYw7gFPpzilXcGIBOAeoUpXPKm MwpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pVTRvvVKj3OzS4oK7lAL1WAPgTa6jWapLkdSw90VL4Q=; b=XabkNZiBGEaRaGYZX/h5i3RWH3dSOOfcjEo6vnfuxh5bMKvB/fm1HEOW3D2xGCuvYh K9sxXCyOM0OFA3k6zRGl6VLJTJhqQbk63BVxlyPR09Jbfhuy8/Hrttw1Vb5ZhYlKTQfH JWDSIbsu6iz8EP1PcQn8EApikuD+74WwkQbCWxAuMcp77GfFj88wPuws9N0k/daYLm3D A06mmJis69RsFOcmikcp9a6f0XvdgPjvF8yhbJjA0OH+yOpYsmLqy3pY8dlrlKsswICG tPdr6SMBGQWpMMJ9Ytqi6+nng2BZrgBjKLb//ITrQ+MU8UvR88VFKj8oMt4olSRrus9h yAZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="cCd9f/Sz"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si1399667edw.437.2020.08.20.06.29.06; Thu, 20 Aug 2020 06:29:31 -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=@kernel.org header.s=default header.b="cCd9f/Sz"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729154AbgHTNW6 (ORCPT + 99 others); Thu, 20 Aug 2020 09:22:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:45294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728412AbgHTJdr (ORCPT ); Thu, 20 Aug 2020 05:33:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6602B22B49; Thu, 20 Aug 2020 09:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597916005; bh=K9KMQFAcyvXCpKGPLlOIGzdhg4xgO8vb0fMc0YLqKwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cCd9f/Sz5efkJPkhyADsA6KX85bQ68hfJOHSW2oKEkeF2dk6IaR/BqbakOnHrAuxf OVXUq1t9lYuAZeQWCAgccbszAq3GSoC/CKOtKeKyGjO9uwSOb4ZIUhYbJPDAHG3Y7T hx3dmLP4n35kAv7g/AVl2WFbwp+bfBMVi27SzDQg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tiezhu Yang , Luis Chamberlain , Andrew Morton , Alexei Starovoitov , Al Viro , Christian Brauner , Chuck Lever , David Howells , "David S. Miller" , Jakub Kicinski , James Morris , Jarkko Sakkinen , "J. Bruce Fields" , Jens Axboe , Josh Triplett , Kees Cook , Lars Ellenberg , Nikolay Aleksandrov , Philipp Reisner , Roopa Prabhu , "Serge E. Hallyn" , Sergei Trofimovich , Sergey Kvachonok , Shuah Khan , Tony Vroon , Christoph Hellwig , Linus Torvalds , Sasha Levin Subject: [PATCH 5.8 210/232] test_kmod: avoid potential double free in trigger_config_run_type() Date: Thu, 20 Aug 2020 11:21:01 +0200 Message-Id: <20200820091622.982699256@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tiezhu Yang [ Upstream commit 0776d1231bec0c7ab43baf440a3f5ef5f49dd795 ] Reset the member "test_fs" of the test configuration after a call of the function "kfree_const" to a null pointer so that a double memory release will not be performed. Fixes: d9c6a72d6fa2 ("kmod: add test driver to stress test the module loader") Signed-off-by: Tiezhu Yang Signed-off-by: Luis Chamberlain Signed-off-by: Andrew Morton Acked-by: Luis Chamberlain Cc: Alexei Starovoitov Cc: Al Viro Cc: Christian Brauner Cc: Chuck Lever Cc: David Howells Cc: David S. Miller Cc: Greg Kroah-Hartman Cc: Jakub Kicinski Cc: James Morris Cc: Jarkko Sakkinen Cc: J. Bruce Fields Cc: Jens Axboe Cc: Josh Triplett Cc: Kees Cook Cc: Lars Ellenberg Cc: Nikolay Aleksandrov Cc: Philipp Reisner Cc: Roopa Prabhu Cc: "Serge E. Hallyn" Cc: Sergei Trofimovich Cc: Sergey Kvachonok Cc: Shuah Khan Cc: Tony Vroon Cc: Christoph Hellwig Link: http://lkml.kernel.org/r/20200610154923.27510-4-mcgrof@kernel.org Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- lib/test_kmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_kmod.c b/lib/test_kmod.c index e651c37d56dbd..eab52770070d6 100644 --- a/lib/test_kmod.c +++ b/lib/test_kmod.c @@ -745,7 +745,7 @@ static int trigger_config_run_type(struct kmod_test_device *test_dev, break; case TEST_KMOD_FS_TYPE: kfree_const(config->test_fs); - config->test_driver = NULL; + config->test_fs = NULL; copied = config_copy_test_fs(config, test_str, strlen(test_str)); break; -- 2.25.1