From patchwork Thu Dec 21 16:58:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Pagani X-Patchwork-Id: 182361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp545137dyi; Thu, 21 Dec 2023 08:59:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGypFT0i+1JphknPhTMNqPHCjTnct32Tz50R7XQV/IUtPeZcbwsICkgmnI44sFGz/yPzhIm X-Received: by 2002:a17:902:ecd2:b0:1d4:13c5:b9ea with SMTP id a18-20020a170902ecd200b001d413c5b9eamr543123plh.114.1703177964186; Thu, 21 Dec 2023 08:59:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703177964; cv=none; d=google.com; s=arc-20160816; b=SIpmPec2gvEUKTpme38SZYEal4OWqPTxc9dhUd/+FtYKrCM6XiLchnTe5Rny+EaBn9 OmF5M8a3APMlQEPuJc4Z/cos9VufZLuaK205MonqEVz3cTK7O5v7oWA0q6fBg0y3NepW np8pGlEDqmQ4dnIi+v3/VFJkH5SQuxckOBmacQWq8mpGo7kZrqXX8sb+aC8krjvR14DW Cjdo7S9ftuZhqEw2ee4zENc7Osd4K1/G0IUf4vu3O37m8O+ENfQoL4AvtCEr+PejhDcL szRE0GpqwFE0X2A4f40Cl7XFrGgknvjxQzAvQ4gBhrm/8STPZrDmL7OC5egqHHcQH1sx amXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=YfzgPU3MkfaqMkHywTBvwxBqqqhijQZYQX1JEq3yLos=; fh=18qGt//N1IpjL+CuZEWpHbG4kLjULAvZzXzwefBvhpI=; b=ejUHHzajwvICiZuyATsc4IOqf1iTsCJBBBL7/dtmyWhLgVjSntYGTDRtW8TPo/b2vM LKnxofYtM1piuLGqVQZ3PfRW7gRu+IEx7TtzTxUHbZs9txmjpxSNz/HhABSwImnhg7dp Fst0dBGebMAeQtvVhLbPs02P6iyHI9kf1xqxxXzhuU9ci0C8XREHmZiZ4FXLf8iTugVT isvAjVS5n61vb+ETrQFXIMqJIDLHv/jGgRXPVe5Dd8mqx8zzVv0PCEU+YD8/NWVnBjcc opqg6ufEoSVwKgf1TUlkJ0nlNuhke1aOtsEba66RnGPYB1q5cl22i7muuMJEZptZdr7D eyLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BaSqGs76; spf=pass (google.com: domain of linux-kernel+bounces-8804-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8804-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u13-20020a17090341cd00b001d381d2ea62si408323ple.516.2023.12.21.08.59.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 08:59:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8804-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BaSqGs76; spf=pass (google.com: domain of linux-kernel+bounces-8804-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8804-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A211F28896A for ; Thu, 21 Dec 2023 16:59:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8FC159913; Thu, 21 Dec 2023 16:59:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BaSqGs76" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AED05821E for ; Thu, 21 Dec 2023 16:59:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703177939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=YfzgPU3MkfaqMkHywTBvwxBqqqhijQZYQX1JEq3yLos=; b=BaSqGs762xxaBKLh8zl0g+GTMPoiR2NxJ6iMau8Kjs2jpGGjNiQrEUSgZtZBxF/bEezK0o 4TABIiyLvAROtZsksiIVACQxknv+lfmNaKBCjFZ8qggHtq1E/qh4lo+mP8LvDBX/1BQvsJ Sav72rQdrtmy9p2s5UZu/V6J2c/dvTA= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-146-iAYrCm-EMAiboEnHJGc83A-1; Thu, 21 Dec 2023 11:58:57 -0500 X-MC-Unique: iAYrCm-EMAiboEnHJGc83A-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40c3cea4c19so8821955e9.1 for ; Thu, 21 Dec 2023 08:58:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703177936; x=1703782736; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YfzgPU3MkfaqMkHywTBvwxBqqqhijQZYQX1JEq3yLos=; b=VqoATI+FTk7QrNb2yM+X0fsfDQb2IE8eOEfSOT/nhQAmrlEhGFk7rq2ua9CpaPdr92 taM1T+7ZQ4MBgSdL+D+gtyon64X3d24a4a/ugirwgJyWB5X9ZeClPup6mYfrQxwlAoP6 rnJqgwPmRJ2XGj0T/mDI9w4MeCF8A22pDf0se4Ml8TnboIneLLpNOkNlXVD6tJWRcaw0 laU+JALmvN6y6BUEOp8rkobOdXskyQgjFLWWyeNUjHpalV7UQVLLPWcb9I+xkCiEhu1S 71HO53OM00z3LoV9NYh7CrvhXKka+sFt5koEy1ThzuXqgCJYwMmG3TiQpGIVDm0lBBmO v/4Q== X-Gm-Message-State: AOJu0YzK7yDtJ46jXnEuSG6oUEvdh91c5V1MXuuAt7GiICniIYHvCyQP Az31z7BGnZyDoFc4lKUvv72bOeejNQk0Ix59xwmp10YymwWjA4TzbRafcYYWjn48wJvvdc9MAlY Bmc+y9DyF9P6rX1bsQ9m62t1PoxbV3gc= X-Received: by 2002:a7b:c8d7:0:b0:40d:3bd1:3dc9 with SMTP id f23-20020a7bc8d7000000b0040d3bd13dc9mr2459wml.219.1703177936726; Thu, 21 Dec 2023 08:58:56 -0800 (PST) X-Received: by 2002:a7b:c8d7:0:b0:40d:3bd1:3dc9 with SMTP id f23-20020a7bc8d7000000b0040d3bd13dc9mr2454wml.219.1703177936454; Thu, 21 Dec 2023 08:58:56 -0800 (PST) Received: from klayman.redhat.com (net-2-34-31-72.cust.vodafonedsl.it. [2.34.31.72]) by smtp.gmail.com with ESMTPSA id v14-20020a05600c444e00b0040c58e410a3sm11874745wmn.14.2023.12.21.08.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 08:58:56 -0800 (PST) From: Marco Pagani To: Luis Chamberlain Cc: Marco Pagani , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] kernel/module: improve documentation for try_module_get() Date: Thu, 21 Dec 2023 17:58:47 +0100 Message-ID: <20231221165848.150041-1-marpagan@redhat.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785911537021615672 X-GMAIL-MSGID: 1785911537021615672 The sentence "this call will fail if the module is already being removed" is potentially confusing and may contradict the rest of the documentation. If one tries to get a module that has already been removed using a stale pointer, the kernel will crash. Signed-off-by: Marco Pagani --- include/linux/module.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/module.h b/include/linux/module.h index a98e188cf37b..08364d5cbc07 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -668,7 +668,7 @@ extern void __module_get(struct module *module); * @module: the module we should check for * * Only try to get a module reference count if the module is not being removed. - * This call will fail if the module is already being removed. + * This call will fail if the module is in the process of being removed. * * Care must also be taken to ensure the module exists and is alive prior to * usage of this call. This can be gauranteed through two means: