Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp466261ybl; Tue, 28 Jan 2020 06:24:38 -0800 (PST) X-Google-Smtp-Source: APXvYqzmR/7f6ycsZcDvMKtlUgUZ7jiYoJAGRT8BYXsDH5el+5/1rT7M8QAgkOgBTAgaApNi5Edw X-Received: by 2002:aca:d6c4:: with SMTP id n187mr2992741oig.29.1580221478833; Tue, 28 Jan 2020 06:24:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221478; cv=none; d=google.com; s=arc-20160816; b=mvyjOyG/gRrSvimRGxc8o14rJ+lc8gZYA91Pkt5Apgo988j3NN98pBk00LVb+30LPk +xuEPdDMvsx9A14Wj9F1B39PvZmd4Z9o5FrfcL7YynT+D6Pu0yDNpuCWzZMgmMRvpKz9 UWx1Fbe+3E1x7Cm0x3QnT3xDwwutRG5Wn/nFDPeggtcguso1nS4LNZ5ZNbwTWjeXOE23 PxZ6c2GCHyA2xEy1mACINPlV3it/RM9mDc8LPOMzOXjP7+EQ5BmRXWRABC9AjJBo/PPL MqhCU3nrA21nI6azZ3TRUbbV2EVQ+yFmT+W9H2ZPyQCzwaqLixw1n24V0wHVYidCfq2z DBZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hd245XWfuViu8Mi6xIEiLTtjBjtSvCck/RidRekeMUM=; b=pshbQPI1W9i3yyfr8kmkz2juS9alcHemqBCbmPk8qzCnPLVQ2tOBckBbZtQd2CydWZ WlodDfqfxcmYIl38PxGGlW2JDK8LpIdL8JxHXJBcH78Q3ktrGfAufv0sV3P9qIegi4R9 wcxj1vYG+QcX0HCEa69kjPbwFFBVR+zlxqgylqDer3D1AhCFLiWFbFuPMBDJvL/NlhHa hJi720IGund1Dn2KZzYsiIaGqvk3Itsptu0CZcy5iCF0kkQueh71MP8wRfJGYa/iWfDf LlSxteEQqJhRNmuWkQF7YYaawevsYRWr1FfL9SkK7CHStwUfpmP//Xdm+kO8Ha7d/TpN Ovdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TC1qEy6A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g26si8953588otn.180.2020.01.28.06.24.26; Tue, 28 Jan 2020 06:24:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TC1qEy6A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727818AbgA1OXg (ORCPT + 99 others); Tue, 28 Jan 2020 09:23:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:49722 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730922AbgA1OXd (ORCPT ); Tue, 28 Jan 2020 09:23:33 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B780821739; Tue, 28 Jan 2020 14:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221413; bh=YofoTy7gVRUkS9Dp3Lc16Xyaz/RT4b+nv9P7oh9tg+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TC1qEy6A10UQX4l6c+4eJHGlDfakjesPCYFSVDpv4vVkHJ3mduFAUP41qvzt7oElI 6NB3C+keWfZwwwBsENfJY2Ho1WXxiE1wxxRNRlR07ZwPxOijF1ky2KCwxKqI8i4W+h Ef/G9//jO6i5j+wDK3FEZ9wH4mnMpFtYP2Y/Q5SE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.9 214/271] act_mirred: Fix mirred_init_module error handling Date: Tue, 28 Jan 2020 15:06:03 +0100 Message-Id: <20200128135908.459853485@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: YueHaibing [ Upstream commit 11c9a7d38af524217efb7a176ad322b97ac2f163 ] If tcf_register_action failed, mirred_device_notifier should be unregistered. Fixes: 3b87956ea645 ("net sched: fix race in mirred device removal") Signed-off-by: YueHaibing Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/act_mirred.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index fc3650b061924..9b4c7c42c932d 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -332,7 +332,11 @@ static int __init mirred_init_module(void) return err; pr_info("Mirror/redirect action on\n"); - return tcf_register_action(&act_mirred_ops, &mirred_net_ops); + err = tcf_register_action(&act_mirred_ops, &mirred_net_ops); + if (err) + unregister_netdevice_notifier(&mirred_device_notifier); + + return err; } static void __exit mirred_cleanup_module(void) -- 2.20.1