Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3487168imu; Sun, 11 Nov 2018 16:12:24 -0800 (PST) X-Google-Smtp-Source: AJdET5fPstqrWlWfoy14rTFiL2TvdrpswtLXWvM1lDWJwtgKI1qZI2crXZ0YJVBJPqq+gOiQOqHa X-Received: by 2002:a63:ae01:: with SMTP id q1mr15334882pgf.402.1541981544256; Sun, 11 Nov 2018 16:12:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981544; cv=none; d=google.com; s=arc-20160816; b=cAtLz3/FSZIzITTX11d+QP60HUa9LvN3tlyfCdgvXeK+dwdMrWZj3egFWFHagxVyHz UtMb1TQ0uQ7OTlu3WcDMZrq2HD8Fml7jJVocQQMF4BxkCX9u1ShoogTwKLshuXfu40wS TodU5ZE/8aZu5R9Oq+BQKU8fUpthxMm60bDLV3tnSStcQ5VE8kTiVzTXB6+5HBa40BTy zoSU7fIGmL2xJ6Oq2Ii8+R0OrQ7NYSTG1sv4X2zu7/b9NgSLMQ09/ePnNa/EowXDhinB h64MY5EttLYRzm5Pxc14WNgFewCkx0OZT9aTgdZ/nFuA2OtwoqSQYGSAsK6MajqNRJ1G /DkQ== 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=vJMTpRItwSpRuEE+DiAlKyQCP8DcL2JDqlTXRs1pnjQ=; b=lGMWyF7jL8wo0WRwIf4hF+GzyfKoHu4H1ydLZNmoBuD+wK+7a5bIHr9b8N/9fXe/UB lK/r2L39V1P2jTuYoAJ0Z75FB3RoWPhGYRPNPWcFHV63adTq/G9ngnT4j4Q6XpbISJ2I lAGUAbbZUWqdJFwyRz6pFP8zH4HpNjK8NNkk1JVaoVH2B9mdeC36w7tcjHO0jDmmZ04A p3aBmVMQ56OnyLWxlkJ7Ekz9i6M4Zu1gSwpJMgMG5TZ14EetTD/DYB5c7vRikfn4Bn5i 1lKl339JOVPQ/OFSfzUThMMiOagg7U+y/2jFHohW8g/lGh58IMv2XxbIa/kgWHYwFwWU lDhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RlXwxjQv; 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 k8-v6si14658292pgj.192.2018.11.11.16.12.09; Sun, 11 Nov 2018 16:12:24 -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=RlXwxjQv; 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 S1731794AbeKLKBD (ORCPT + 99 others); Mon, 12 Nov 2018 05:01:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:60278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730704AbeKLIRY (ORCPT ); Mon, 12 Nov 2018 03:17:24 -0500 Received: from localhost (unknown [206.108.79.134]) (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 2D111215EA; Sun, 11 Nov 2018 22:27:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975249; bh=e/bIhPxoE2ySsFZe0BEakIHjmRQ+RQ1Sb/jsTwa/940=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RlXwxjQvbWCz8GhxeS1esNYhM4j9fgHGkt32+C+WoieCO1mg4q+AR09TE00zTE2Rr 44rYYeg56i0waaY8gN7iG9Azcn5Hyamc78o+mCUVjkkVD2S0bPoY7rWgayjD3UhU2D MJ0450YV5Gy64dcX3aYMTsdFBGb0wy1dmds/l1FM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Sridhar Samudrala , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 110/361] failover: Add missing check to validate slave_dev in net_failover_slave_unregister Date: Sun, 11 Nov 2018 14:17:37 -0800 Message-Id: <20181111221635.102448420@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/net/net_failover.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c @@ -603,6 +603,9 @@ static int net_failover_slave_unregister 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);