From patchwork Fri Jun 19 14:29:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 224205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63C37C433DF for ; Fri, 19 Jun 2020 14:53:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30E08217D8 for ; Fri, 19 Jun 2020 14:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578432; bh=Q5lsYS7fZAa4bA6lReP4Ek3N3GMs/7klMA+r8Ds98CU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=s1MP2QBunxoHpKyAJKkxthi61227eo3vu2DE/YxbP2wGsh5Z+55Wbc1knu6O369MD 4Nl0WlJqLGo/RYnifImr4W9PLYwMHXm3MYvhDC1Nq94I91rhT2ytAX5OsiORghPY9+ g5Lv2KYvB3IcpF94gJ9seyn3RwjxIFkjNXx/I0rc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389770AbgFSOxu (ORCPT ); Fri, 19 Jun 2020 10:53:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:48258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389767AbgFSOxt (ORCPT ); Fri, 19 Jun 2020 10:53:49 -0400 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 CF96E21556; Fri, 19 Jun 2020 14:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578429; bh=Q5lsYS7fZAa4bA6lReP4Ek3N3GMs/7klMA+r8Ds98CU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wRO7bFb6BJ6s2TtF7fwuIw55mOV7LM+JIPYuVWGo/wBufkvulxtdYXgnKFlpoinry kr5AHiL6YM5jb6Rkw1//Vgljzss0ECQ3yOf6CEotRidVWwWarl0GG33lpQoEF1zEib RFmI+mqNFmocnMHYJRuIwu4uFIcK24epKmsNKD0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , "David S. Miller" Subject: [PATCH 4.19 002/267] net_failover: fixed rollback in net_failover_open() Date: Fri, 19 Jun 2020 16:29:47 +0200 Message-Id: <20200619141648.970529459@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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: Greg Kroah-Hartman --- drivers/net/net_failover.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c @@ -62,7 +62,8 @@ static int net_failover_open(struct net_ 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;