Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp678623pxb; Tue, 5 Apr 2022 18:25:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2VCAQ70y1CDlpF31hEV8u/pp9qo4v32fDjoStf1p7knjxhf6rAHQbmnCwFV5sKKkxNM4+ X-Received: by 2002:a17:90a:9204:b0:1ca:8698:2470 with SMTP id m4-20020a17090a920400b001ca86982470mr7209772pjo.199.1649208355294; Tue, 05 Apr 2022 18:25:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649208355; cv=none; d=google.com; s=arc-20160816; b=byPBT2NlsY4U37/7nq+yPufEFhVOqCeLs0X4bI+eAY6GKEFNYXNKNplCahZlgBbj8n 0ErL2f2o5TVqqSnu2/Q8xmFfZkDYQi+kzKMrSRT3LbaTdZteFOMgBCJvbUA/0XKV3egc 724ZBbtO6zZE9FL66k5sKSuVOxEwUbA5LIzX+JMbuCJrecqZu+IV5Isk+krQCdgRwMrb xVzy/fImodAgMPkey+f9aQuIgvhp5wAIBNpayDWRlrx2k8ZZUFaTxVo3ULGyO+bb4K+Z kKt/0oKtf/S5BJkNQQWUS1hsxAQMgpHCgnL12rbDRFxESbAP97GpVbt8JVEOQ3h3enqA 7dXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jWrR3CaU8zOlic5DKuJ/OKelGVbDNK9XpBFypUIXfEU=; b=bUi19Xt6Qeadovxvly6yVG6iUfOPVxv1VdC2v3kedsmL7HQktQ25cukYVWwamF/JKP WCkzIACgx72WfK4wYsxHJJjwMeRC34iCKtiBHGwPkBDGIKNeooMBecevTUDTKz0vB/X7 lIBz1n2jzbyqCt+KF/G8zEgV/CMMp/1R56gUnEiOsRmcTW/flAu1IyimuXE1SrH22Fz8 K9AX8Iw9MoBNZW2j7VPHDGcdRW7YNWy/hsid5QhoBxaXN7lCGbcQjPQLzKWCpNBJ2Ri6 nUNgje+sKcpP6MwjAD1QYZj1fYaBfvz8ARC+nEekw+Hv3Fn7a6C1U/R9OV/G5tw3bwUQ 1HdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gZGzocD7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h11-20020a63530b000000b0038648023487si14441159pgb.799.2022.04.05.18.25.40; Tue, 05 Apr 2022 18:25:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gZGzocD7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377322AbiDENM7 (ORCPT + 99 others); Tue, 5 Apr 2022 09:12:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344206AbiDEJSi (ORCPT ); Tue, 5 Apr 2022 05:18:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 075FBA0BD3; Tue, 5 Apr 2022 02:05:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 984E6614E4; Tue, 5 Apr 2022 09:05:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4F75C385A0; Tue, 5 Apr 2022 09:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149536; bh=P3NtWkh9h3XTIlElB6Qko8BGssaTAw2AjqJ3aVe94Us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gZGzocD7msL+90XsfgPs2yHG/4Mnt3nToZPCAhkUdxovaCXvDHWnXvY/jrg4TfMAf BpDlVxvuKgHp2pUziQGNXg42MbqCaNbSNC+/RWzmwAIhRTOgLFCb1P2/KFYJxTlc9M JSlqS6GpfFBJua/8do8NtY++Anm+yPM8gkPE+o6M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Luis Chamberlain , Sasha Levin Subject: [PATCH 5.16 0749/1017] lib/test: use after free in register_test_dev_kmod() Date: Tue, 5 Apr 2022 09:27:42 +0200 Message-Id: <20220405070416.493713880@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit dc0ce6cc4b133f5f2beb8b47dacae13a7d283c2c ] The "test_dev" pointer is freed but then returned to the caller. Fixes: d9c6a72d6fa2 ("kmod: add test driver to stress test the module loader") Signed-off-by: Dan Carpenter Signed-off-by: Luis Chamberlain Signed-off-by: Sasha Levin --- lib/test_kmod.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/test_kmod.c b/lib/test_kmod.c index ce1589391413..cb800b1d0d99 100644 --- a/lib/test_kmod.c +++ b/lib/test_kmod.c @@ -1149,6 +1149,7 @@ static struct kmod_test_device *register_test_dev_kmod(void) if (ret) { pr_err("could not register misc device: %d\n", ret); free_test_dev_kmod(test_dev); + test_dev = NULL; goto out; } -- 2.34.1