Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp604899pxx; Wed, 28 Oct 2020 12:12:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9pcnyquTbOIrDUdnAcVz9VYBQxCgl/+arQAF0C0+FzICk+x3cjrvzK3zidYaQeRMQrz6t X-Received: by 2002:aa7:d28c:: with SMTP id w12mr427171edq.282.1603912365343; Wed, 28 Oct 2020 12:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603912365; cv=none; d=google.com; s=arc-20160816; b=g75aY2c3ozE8dxEiZtKtKpsbMv3lLGABJRL+VcnCC6drpjHo13TLg1vy9l6t9et5o8 QTiCowx+Zcaxos1Lb09wDavsPAqoyOkDPJKjt4srCjXzLPWa8HCjBCmHoapmgNfRTwMj /5kV3qvgnFgseFBmIj3rsUUR6DwCcFvtWXIYk0ar0lIYKlnqLBNpdg0ni6loLNDpzS5J PXFqS4UG3uIs3XjdBOW756g9TgrXQiP5pBBeQZrvlOyBoKmN7z7ff9SCRAzVK8Mt0ZzI 5pEACwFWgaSe59IRuhWDZ4JcjXnBu9gB9U0VV7PUIz8VTjh7UywDT3714HKYguvcAZcT /zTw== 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 :message-id:date:subject:cc:to:from; bh=dncgvDnLtiDci2DCyrWTuyRo17FJYqdB5EBdqFFF1ks=; b=D70/S700u+SbEtJRYxHqp/h2pOYAIyGcgkm3IeLJFdeeF7iGfkm4m4BYvCRUrtf0ZF O+2wDZLK4wWUymzdrjBE4WPZiOYkRR8V5nTJ3v5UdU8Oq0kAUqjiW7PM0qIFqohLYB4j Iy3iB4jO5ypBkfRCtc3n/B1hqAiebAl0QkYCZ9Cr8IIEpFDVQ2eoIxhanTJ0wQzPeQaW tpp8HzomJ5FXcLKwek6+47JufhKMZ0g0/TvXf11kMMLK3hnhSjrTKFoDqpZ4Cjpaw3Yp tc2GT6KKZbGF6+sV9bHvN9s82gO5m7LZcfFdvCfFb0SQRW5qNpsSNU31LQ9NJ7c49NqL tJtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x19si30189edq.122.2020.10.28.12.12.23; Wed, 28 Oct 2020 12:12:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1826336AbgJ0STQ (ORCPT + 99 others); Tue, 27 Oct 2020 14:19:16 -0400 Received: from mx2.suse.de ([195.135.220.15]:59308 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S367983AbgJ0ODo (ORCPT ); Tue, 27 Oct 2020 10:03:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C0534AF54; Tue, 27 Oct 2020 14:03:43 +0000 (UTC) From: Miroslav Benes To: jeyu@kernel.org Cc: linux-kernel@vger.kernel.org, Miroslav Benes Subject: [PATCH] module: set MODULE_STATE_GOING state when a module fails to load Date: Tue, 27 Oct 2020 15:03:36 +0100 Message-Id: <20201027140336.15409-1-mbenes@suse.cz> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a module fails to load due to an error in prepare_coming_module(), the following error handling in load_module() runs with MODULE_STATE_COMING in module's state. Fix it by correctly setting MODULE_STATE_GOING under "bug_cleanup" label. Signed-off-by: Miroslav Benes --- kernel/module.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/module.c b/kernel/module.c index a4fa44a652a7..b34235082394 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -3991,6 +3991,7 @@ static int load_module(struct load_info *info, const char __user *uargs, MODULE_STATE_GOING, mod); klp_module_going(mod); bug_cleanup: + mod->state = MODULE_STATE_GOING; /* module_bug_cleanup needs module_mutex protection */ mutex_lock(&module_mutex); module_bug_cleanup(mod); -- 2.29.0