From nobody Sat Jul 25 02:34:54 2026 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2156363C7F for ; Mon, 20 Jul 2026 12:16:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784549808; cv=none; b=FGSp1uS//PGYby/djpG8fT1YRPZdRaqAm6ReeplzLymhH0SKSzCXrRs0ooxM8wTUdE1zKkVU53xXuiMJ7z0Nv+fyv+Z6mkGCfsxoYcB78t2VS49OFujpobv6lWT+16ODM1tB1i86eFwNOD4sBKLSfAlpkZxhgTf1Y81RcrWfAEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784549808; c=relaxed/simple; bh=3HGOA6VhjvGyvWPdk6WGIWbxQtwwbNPJzqlF2eKCGOg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tH53sbw0GUyA2XMuzx2lC6gW+BCh060ytgtNPyWIkGiA65XI64Z7GH4XKM2LX33Wqo2hixkUHZbvGLTgoLNIU5GVxnsWXwomJKC2HK76bNj4nJ51nND27ik6H6TvUtU6TXLeAqM26XJnk+SilW5K3g8Fa7rkazTSz2xuKCq6luA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=SM1E6Z6i; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="SM1E6Z6i" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-49555a0e68bso7882235e9.2 for ; Mon, 20 Jul 2026 05:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1784549802; x=1785154602; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=84k5w20exl8o68gfzi1gN+O6EaVyG4b1i1ghtEpI+Ys=; b=SM1E6Z6iB0xwE5NojYP3o/hlzzkCzpR/7fo1oYffq2yvuLI1l7VmOkv/heW1UtPv1U HdAj+H81qLMA05CWA21BV//JYWZU5yLRAfWvTjL1GaGwlAx+Q2N8vjYmXhkAvYbFxdpH uFRCGha53aKbXlzGVVsbQ0SUQeoPFcthqMeCfFUebp8YPg8UePyYt+GrTEdXQYlfFLKr g5RdTK/gLYNwzexhT1QTVCUPFfJwJvvvbMPbzyFTG1hODmd3DMbEbJIxxi8aU7NxJDEz sCl1z1ZL+dIok4CbyuUwDb8eUSbCi6xbLbkST4C/+xdCrEKsPwH9w5iP0ulfkUTVWY/8 KNPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784549802; x=1785154602; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=84k5w20exl8o68gfzi1gN+O6EaVyG4b1i1ghtEpI+Ys=; b=mdB30raIQp3nWyX/0nC00WuYdCBFC0KnM63sG82KbmM2BU80V3JfTwFKLZDwhla1EY mNoz0UGtHM7zHy6MsRhpFVMNqXslNUJ9f7Amkocn51mqbdiGOpX3IuI/G0/EP6BwAYhU Upmbloekr5O9kUFx6KufQmmKbUoKlo85Rp9JSLGZ1JNH/h0vP6xnWGHA+pwBupDSQGHr HDRGfiWtzFJtZ3HfSSFmvOJ8iTLF1B1PyKVqogMTPhasiEe/0H01wuwnf/2gay2lfCQ1 91nCU719OFDlmxqU094TX3cgJP1VjkRE+6nzIxmMXnixyqaWlzZfPhft3sHTcSBlizWD rWjQ== X-Forwarded-Encrypted: i=1; AHgh+RrMq29GnGO7jLsM8k5IW11y7inasmDaMt2WYy+5ioSmtsQvBTq6a5TZHfi3UVysnqG0/nfNuBPVLxwZNcU=@vger.kernel.org X-Gm-Message-State: AOJu0YzjshzGpzKd3AdASP4piOLKLdcIibrxuEZZGs7CvfyAgk2+6m6I dBEbCf8awXVpGrbdVIxZ2wTXCcHoyNvF1mX7x+6Vi/5jKRwXdS7qt9JUT/zmgeLrFmY= X-Gm-Gg: AfdE7cljYOEQG8Z+GcI13NCefJNKZ2fRhy7MRqAVRjzh/aNrmaQpKgnL1UeGg+/6AY5 7aPq2a8EKmQu66RkELXuhTzsfctB5czDtTYdtZuPu7Cg4Ad4LNtYl+XO7CyDChObjWKO/dMQKm7 5no44G8x/n+A+IPYFFRT3kyU1VsrM9WqkKuQHN/AZ+/aLfXGUAK6mZEas5P+WlZy6U1H6wLaGv0 /Z+vWRFdnRfB6TPapBm/iJ9JLmUrrqWSy6/oo7RvxXf2OGMKl/Kn0LVyioiUQIV187ybcFRD0N1 cSto6WquZ/4o6FE3mHgIEKMCZIesMp1LCPryQsiYrCz4x5NbvgPWbjFNs1FCFWYv7d/tvORH+PP JMMgFaSJ8m30Mr02htckhHM/bWGl0HBW/pxXcZQQahUXjv+5yv0hWEO8PBPLevOVsDkXrrcNpTW /2K53iuF89 X-Received: by 2002:a05:600c:19cd:b0:493:f764:1f69 with SMTP id 5b1f17b1804b1-4954a3d0889mr169559705e9.8.1784549801848; Mon, 20 Jul 2026 05:16:41 -0700 (PDT) Received: from zovi.suse.cz ([2001:af0:8000:1409:193:86:92:181]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f63ed1911sm31424338f8f.22.2026.07.20.05.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 05:16:41 -0700 (PDT) From: Petr Pavlu To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen Cc: Aaron Tomlin , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] module/dups: Fix use-after-free in kmod_dup_req lifetime handling Date: Mon, 20 Jul 2026 14:15:26 +0200 Message-ID: <20260720121621.750661-2-petr.pavlu@suse.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260720121621.750661-1-petr.pavlu@suse.com> References: <20260720121621.750661-1-petr.pavlu@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The kmod dups code uses RCU to ensure that a kmod_dup_req instance is freed only after it is no longer referenced. When releasing an instance, the kmod_dup_request_delete() function removes the kmod_dup_req from the dup_kmod_reqs list, waits via synchronize_rcu() and finally frees it. However, this doesn't work correctly because parallel users referencing the instance in kmod_dup_request_exists_wait() don't enter an RCU read-side critical section. This can result in a use-after-free. The kmod_dup_request_exists_wait() function may need to hold a valid reference to a kmod_dup_req instance across a blocking wait until the corresponding modprobe command completes. This makes it unsuitable for RCU. Fix the issue by changing the lifecycle management of kmod_dup_req to use reference counting. Fixes: 8660484ed1cf ("module: add debugging auto-load duplicate module supp= ort") Signed-off-by: Petr Pavlu --- kernel/module/dups.c | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/kernel/module/dups.c b/kernel/module/dups.c index 1d720a5311ba..e1828e865edd 100644 --- a/kernel/module/dups.c +++ b/kernel/module/dups.c @@ -30,6 +30,7 @@ #include #include #include +#include =20 #include "internal.h" =20 @@ -38,13 +39,12 @@ static bool enable_dups_trace =3D IS_ENABLED(CONFIG_MODULE_DEBUG_AUTOLOAD_= DUPS_TRACE); module_param(enable_dups_trace, bool_enable_only, 0644); =20 -/* - * Protects dup_kmod_reqs list, adds / removals with RCU. - */ +/* A mutex-protected list of active kmod requests. */ static DEFINE_MUTEX(kmod_dup_mutex); static LIST_HEAD(dup_kmod_reqs); =20 struct kmod_dup_req { + refcount_t refcount; struct list_head list; char name[MODULE_NAME_LEN]; struct completion first_req_done; @@ -53,12 +53,24 @@ struct kmod_dup_req { int dup_ret; }; =20 +static void get_kmod_req(struct kmod_dup_req *kmod_req) +{ + refcount_inc(&kmod_req->refcount); +} + +static void put_kmod_req(struct kmod_dup_req *kmod_req) +{ + if (refcount_dec_and_test(&kmod_req->refcount)) + kfree(kmod_req); +} + static struct kmod_dup_req *kmod_dup_request_lookup(char *module_name) { struct kmod_dup_req *kmod_req; =20 - list_for_each_entry_rcu(kmod_req, &dup_kmod_reqs, list, - lockdep_is_held(&kmod_dup_mutex)) { + lockdep_assert_held(&kmod_dup_mutex); + + list_for_each_entry(kmod_req, &dup_kmod_reqs, list) { if (strlen(kmod_req->name) =3D=3D strlen(module_name) && !memcmp(kmod_req->name, module_name, strlen(module_name))) { return kmod_req; @@ -87,10 +99,10 @@ static void kmod_dup_request_delete(struct work_struct = *work) * just returning 0. */ mutex_lock(&kmod_dup_mutex); - list_del_rcu(&kmod_req->list); - synchronize_rcu(); + list_del(&kmod_req->list); mutex_unlock(&kmod_dup_mutex); - kfree(kmod_req); + + put_kmod_req(kmod_req); } =20 static void kmod_dup_request_complete(struct work_struct *work) @@ -129,6 +141,7 @@ bool kmod_dup_request_exists_wait(char *module_name, bo= ol wait, int *dup_ret) if (!new_kmod_req) return false; =20 + refcount_set(&new_kmod_req->refcount, 1); memcpy(new_kmod_req->name, module_name, strlen(module_name)); INIT_WORK(&new_kmod_req->complete_work, kmod_dup_request_complete); INIT_DELAYED_WORK(&new_kmod_req->delete_work, kmod_dup_request_delete); @@ -161,10 +174,12 @@ bool kmod_dup_request_exists_wait(char *module_name, = bool wait, int *dup_ret) * keep tab on duplicates later. */ pr_debug("New request_module() for %s\n", module_name); - list_add_rcu(&new_kmod_req->list, &dup_kmod_reqs); + list_add(&new_kmod_req->list, &dup_kmod_reqs); mutex_unlock(&kmod_dup_mutex); return false; } + + get_kmod_req(kmod_req); mutex_unlock(&kmod_dup_mutex); =20 /* We are dealing with a duplicate request now */ @@ -194,7 +209,7 @@ bool kmod_dup_request_exists_wait(char *module_name, bo= ol wait, int *dup_ret) * calls bail out right away. */ *dup_ret =3D 0; - return true; + goto out; } =20 /* @@ -209,12 +224,14 @@ bool kmod_dup_request_exists_wait(char *module_name, = bool wait, int *dup_ret) TASK_KILLABLE); if (ret) { *dup_ret =3D ret; - return true; + goto out; } =20 /* Now the duplicate request has the same exact return value as the first= request */ *dup_ret =3D kmod_req->dup_ret; =20 +out: + put_kmod_req(kmod_req); return true; } =20 @@ -224,6 +241,10 @@ void kmod_dup_request_announce(char *module_name, int = ret) =20 mutex_lock(&kmod_dup_mutex); =20 + /* + * Find the entry previously added in kmod_dup_request_exists_wait() + * that is owned by the current task. + */ kmod_req =3D kmod_dup_request_lookup(module_name); if (!kmod_req) goto out; --=20 2.54.0 From nobody Sat Jul 25 02:34:54 2026 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92D613FCB39 for ; Mon, 20 Jul 2026 12:16:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784549810; cv=none; b=TrqU2Ss8g1IRQuCtDdSCctKiRP3WcWqc/z/dd3FtmmOBHUokKzw670TDNeapAYGtfXa0UZS57ZX3DyXZc0lsIBvY7/60sStA1UQdc5cqqFnFPYlT96D/yFFM065tRtYAzVZb0B3HVQZD2XL1d1T663yQmUcQo1m5JkWmmHbNQMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784549810; c=relaxed/simple; bh=I27ZSoF/OSRvlq21arNznTNvwbY86IMVngIZDjHTjxw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mNuh7PpvDyqSaqzkJipn7dJ4NmzWxR6NJplasGvCGaz6dFGaaB2tuseBRouySR72zUbdRHEzi2sK7EqcuCstU5nbpkA3DPPyNOA1ThRf2Z8pwrcto7P22URLAiqIK6bRtI2Bid4FYTHVxXSSi+pxHl3ANuEhs5fEsXP3kPaUp14= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=MAtnohK7; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="MAtnohK7" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-49557167508so15467305e9.1 for ; Mon, 20 Jul 2026 05:16:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1784549802; x=1785154602; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ZWDVnnTRs9ulUtHM6zxZ6aVf5x++4G1ngbdh0GBn31o=; b=MAtnohK7vAtv0l7JxtVdU/rQBMALWosUrSzCEQJ6UwwVauQ0iGeT1hOFw+gjEpK2Jh b+iwC6xa87N8auXSXbP1DEBJ89fbWRr+g8e31RFaBF6vthhIT/o3tvU3siTsdMKqkexs eV1mkauK4+d0o8pgqiX0dHk6dY8gNOBJQbsDlEnbtRYaqBIHKQUpIar6/fT8uJQclvJr 19b0PZy77XQJVQNVv6SJPOyLHfL4IWOdSPuvSlomWalLx/7kdCvNqT0A4aRhwTGW/cVF oTgnMXx+8CV1bwKPFEvK97nkTer8dFczAgZXWwg9oPswNheWBHtp1zQAXYU2xkW3jqxn C33A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784549802; x=1785154602; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ZWDVnnTRs9ulUtHM6zxZ6aVf5x++4G1ngbdh0GBn31o=; b=N3AXG8w/wyC2viVqfNhus8RVyndn9D7cv1b7UOOAz4DRDTo6soGhCZEr+LSoZNsqey v483R93lNGBFsHMW2jG0k2u14HIjVa6cKVbDc14x2Ml+t8wbxauWhZrBrBrA5orO91l7 knYvInDUcaohjcsCy7nbBuz+me6BtmHnn4484Q3ImOF/9oUGCWHVp4E2PA7JYuiQywxU /SJzYqWQ13aPKcL42KWKixVGubNoH/+jffgB20qese9N86WGGUi3LaO/ORzkmTpEkgqe Mn8rfHi1Q3Ifm6lKMMAFgL/K78U4irLFXMojWdPZ5mtGWFi73BH0ggynprdMCk/e4Qd/ e3lA== X-Forwarded-Encrypted: i=1; AHgh+RrN8YqTduBKKRSEgeBbsUWyVxXUicITcZ6PL9sTddkm0begD3IvP2NbnNJSp0FU6bRi/KFtgx8WIKiearA=@vger.kernel.org X-Gm-Message-State: AOJu0YyQHXvZHpTKt5TcUVfwxWLo2fseuEa+AjX/qLyfu8li5bKFVB87 zmzqgZJqPizdnLWKJURNsDhGt7fZLM9moKuhnd+HfCavGnZctTiyXrF+8CDHNbHkFZs= X-Gm-Gg: AfdE7ckdJ0GsxcjzT9CL8k2hnYWXcbQcNNp1KtvcXmpCyFdu4VMWRXLg3iTxU5eF5sT jgxFbSzt65JsbEdjq9vK+fTfIti8Ccb5YtR45QGln/uYAcmWIiJBU1s3KYbj4uNl0dq/yZICGYX TL+PMo85JbwfmBvr4uAgnfxnzwKAp3zRxu+z7I0Po5mmUNK53xIfeoYrCrPnLkAW5q4hW3J/hQs gFqSccLCkh6Uvjr+qMQBhb0/ELPyoBo1ZBTc2znRAb1qYUHDf4g51E4T7R/bJgqGUskF0gGZmWa X3oiSKsbqAtN0Aths01s/gke+8SbIXKbfm6Z9PzvBs0bXhZYVdQCCb/EAZNqPB9HDlBCbGRfQ+i 3eVttH+jjn3vD2uhvYCBe6PG2CMoD+vtTh6/7lg4ggnsHMaXHc96uL7WzoJhGT73mUKGfIzQfUA == X-Received: by 2002:a05:600c:b85:b0:495:5365:c0d1 with SMTP id 5b1f17b1804b1-49553d85ea0mr100454075e9.14.1784549802399; Mon, 20 Jul 2026 05:16:42 -0700 (PDT) Received: from zovi.suse.cz ([2001:af0:8000:1409:193:86:92:181]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f63ed1911sm31424338f8f.22.2026.07.20.05.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 05:16:42 -0700 (PDT) From: Petr Pavlu To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen Cc: Aaron Tomlin , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] module/dups: Inform duplicate requests about the result directly Date: Mon, 20 Jul 2026 14:15:27 +0200 Message-ID: <20260720121621.750661-3-petr.pavlu@suse.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260720121621.750661-1-petr.pavlu@suse.com> References: <20260720121621.750661-1-petr.pavlu@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When kmod_dup_request_announce() announces the completion of a request_module() call to duplicate waiters, it queues a work item to invoke kmod_dup_request_complete(), and only that function calls complete_all(). This adds an arbitrary delay that is unnecessary and provides little benefit. Call complete_all() directly from kmod_dup_request_announce() instead. Signed-off-by: Petr Pavlu --- kernel/module/dups.c | 50 +++++++++++--------------------------------- 1 file changed, 12 insertions(+), 38 deletions(-) diff --git a/kernel/module/dups.c b/kernel/module/dups.c index e1828e865edd..f0bdd7560d7e 100644 --- a/kernel/module/dups.c +++ b/kernel/module/dups.c @@ -48,7 +48,6 @@ struct kmod_dup_req { struct list_head list; char name[MODULE_NAME_LEN]; struct completion first_req_done; - struct work_struct complete_work; struct delayed_work delete_work; int dup_ret; }; @@ -105,29 +104,6 @@ static void kmod_dup_request_delete(struct work_struct= *work) put_kmod_req(kmod_req); } =20 -static void kmod_dup_request_complete(struct work_struct *work) -{ - struct kmod_dup_req *kmod_req; - - kmod_req =3D container_of(work, struct kmod_dup_req, complete_work); - - /* - * This will ensure that the kernel will let all the waiters get - * informed its time to check the return value. It's time to - * go home. - */ - complete_all(&kmod_req->first_req_done); - - /* - * Now that we have allowed prior request_module() calls to go on - * with life, let's schedule deleting this entry. We don't have - * to do it right away, but we *eventually* want to do it so to not - * let this linger forever as this is just a boot optimization for - * possible abuses of vmalloc() incurred by finit_module() thrashing. - */ - queue_delayed_work(system_dfl_wq, &kmod_req->delete_work, 60 * HZ); -} - bool kmod_dup_request_exists_wait(char *module_name, bool wait, int *dup_r= et) { struct kmod_dup_req *kmod_req, *new_kmod_req; @@ -143,7 +119,6 @@ bool kmod_dup_request_exists_wait(char *module_name, bo= ol wait, int *dup_ret) =20 refcount_set(&new_kmod_req->refcount, 1); memcpy(new_kmod_req->name, module_name, strlen(module_name)); - INIT_WORK(&new_kmod_req->complete_work, kmod_dup_request_complete); INIT_DELAYED_WORK(&new_kmod_req->delete_work, kmod_dup_request_delete); init_completion(&new_kmod_req->first_req_done); =20 @@ -246,23 +221,22 @@ void kmod_dup_request_announce(char *module_name, int= ret) * that is owned by the current task. */ kmod_req =3D kmod_dup_request_lookup(module_name); + mutex_unlock(&kmod_dup_mutex); + if (!kmod_req) - goto out; + return; =20 kmod_req->dup_ret =3D ret; =20 + /* Inform all the duplicate waiters to check the return value. */ + complete_all(&kmod_req->first_req_done); + /* - * If we complete() here we may allow duplicate threads - * to continue before the first one that submitted the - * request. We're in no rush also, given that each and - * every bounce back to userspace is slow we avoid that - * with a slight delay here. So queueue up the completion - * and let duplicates suffer, just wait a tad bit longer. - * There is no rush. But we also don't want to hold the - * caller up forever or introduce any boot delays. + * Now that we have allowed prior request_module() calls to go on + * with life, let's schedule deleting this entry. We don't have + * to do it right away, but we *eventually* want to do it so to not + * let this linger forever as this is just a boot optimization for + * possible abuses of vmalloc() incurred by finit_module() thrashing. */ - queue_work(system_dfl_wq, &kmod_req->complete_work); - -out: - mutex_unlock(&kmod_dup_mutex); + queue_delayed_work(system_dfl_wq, &kmod_req->delete_work, 60 * HZ); } --=20 2.54.0 From nobody Sat Jul 25 02:34:54 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CB93409131 for ; Mon, 20 Jul 2026 12:16:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784549810; cv=none; b=RVsk7PRhGWEY+dhRuV/BoY5w2051nHNux48TzdFOZti7Z8hFjGrmguWlBk+ANjG7XPkCaqoNfHbZBGgB5zou+5oK6zhEaSdXVFxpJ7EFSOXKsuPkbYzX5WEUqJ8bRGGUP5I32R9eL9gJ4FKm9EtnweG2SdfD4vl2N+5EOEY79UQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784549810; c=relaxed/simple; bh=y7QvP9K6quV4Gyq9GwqoIKBapnIuTBwzwL8TWMBSwdk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ohDVb5hzLHhUsG27N7OkN7AvmwW0Wgl7Yis9Fld3Lxp49/8P/CEhdNltHwvxVGk0kTv3Bs6j+IhsXGje+VHwUsvnuIs3lkeiQ0RJ5hgmHRXdGHjdJglc+zgrxX1Bi+6vr59a6cxYnpitPKf6Gc2IWX648DWG0LC1tj7cutf2Ejw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=F3ad+SXI; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="F3ad+SXI" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-49557167508so15467405e9.1 for ; Mon, 20 Jul 2026 05:16:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1784549803; x=1785154603; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=FP9BawSk4EnMBpCTI/eZ7+cvzr/uqbM9j4RMitQlXio=; b=F3ad+SXIHcfhbwT1po3Bti0ZvyAcCegBxB9IewnQNPi9QJ1C0iLK9ile7drvuJWjMz nwtDiynEUMuAx0/Nwc131QSmTs4hysdqHkozJN7wPW19c/CdvOt3jsGUVwkQzRHeYj1C YSsHDIsVdzK1cbzOzXW3xhp7+ATjwlQOMCBXEZZhs6D9FwC4XGeEcgfVjb+Tku05yCMY lI33xcvDN+XEtexz5NMG/gZtobX1wEsP84WuYiQov2OI+j1vo9lBvbLHH/J8nKr5sUX1 n2OqwhhDE7KGZbftTZ4/QJFZNXdnLlYsaBxm9VjCe2s1LETco1V3Rkjzk5dMVC4Wdu4Q RzDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784549803; x=1785154603; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=FP9BawSk4EnMBpCTI/eZ7+cvzr/uqbM9j4RMitQlXio=; b=PYSKsm0MRMDYw2PW8vHRmfipI2U9KNgzqzb7qSUvhy3LAmryqmxDRsZxN4kcUi2796 01wCfZKerBego5BqLk64aFs4e13uggioNjYSfOAQua42654DpGnWzKZ02btmlkUHVzto MhMZ9KesbQZnl//Rf0vdz+wPWX82Q7C52B0MqN7ICiyosbkhhzGLrfpF+9SGQm6/ab7p 0HDVHu7LqqTLwtaPDzsI1ugbgXSEpTWFF7Y2ZFf3z+M8MN3hTqGoc9/2jpQO69YQk5GT kjddB7OZPYwjdAMU/SA9ybLOZviZ+B5RvLX2LnOsyatNDy9CQqVFJfZuuEBUzI4j1p3v +xmQ== X-Forwarded-Encrypted: i=1; AHgh+RpvSnvEQ16RYKlXLPHGxBhKt616j2HWZ7M7BWDawKAREjT26jGyNqK3SnRvg21RLZHShlj5c//r1UOBu6s=@vger.kernel.org X-Gm-Message-State: AOJu0YzKKGh2oTdwlc5qvIHSIdSXE+9sTgCaH/2kypFb+qlMFuK58mn1 ohWttZW5SVtqtcPMI+N2jUmJFdLr0nGkw0rZCNxj1H8NmW+mMKOIs6k2JF7msxgEcpkI37iIjme 6bghFiUs= X-Gm-Gg: AfdE7cnpmoUVNUsLr56WUOHLlWKOMldpW0n2NH6+bviryNCG2c2DEckewKEuOkGt1rM VmPeS7hKhfTbjdGK/+dXAHuK2+eQNXAb/2uY6k5uXy9AS4szrr8nv/fmBtfyK0qBqTwHmpqTTTG WQROTSVFfkUE2I4ThaveZaNfFpyDZWf2nA4fWMkcQS7WbrqcruPkdUJQBeY9UWSt1aRp9OiilEt HSgQZ0KhKwa36HuD/9tf1KsQH4g7LHdbhWCmWUvoe+Y/TLEtpiCWbedbcXFMHsV5KpjfX46yV9C 8i87eSKOjduGamRWO0fyNWh9GEMZd2L1VsLo9bli7dS+cJeKC7qxDu13Q/sBJkAWn5uCp3eoh0Q NaaTBHySdT+4PoafAkGtQY+3fuMKvvgPkTBnKpSPP7XUw6zX/sD5eABvlXNX92om+EoSUwXXB7M yH+zYO9hTJ X-Received: by 2002:a05:600c:6298:b0:493:c182:6b08 with SMTP id 5b1f17b1804b1-4954a5125a0mr159730355e9.36.1784549802964; Mon, 20 Jul 2026 05:16:42 -0700 (PDT) Received: from zovi.suse.cz ([2001:af0:8000:1409:193:86:92:181]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f63ed1911sm31424338f8f.22.2026.07.20.05.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 05:16:42 -0700 (PDT) From: Petr Pavlu To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen Cc: Aaron Tomlin , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] module/dups: Use scoped guards for kmod_dup_mutex Date: Mon, 20 Jul 2026 14:15:28 +0200 Message-ID: <20260720121621.750661-4-petr.pavlu@suse.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260720121621.750661-1-petr.pavlu@suse.com> References: <20260720121621.750661-1-petr.pavlu@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Using scoped guards for kmod_dup_mutex shortens the code and clarifies where the lock is taken in kmod_dup_request_exists_wait(). Signed-off-by: Petr Pavlu --- kernel/module/dups.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/kernel/module/dups.c b/kernel/module/dups.c index f0bdd7560d7e..a62619ec057e 100644 --- a/kernel/module/dups.c +++ b/kernel/module/dups.c @@ -97,9 +97,8 @@ static void kmod_dup_request_delete(struct work_struct *w= ork) * kmod. The inneficies there are a call to modprobe and modprobe * just returning 0. */ - mutex_lock(&kmod_dup_mutex); - list_del(&kmod_req->list); - mutex_unlock(&kmod_dup_mutex); + scoped_guard(mutex, &kmod_dup_mutex) + list_del(&kmod_req->list); =20 put_kmod_req(kmod_req); } @@ -122,10 +121,13 @@ bool kmod_dup_request_exists_wait(char *module_name, = bool wait, int *dup_ret) INIT_DELAYED_WORK(&new_kmod_req->delete_work, kmod_dup_request_delete); init_completion(&new_kmod_req->first_req_done); =20 - mutex_lock(&kmod_dup_mutex); + scoped_guard(mutex, &kmod_dup_mutex) { + kmod_req =3D kmod_dup_request_lookup(module_name); + if (kmod_req) { + get_kmod_req(kmod_req); + goto dup_req; + } =20 - kmod_req =3D kmod_dup_request_lookup(module_name); - if (!kmod_req) { /* * If the first request that came through for a module * was with request_module_nowait() we cannot wait for it @@ -140,7 +142,6 @@ bool kmod_dup_request_exists_wait(char *module_name, bo= ol wait, int *dup_ret) if (!wait) { kfree(new_kmod_req); pr_debug("New request_module_nowait() for %s -- cannot track duplicates= for this request\n", module_name); - mutex_unlock(&kmod_dup_mutex); return false; } =20 @@ -150,13 +151,10 @@ bool kmod_dup_request_exists_wait(char *module_name, = bool wait, int *dup_ret) */ pr_debug("New request_module() for %s\n", module_name); list_add(&new_kmod_req->list, &dup_kmod_reqs); - mutex_unlock(&kmod_dup_mutex); return false; } =20 - get_kmod_req(kmod_req); - mutex_unlock(&kmod_dup_mutex); - +dup_req: /* We are dealing with a duplicate request now */ kfree(new_kmod_req); =20 @@ -214,14 +212,12 @@ void kmod_dup_request_announce(char *module_name, int= ret) { struct kmod_dup_req *kmod_req; =20 - mutex_lock(&kmod_dup_mutex); - /* * Find the entry previously added in kmod_dup_request_exists_wait() * that is owned by the current task. */ - kmod_req =3D kmod_dup_request_lookup(module_name); - mutex_unlock(&kmod_dup_mutex); + scoped_guard(mutex, &kmod_dup_mutex) + kmod_req =3D kmod_dup_request_lookup(module_name); =20 if (!kmod_req) return; --=20 2.54.0 From nobody Sat Jul 25 02:34:54 2026 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 229E53FC5A6 for ; Mon, 20 Jul 2026 12:16:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784549812; cv=none; b=FGi0Gv4ckiKNsgqw34LbMV5rCluo+XnYGEv2UDMI6wKU/QqI/S01+QcYSL4zEOql3B9DYkaJySvHJTAtWTW4vosr87bds+mt6ocvT4VoBRpjcP427o1RZaSVHwm/Bsrg/4lGYRYmLsMay3u1Yb5CqWvmdw8ESg/aI5F3hjZmQcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784549812; c=relaxed/simple; bh=GNBE2liKm+5zfWQReyex3ayP0llhtabHxVp/9yZvKas=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IcyRLbjMeKsP6Y1k0BfTUXuVreJZe+LiuyNxr0dNgIioKMlTMNzKrYEZYvyet8D5SLSYjHU38cl8zsaAZ9X0IgooKm1NB2UFHAb51W9pbH+VHmLbQ3s2zCvBSPUFLEvjHzHGGuwq5yvSLhk3bzTtDsqBwG+mlffYrbcNHsVH658= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=GYORA8pM; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="GYORA8pM" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-47f7444576cso790315f8f.0 for ; Mon, 20 Jul 2026 05:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1784549803; x=1785154603; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=7/LTElIKYlWpTL73YwXYvJE766LImzThDSV5rDtI7NY=; b=GYORA8pM/IKUnD+g9xwC67LWFvvB7lM3eS5mqxTYnhRHt/0eCTbLlxta7uGCIljK1Y CxcsRuzsDF7TLvr4jUDCQ0hZe07+5mcXaMa4MkDvNieUoqdb5mGnrILCX5FHQ8rF2SY2 5Ss/xJe7H2WDUGOi5DDIBUkj8QCa8ExSZv8kISq70XsIU5J/iz/MLvhgTGhp4MLY5nQ7 I1cV0EJqo9nS/EGPoH7bfXcaPaM8720QyJ2chJgxwwItVeVj4VMGhTd9RK9lAArT8Vyf GmYbnnUhjOybZcwZaCdXhkr916nnKSs53JebGmamJxQm2/BIeg4PxjCpthqUvmN1/dO3 0Utg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784549803; x=1785154603; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=7/LTElIKYlWpTL73YwXYvJE766LImzThDSV5rDtI7NY=; b=mxD+NjP3hCZDz1eqQMMV577kx7sa6e5PMm0Df0Pxdy3Dv0f4GdVXWkN5Qx6pFWySUt 3XMriLudE3Uqr1U3Ky3VBHvMSwJ7Y/gA57fMo+l8FhuoQnRMbuJJriu/+Lyz2AK+tCVx 3cPRKT7ADmMI2x380FUPXgcJ7de5CEGv/jJZNAjP7gWhlCwmq7X66y2sIqnDVsr/hjW2 S1BPdtPKM2ZswSeXRFtenquMOaPlmJmazXi4f5rkVEuBwEh8UwBQPIOO1rA2OObMWhB8 bskVhFYkt4nNWsVQnf4W7Vhgnh8IPh3/r7Hr2m3HnkXPSRzCAddDQb8+cuGzzL/xUh73 71NA== X-Forwarded-Encrypted: i=1; AHgh+Rp1bFBPi8dYGDVVwWvp80D5Hnk2Fevne4dvpQRz5L1WNqLKLt+hwOB/98uPTeewraDSGReBzgh4lZMlvxc=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+wKbCCGKJj86kAmuQsu8uIIj/hcrQU0uk3PctNyVFZ1VK3Y8s DcEL5Yv7z5irUu1Cg1rbHVb3X0eJzrAHAdKc3OXKXW5pSPFVc0zEtXfSS+ExVf5S6p8= X-Gm-Gg: AR+sD10Wj1tXnAV/gbM7H6x/Mi8yh3OrfQyWZrjKS2En5hsxmBgAg43tXClc+P0SyxA pbUXdlqTSNExWIhsOp/cDe31tA/o0CmS9beP9+zrwBHL3mJmLZJ29AuC5utg+SGrb8sk9P/hxLJ iVxUc8P3+ehWO5B09123pr9spPKIPBMbLRAdf+Bam+hXdPTmRPEiG4w9qebNYtonC7PmC8+HAYO JJvHB5uTbb10d42J+K4krOwOm6Y34CgwreGsV6doTZmxyEr9Yypj710gTHR0xCo8GnRwmvI3vxM WhJxx+NhXYjeruiZg1oVXz9NjfjBMwyGAOsoD5dOwI2emyOu6w6s/6G+M+mYnkIVqrVzo6/0SWk 0Go5opNibktCKFm62v6as6Fi2r7xNxMWmtj0er8lSCVQynGiC9i6AwXyfT4Qanucpkv4rjm+R8c kwlcE5oxnQ X-Received: by 2002:a05:6000:471d:b0:474:57f0:49f8 with SMTP id ffacd0b85a97d-47f622fecf2mr14974421f8f.4.1784549803601; Mon, 20 Jul 2026 05:16:43 -0700 (PDT) Received: from zovi.suse.cz ([2001:af0:8000:1409:193:86:92:181]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f63ed1911sm31424338f8f.22.2026.07.20.05.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 05:16:43 -0700 (PDT) From: Petr Pavlu To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen Cc: Aaron Tomlin , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] module/dups: Use strcmp() to compare module names Date: Mon, 20 Jul 2026 14:15:29 +0200 Message-ID: <20260720121621.750661-5-petr.pavlu@suse.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260720121621.750661-1-petr.pavlu@suse.com> References: <20260720121621.750661-1-petr.pavlu@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use strcmp() instead of strlen()+memcmp() to compare module names in kmod_dup_request_lookup(), since all strings are NUL-terminated. Signed-off-by: Petr Pavlu --- kernel/module/dups.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/module/dups.c b/kernel/module/dups.c index a62619ec057e..43cec4cec4fd 100644 --- a/kernel/module/dups.c +++ b/kernel/module/dups.c @@ -70,11 +70,9 @@ static struct kmod_dup_req *kmod_dup_request_lookup(char= *module_name) lockdep_assert_held(&kmod_dup_mutex); =20 list_for_each_entry(kmod_req, &dup_kmod_reqs, list) { - if (strlen(kmod_req->name) =3D=3D strlen(module_name) && - !memcmp(kmod_req->name, module_name, strlen(module_name))) { + if (!strcmp(kmod_req->name, module_name)) return kmod_req; - } - } + } =20 return NULL; } --=20 2.54.0 From nobody Sat Jul 25 02:34:54 2026 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6690F41228C for ; Mon, 20 Jul 2026 12:16:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784549812; cv=none; b=AiQVhkYiI1QXgmz0JVK4Bp8Qg/qe63D555Hzbzf1BS+RMOqGriS+LEgyjSM/n+csOMrLefyjAVugVVLw6V+42XZ5tzO1FdaF0sQRP8EkRrxfEnicca0OjCVE6mTQD5eGx/5+92BbNb+tMTrmZU5Yt42mjnUiWQBSBLJc866p710= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784549812; c=relaxed/simple; bh=ZXEpkDFwL/rwUncoDs+qBTzK5HHyoQoZwmumdWwaDWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hrx25OqULwPfqHfjGbRf+/qcejgui15VOj9xcW6kYoyEYpnqRWYx36qw3oolPI8/pseY0oto9NGIafh6f7LocxL2t51INo84rwIICr1nrfhvMtmcuZLWYDA6yjsYgZuBV8SyzzzIXJMIn/7a7XDdpNaIeWsDDW0VyOOn/sWlCm4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=MbKJID2t; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="MbKJID2t" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-4728c12ba97so4989194f8f.0 for ; Mon, 20 Jul 2026 05:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1784549804; x=1785154604; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=E7C+l5bQ28x2ipnVvxZPG22FlExKRkr9Lej+PmmTvr4=; b=MbKJID2t6kp6fMk1nfH1mKZhbmDfLKhUEb6GG86Jbf90QrJmKXWN3N6jNxMqo9YTFU voeYawsMc0TQuUDJq1XJjuLPQt9uMoBAGdA5hqA0C33CdWY0PYyER9EvWEdoXZRhxBdE KnCjKlS4sUAQfvsQIpkLyHrc95++wqhzrtn285V9C+ANh7BLsh8nixQlN3ldPtMbYc8k rkMd7zaGcow9U4t0nRcgy7IYCBpi2gz8bDHRtiJ43X2pNOCs0ArWSeLnicIOsq574HWf nRuVzik/G2jZLd3Mr2cOD+UBxWnv+OpOz+UF6E+uHMNguoZZ+02TJP4WDGvWqjMMxDEy 1j1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784549804; x=1785154604; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=E7C+l5bQ28x2ipnVvxZPG22FlExKRkr9Lej+PmmTvr4=; b=QG2eqwa61wKeOVE5qRrf/f0o3rw2YkmR3T7VlqgPCDbGVdF9zSDYsFpFvQrC3kwhc7 N4Y+j2+rXIRW7f33TIz2JXzJbqu/Fq0bSzLRdEjPaZT63K7J1b5e7pxFPbdI8j2lnovz o6fV4W0L0YsmB4oZasRHFYHXOzzTk6QaCSd4BF01MyzVLV25m+hEOzUDPUsAK4ItO7O2 sNPWOowv6mfpSKT5LV9gBWwmXr52PDSwsoVhumMkjFWWPKPWskc23ZBPEZn+EsjAPAJv 9zqJEp/rl7axq7jTtHBPgNj74f9/INhQJFpDpw+Tszox6/dp5NAI00eWQx5QuKZ6JouA kNRQ== X-Forwarded-Encrypted: i=1; AHgh+RrPxlHPbV73MvnvPXpy8Xon1/hrcxmtDYrTjLK41wU+K2icW075nzTs8p9xuoRb5jWykuTFT6Soi2feqQM=@vger.kernel.org X-Gm-Message-State: AOJu0YxKwwslCjPRGwS/e170DH5K6Ip0jGtJOwky1uby/vpnMUmnl+js G1d7X1IkzCgiJLzVk/31RZnuwPFFKbXrzShpiOuaFxCSDxwnTgcKmK/xsvrvefiJd6I= X-Gm-Gg: AR+sD10Hh/bHIEwasy+Fg7eBcNW58bG0TEjobNNTdvfEdBAtMpxLHwxRMBAIZY99R74 a77mgWyZh3oxZ3KC8ClxprpFixe9A3HMXEOCN8YnN99XU/bvtEv9cKMKZuXJnAvBtkJqPP9wwN3 Qn9+N8NFxGOhv4tpDrqbNvrQClP0HMvrztbuipHU2EEhyysUrfjItnm2HxCBiYLgGBngvqIlF93 cyVSeiN/6ml8yp4lz3YKT7sKZuIXLg4sh9YiVDkvDui1ZGPo9jY+hWcID8kADksgOc75FBoCLuw qB6lFqZCGLHMNw1g256v5mg8Y/egi6qMkYLnNgh7WJaQh1KgVVRMwMTSOUuvVDxuidzcy9meLOd 9WM8tl9gXJRNj14KiTOcJ9chrv0DcJRh3R6w48+4BYZvxBtOI+XIEiYczMGsTU63ubhLZgXiKtw == X-Received: by 2002:a05:6000:2907:b0:470:a7d8:75f5 with SMTP id ffacd0b85a97d-47f6233d406mr15982775f8f.42.1784549804129; Mon, 20 Jul 2026 05:16:44 -0700 (PDT) Received: from zovi.suse.cz ([2001:af0:8000:1409:193:86:92:181]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f63ed1911sm31424338f8f.22.2026.07.20.05.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 05:16:43 -0700 (PDT) From: Petr Pavlu To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen Cc: Aaron Tomlin , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] module/dups: Clean up includes Date: Mon, 20 Jul 2026 14:15:30 +0200 Message-ID: <20260720121621.750661-6-petr.pavlu@suse.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260720121621.750661-1-petr.pavlu@suse.com> References: <20260720121621.750661-1-petr.pavlu@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The kernel/module/dups.c file relies on the following definitions and associated functions: * module_param() -> linux/moduleparam.h, * DEFINE_MUTEX() -> linux/mutex.h, * LIST_HEAD(), list_for_each_entry(), ... -> linux/list.h, * refcount_t, refcount_inc(), ... -> linux/refcount.h, * MODULE_NAME_LEN -> linux/module.h, * completion, complete_all(), ... -> linux/completion.h, * delayed_work, work_struct, ... -> linux/workqueue.h, * lockdep_assert_held() -> linux/lockdep.h, * strcmp(), memcpy() -> linux/string.h, * container_of() -> linux/container_of.h, * scoped_guard() -> linux/cleanup.h, * kzalloc_obj(), kfree() -> linux/slab.h, * pr_debug(), pr_warn() -> linux/printk.h, * WARN() -> linux/bug.h, * TASK_KILLABLE -> linux/sched.h, * HZ -> linux/param.h. Update the file's include list accordingly. Signed-off-by: Petr Pavlu --- kernel/module/dups.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/kernel/module/dups.c b/kernel/module/dups.c index 43cec4cec4fd..76faa662f14d 100644 --- a/kernel/module/dups.c +++ b/kernel/module/dups.c @@ -7,30 +7,22 @@ =20 #define pr_fmt(fmt) "module: " fmt =20 +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include #include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include =20 #include "internal.h" =20 --=20 2.54.0