Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp344220pxu; Thu, 7 Jan 2021 06:34:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5bcdkchjUMI0jhMhpJ/b6NAnO1hwL++of4++mpaclb853kdxUKLwMpaAKMADykV7bMUAG X-Received: by 2002:a17:906:1a01:: with SMTP id i1mr6562565ejf.315.1610030064937; Thu, 07 Jan 2021 06:34:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610030064; cv=none; d=google.com; s=arc-20160816; b=s4VWsZ+wFlB3b/HAYn6iLpiFhKEKfUtXktqh+6ogEAK545imnoGRmszMDv2QjeHNqZ px/eHXvqdiIG6VOmqsuIlerM7LMSgAWSKmzXWyo4CaUvie1veq4PgHqpCNc8lUZKpurw qsebyPviT1as4P0h27gQ7tQnxNsGEvuTTl4sYQnnAmmIIqCzyqCQq5wpY98zvljkLog2 XdNB9cOuqwOeXGQxDdXUs7vZgXB3NL6v8Oyzwi9caslQGIB7+XFKaKcmdyBAWIGn/hwQ up9e1EAt5wud15ujY9wi3r25yZm2QsUmMyq7us0JPyqDMG0dPy6xXmMAe+3nct5KRX8X Mlbw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2G9b6Pcx8LjDanDBIhXGhaXDuTs9cVdApQ+jiQZJ3IE=; b=IbSibVG+mlCJWJiR7f69QJecFkcKw4PeSYHtzOaX5Bm6TCYUrz0V7o3yWSzrJm+Jea Cvoh+pxXdBx/lqPEiOKbuSiwNuLJ1m37q4Ovm6uJfgSeTERa9eP5zsiAsglSoKZzC6Q0 x08vMFUV0ALiClIXpXohhS3CzM2ThUnzRjRD3lljwj32lYNJ0u5r2TqdPlVxaWTc15ns TR8eusMloLUA+GmVcZOZCAu+jOL2Eu0e28yCKIP01l4ZwDsUZRUQAmnqQB2RnM7+mZ5O EPNRHY1Omf4o814l6BQyDHNE7GfMtTF29ulZREy3W/FG6gNVTxnQFOHd/1FZ7YIxNwLt gvcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KuzOm9ot; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s24si2300765ejd.135.2021.01.07.06.34.01; Thu, 07 Jan 2021 06:34:24 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KuzOm9ot; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728886AbhAGObj (ORCPT + 99 others); Thu, 7 Jan 2021 09:31:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:45346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728630AbhAGObi (ORCPT ); Thu, 7 Jan 2021 09:31:38 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DF41223356; Thu, 7 Jan 2021 14:30:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610029858; bh=APu/jXmOcUT+ePEqtPNGTJWpAn5vwcWurH2AbSLSO68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KuzOm9oteUIo1Pe4lfSvBaYYuQMnIqSu9HZJRNadK0n0+LZtMAB9WI1gr/tNw6Esn JW9BjxQ1w0jWhfWlLdxL+UvQy0yqF9hqsUyje+9/pEV+ZS7x7lQ8gqtTf7JXOR8R9u /YsTbjK/DH8dyWfV0P0uKsP0Eu4mW4LGg9ataEjE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miroslav Benes , Jessica Yu , Sasha Levin Subject: [PATCH 4.14 20/29] module: set MODULE_STATE_GOING state when a module fails to load Date: Thu, 7 Jan 2021 15:31:35 +0100 Message-Id: <20210107143055.809503392@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210107143052.973437064@linuxfoundation.org> References: <20210107143052.973437064@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miroslav Benes [ Upstream commit 5e8ed280dab9eeabc1ba0b2db5dbe9fe6debb6b5 ] 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 Signed-off-by: Jessica Yu Signed-off-by: Sasha Levin --- kernel/module.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/module.c b/kernel/module.c index 2806c9b6577c1..c4f0a8fe144e1 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -3801,6 +3801,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.27.0