From nobody Sun Feb 8 06:35:49 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0FC2FA373D for ; Sat, 22 Oct 2022 08:25:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229907AbiJVIZY (ORCPT ); Sat, 22 Oct 2022 04:25:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233621AbiJVIW1 (ORCPT ); Sat, 22 Oct 2022 04:22:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8C623B956; Sat, 22 Oct 2022 00:59:13 -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 ams.source.kernel.org (Postfix) with ESMTPS id 597F3B82DFA; Sat, 22 Oct 2022 07:59:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B47DC433D6; Sat, 22 Oct 2022 07:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425552; bh=vu7rJYj1z+XfoxBx4lR0BrFlu16v+YMPOdlO7pyXxkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a1XiWn27v3kSFkQTfDxiw0z0eaZQ/jnqlo8kURX0UtiEHhxDZ0i5bIxvm4vg3jNoW q2+QMxaLMJmZ4zc67brD4MyLXGoeywjq6h473os0xsdjL9a49+aIc5ypVyemB9VBkB XlNNuUrL7cLtPTg67eIR1FJmT5UpHscc2hOilj6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Dobriyan , Aaron Tomlin , Luis Chamberlain , Linus Torvalds , Sasha Levin Subject: [PATCH 5.19 539/717] module: tracking: Keep a record of tainted unloaded modules only Date: Sat, 22 Oct 2022 09:26:58 +0200 Message-Id: <20221022072522.179159829@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aaron Tomlin [ Upstream commit 47cc75aa92837a9d3f15157d6272ff285585d75d ] This ensures that no module record/or entry is added to the unloaded_tainted_modules list if it does not carry a taint. Reported-by: Alexey Dobriyan Fixes: 99bd9956551b ("module: Introduce module unload taint tracking") Signed-off-by: Aaron Tomlin Acked-by: Luis Chamberlain Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- kernel/module/tracking.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/module/tracking.c b/kernel/module/tracking.c index 7f8133044d09..af52cabfe632 100644 --- a/kernel/module/tracking.c +++ b/kernel/module/tracking.c @@ -21,6 +21,9 @@ int try_add_tainted_module(struct module *mod) =20 module_assert_mutex_or_preempt(); =20 + if (!mod->taints) + goto out; + list_for_each_entry_rcu(mod_taint, &unloaded_tainted_modules, list, lockdep_is_held(&module_mutex)) { if (!strcmp(mod_taint->name, mod->name) && --=20 2.35.1