Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp174269imd; Wed, 31 Oct 2018 16:49:05 -0700 (PDT) X-Google-Smtp-Source: AJdET5cKN8dIUPDWzouLtYo4v2CmKB1nLP966Rc/T1TTLU9LKIMM6a3nXjN57nkc8lO/LSVPP6m4 X-Received: by 2002:a63:ce08:: with SMTP id y8mr3435778pgf.388.1541029745517; Wed, 31 Oct 2018 16:49:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029745; cv=none; d=google.com; s=arc-20160816; b=k0W49IBgWYrWYC26uUS12l68d+WFkT9cgriyEqva+X06vJSqetWImQFbk4fILiB/NS 6fDkFvxInkqEtCDs1HRUoP4iAWnIZeCBjOrgxLlpjUQoTvfFw9SccJdRMegi8klb6rYH NNJYX6laX27tnF0XBLPExnxKPWj0BXJzH3/QJ6GWwxPm9b6AMz40UOhrvQpOFUOCikJ3 BysxYBEAp0crmenNIvIfgOb8hex09lsNsP0HG0GzN/5k+QvYsOCXTymW2+HaQ/PlOhoN 6KXoGR8hP6WqjisRnZoXSw7QQp8ShhK8tm7qZonE8Zq/8ji/pwTzxN68FgciQrf8T6Un ExNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=cPEGhMr8kmVRLpxzUqVw3gr0XUPsjGZLcLAV3XGJ0hM=; b=pdhHEm/hetc0tphG+0g3BJBl947odcn44IapnfJPRJvYo8HDdRfimqr+JrnTkFW8Qc UUMLVhft2VR6rRl9jamQJxC7+uz4dam+pVsmhlO5YECL1enpuUCK4xwf8eOz5tugelO4 iDb3N1AFXgPIuLOKcDN5N0/nJ/KWqZX/o/VuBmB6V1yvQTn3ZvI8xUf5Eso/Wg4V4S3C 3veHSIEOW7CSX6loOFwew29/gwwaVFnh3rcByCj+6iv1Pzv3oWaIjjJFWznYY2GxzbDt p8onbAxb5mTOSxlsNqCDP4/FdWhIpfnAUT0qOl5B0a3EqkEX6pNaqyjutFSv8mg9CXhY WKIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GT6JXiaL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z70-v6si1727253pfi.165.2018.10.31.16.48.50; Wed, 31 Oct 2018 16:49:05 -0700 (PDT) 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=GT6JXiaL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728431AbeKAIGx (ORCPT + 99 others); Thu, 1 Nov 2018 04:06:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:54112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728412AbeKAIGv (ORCPT ); Thu, 1 Nov 2018 04:06:51 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C8D9020830; Wed, 31 Oct 2018 23:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027201; bh=kKmiyLBAWpN6JMLi7OasnIOI6CYa5YEZeBZgiY18DNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GT6JXiaLSREV43/d/sQ39R/ZT1V/3ODW3BenizK7xUqzHe4YIXa108GbZs+7pUf5j UWRI4pI+NctGVQswCrpU5IxgAf45TBsLkUv7N2+b/RED0e6tEAxkK9G1n/LVuBu0Yg QWyJf1yzqCs+QkpbOph8e7hjR58yKeOC7DZA4cd0= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: YueHaibing , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 065/146] failover: Add missing check to validate 'slave_dev' in net_failover_slave_unregister Date: Wed, 31 Oct 2018 19:04:20 -0400 Message-Id: <20181031230541.28822-65-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: YueHaibing [ Upstream commit 9e7e6cabf371cc008cb2244a04c012b516753693 ] Fixes gcc '-Wunused-but-set-variable' warning: drivers/net/net_failover.c: In function 'net_failover_slave_unregister': drivers/net/net_failover.c:598:35: warning: variable 'primary_dev' set but not used [-Wunused-but-set-variable] There should check the validity of 'slave_dev'. Fixes: cfc80d9a1163 ("net: Introduce net_failover driver") Signed-off-by: YueHaibing Acked-by: Sridhar Samudrala Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/net_failover.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c index 7ae1856d1f18..5a749dc25bec 100644 --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c @@ -603,6 +603,9 @@ static int net_failover_slave_unregister(struct net_device *slave_dev, primary_dev = rtnl_dereference(nfo_info->primary_dev); standby_dev = rtnl_dereference(nfo_info->standby_dev); + if (WARN_ON_ONCE(slave_dev != primary_dev && slave_dev != standby_dev)) + return -ENODEV; + vlan_vids_del_by_dev(slave_dev, failover_dev); dev_uc_unsync(slave_dev, failover_dev); dev_mc_unsync(slave_dev, failover_dev); -- 2.17.1