Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp107425ybg; Mon, 8 Jun 2020 17:47:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAElL10gftIHSr8kPlEyE3MLulP/zxr1BNsz6iVRIX/y3E5l5fJdWCZ7FIbBNS3MWazmf4 X-Received: by 2002:a17:906:8492:: with SMTP id m18mr23020285ejx.168.1591663678557; Mon, 08 Jun 2020 17:47:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591663678; cv=none; d=google.com; s=arc-20160816; b=IZ+XXc/kpN4xhxhy9ddvr7iVd/06qvsy8NY63IBX6MjTyDn62G0p38opKTrN1NeRQ0 nCgjYdhARiDvFmdzuncRx2fHT4XGOwAUQCj4/gV/5qWDgSeycisMvCTcF2Bdvl5M5acz gWD8irJ4L5ikg28rC7yIll/OPPF7wt33+ES6GRWYGJQC3JeluK/fknkN0e3D/XsTEP/R NgthBSVkoey/gAeJPmQqMigcF+cGk2UaTGa46xFcs44L+T3N84bhdrL4iywyITE+xSO0 fP+unlsUL4lD6k2U9VSWUdRB090eZz1StBDso5oy8DRHmSjNMNyQTI9Le1jrwBx9Jzbi zV5A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HrP3RnLUCQO0Am3hZjJZrmH0L7C28/Q/9FdDtZzncNU=; b=BcMr/FuaIVJFKtTOve8UzQKsGbvEKv/syqJIgg47sV/BNU6KD52y+YKFwvLPucOE5k GP8PSw1v98XDCNYlTICOxqq22KAdbjfh82JMi9xV49raL0jgP9lrE64wbSybnbfTtXXb BT+THLDGxXrbGUJkWiYHh63zowbeLtn1iKKf5BBmBvtiE8Ei9mYt2bhjkJb0fRmWHWyf IN6JOF1HIkk4VxtzVIrVJPOD68TcgwtM+XLmtOP3ReWFcHsS6422IXIYZoE8Xn9VJ452 Q+6XNmWdVvMPQzkq2LBB46PPdJnRZxcpB+OnCmIvKDaQWzZiRcftva7m11r5eCjj4K/k 0Kuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0t1LLrOz; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e18si9576158eds.250.2020.06.08.17.47.35; Mon, 08 Jun 2020 17:47:58 -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; dkim=pass header.i=@kernel.org header.s=default header.b=0t1LLrOz; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731523AbgFIAoA (ORCPT + 99 others); Mon, 8 Jun 2020 20:44:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:59266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729044AbgFHXMD (ORCPT ); Mon, 8 Jun 2020 19:12:03 -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 C5AB721501; Mon, 8 Jun 2020 23:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657923; bh=gXJ+Q1Pj3aJdRLZo86iHaT9nHNrA4VTUe+HXTAwTAq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0t1LLrOzlf8rC2aTLlmQAL5K7vHLtNLDmUfY2F1MEXVg2HtailLHFTcDNcgy6wNaH vtSoBGXUY/W4R5v3uTmlZM6RUWUeOO5sF88jEDKe/LTv9w3mkHZ3QigdSXrVz2TFdw xxdq7mxgnO4Ct0QEkdHRNyMURQJs1D8kbUcUEvPU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vasily Averin , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 272/274] net_failover: fixed rollback in net_failover_open() Date: Mon, 8 Jun 2020 19:06:05 -0400 Message-Id: <20200608230607.3361041-272-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vasily Averin [ Upstream commit e8224bfe77293494626f6eec1884fee7b87d0ced ] found by smatch: drivers/net/net_failover.c:65 net_failover_open() error: we previously assumed 'primary_dev' could be null (see line 43) Fixes: cfc80d9a1163 ("net: Introduce net_failover driver") Signed-off-by: Vasily Averin Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/net_failover.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c index b16a1221d19b..fb182bec8f06 100644 --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c @@ -61,7 +61,8 @@ static int net_failover_open(struct net_device *dev) return 0; err_standby_open: - dev_close(primary_dev); + if (primary_dev) + dev_close(primary_dev); err_primary_open: netif_tx_disable(dev); return err; -- 2.25.1