Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15963649rwd; Mon, 26 Jun 2023 04:02:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4fDkHycVnsdDi9a6s6lAHdYCQ3qHFQS6yxe0xi4DkxqhyfSFPEpmXBiVfB87m/mwDbbQ57 X-Received: by 2002:a17:906:db0d:b0:982:80b7:ad4c with SMTP id xj13-20020a170906db0d00b0098280b7ad4cmr22111609ejb.16.1687777328370; Mon, 26 Jun 2023 04:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687777328; cv=none; d=google.com; s=arc-20160816; b=IDuyQ9IR4Xp53DX9+EjP+zGrHV9oW64qXvNIlc0pdTRkOgwQscOeTqYm6mqSc58b6K zXBZfDimrfhzr6eOHjuBsOLszuxj+aIVBcWLHZ1c1b2SkXZ2379It2eohQFJmlWxQDkr k4FGIURG8/BaIXPF+hSwdGOL9qb0Edarl3ZmsWWCwOtTZDye5qeyRV7jYQ5YF4Y85PlT sRfyFiXZ5IU3sTY/yaKrsxU9cZRrT2yo6NcTSzuP1ck3rRIO0X0bUTPmYD/LGUe5Mb8y vXE9to1RHNIkhNRXAhsvLaaHpqaGgcTXXVgw0hdS3eMNgqRBkkOpAs0ds4h9BVkhXEpB Gk8g== 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 :organization:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=z+HSLECNibzVOo7kYE3yRqNP3uGJcAQpmYEuFSJm/OI=; fh=1jTypjpGUsKe4trrIP5JxHi8HYxRxKg5wQ8OVPRT3hg=; b=xAaRUhS1SGLpszAAZI9qqX5z1WqZBhjpYuyGyjW4Uzm8FkNHpX7Xk5X+a0Oo6qUBHb EQgmqhFgx1DkTtUb1eQ1JSXL6sWv4psUtTHQg0k5BqGEbvgz2doUzImeZj5iJzv99tG2 v+Naymota4DePjs7PmlLh4UmS8NEmPV5yAwsoRvq4KjUuY7bH2uqtUNSSDO28gBnFGqW wMZAb53VXITsXZ/Gp5ma8gHINkRSbhMjewBqhnklgnzHj+/QYcHA7fwycICXZmbH6QD0 +GMx2OdAAMTgQbbmixFHzA70y8z2vZHtklelFBv0y7kcq4dTbt24yCCMEAxSyQE+w5nP QDYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=eWDLaoiI; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w21-20020a17090633d500b0098d290009fesi2735427eja.956.2023.06.26.04.01.43; Mon, 26 Jun 2023 04:02:08 -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=@suse.de header.s=susede2_rsa header.b=eWDLaoiI; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229792AbjFZKdd (ORCPT + 99 others); Mon, 26 Jun 2023 06:33:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbjFZKdb (ORCPT ); Mon, 26 Jun 2023 06:33:31 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97B48172A; Mon, 26 Jun 2023 03:32:55 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 237891F74B; Mon, 26 Jun 2023 10:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1687775574; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z+HSLECNibzVOo7kYE3yRqNP3uGJcAQpmYEuFSJm/OI=; b=eWDLaoiIC8nY2Eyf9HoiKnryKS7ZVt9r0tcTunuPJbaiAa53ryeZM0uuc0tMiA3fYq8YR3 rCi4zO0qHieNqI9B1kbnY14hPP2PfRavqTV8yhnJ+jFqCF1RwwFlE4YsqXtFz5zLqEOq8g WLb25zUXSR3mxFJjc1AEWeAllF54qN8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1687775574; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z+HSLECNibzVOo7kYE3yRqNP3uGJcAQpmYEuFSJm/OI=; b=bMbbCan38BmV4BchYOSRSYuGzmBcYrHYluBk3qG41KG/GATFQDYN7GtQx5vV2VWd6v6W1c vg2XM2ROl8rR2RBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DE9F513905; Mon, 26 Jun 2023 10:32:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VFO4NFVpmWTYDwAAMHmgww (envelope-from ); Mon, 26 Jun 2023 10:32:53 +0000 Date: Mon, 26 Jun 2023 12:32:52 +0200 From: Jean Delvare To: Luis Chamberlain Cc: Michal Hocko , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] module: print module name on refcount error Message-ID: <20230626123252.73dbc139@endymion.delvare> Organization: SUSE Linux X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.34; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 If module_put() triggers a refcount error, include the culprit module name in the warning message, to easy further investigation of the issue. Signed-off-by: Jean Delvare Suggested-by: Michal Hocko Cc: Luis Chamberlain --- kernel/module/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- linux-6.3.orig/kernel/module/main.c +++ linux-6.3/kernel/module/main.c @@ -850,7 +850,9 @@ void module_put(struct module *module) if (module) { preempt_disable(); ret = atomic_dec_if_positive(&module->refcnt); - WARN_ON(ret < 0); /* Failed to put refcount */ + WARN(ret < 0, + KERN_WARNING "Failed to put refcount for module %s\n", + module->name); trace_module_put(module, _RET_IP_); preempt_enable(); } -- Jean Delvare SUSE L3 Support