Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3929595imm; Mon, 8 Oct 2018 11:51:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV63wTDQ1x8y9v9mKKzrXlAhJj3ldiSO15s15Pdh0WsFoLePPvfLcjdDrByB3ZPqOvtcVZ4Nt X-Received: by 2002:a17:902:9a45:: with SMTP id x5-v6mr25068904plv.213.1539024704812; Mon, 08 Oct 2018 11:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024704; cv=none; d=google.com; s=arc-20160816; b=ZWA06DmZG0WaIbED58dNFYOlgJTSC4YPifkZjwQmJ/NgpJsVWgOJnWclzu9EEjv3+b PbkcT4rACZMT3rWS1HT0l9P1tYpmKiPp+1TMPU5XPZ8IultXSnKrQQVY/T4jkJEg9eQm TF2RUpjOIVCP5J841FGd1OljvCuuJrTCIaW+4SaO2SaAcsiZ0StEwpFCIGG0dLk2Tl3v BFTUt1xd7iDMfcRlNogFzKgkFTobOMhQlkH5+ordxELAFYQbvDfW4508CVtHqYU9qGjs VnEiXlfO1KovCExZNYQdL7T9zUpAGnAS9aVSU3Lzlqggm7pWKSkURPbdI9lLMlcyclfi cUZA== 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=ctciUpKLH5DMMJo1xLt1lqDQ3aKuLAaKc7Hhsae+M30=; b=IvZDeh+Db3GPHchWlAo1IGanGSrzLRTdz05+vWEHFDvPMz7tZh8pJrxkj4xfc+k1bl Tio6fHL6bWAgmnF1MfKQ2RLF2xcINLOhCd4NtVDsDiUmP3/mdf740qQiqWBPPs2gSJWA ncSdZJ6b6vI0FrLYTCGl8isOXJKhHlRLfRjPcQM2IEq1AH3ue7VGwjb5FiUEIow3264q LeXVkOwmd4FaqUILzop5iFiZf/whN/jE9kPbxBlw+7YR2JCPy5E77M6w7SNaylfr8tuI Ob9us5UD6S2un8wNB7kU9WSJ4+ALL7oraymLMnhvyAxFk6qVTWPg912mBud3MnPAEBo6 WB7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gSSQRKMT; 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 b1-v6si15035455plc.237.2018.10.08.11.51.30; Mon, 08 Oct 2018 11:51:44 -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=gSSQRKMT; 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 S1732328AbeJICEc (ORCPT + 99 others); Mon, 8 Oct 2018 22:04:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:54370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731723AbeJICEb (ORCPT ); Mon, 8 Oct 2018 22:04:31 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 EA41D204FD; Mon, 8 Oct 2018 18:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024684; bh=0RAMYZyGoWf6R+j7VVLoNhkUdKf2OFDfSB2vJWPJov0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gSSQRKMTMfgPC5xYsw5bTzIndsjek2nNnhjzk4C7gJOmZoFKs0DNfKWNhtwB9Q6wK IphNvH8EgGR4kvVTdfOaBUp0TFbFo4w4briWWoa0JNG79SVWpHY/kl/a2vEpG2aZ/q 8IHXO0F+0k9S68j5qtZudRHtvLu6GivndmgQXUUc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Netanel Belgazal , "David S. Miller" , Sasha Levin Subject: [PATCH 4.18 121/168] net: ena: fix potential double ena_destroy_device() Date: Mon, 8 Oct 2018 20:31:41 +0200 Message-Id: <20181008175624.649349901@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Netanel Belgazal [ Upstream commit fe870c77efdf8682252545cbd3d29800d8379efc ] ena_destroy_device() can potentially be called twice. To avoid this, check that the device is running and only then proceed destroying it. Signed-off-by: Netanel Belgazal Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/amazon/ena/ena_netdev.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -2555,6 +2555,9 @@ static void ena_destroy_device(struct en struct ena_com_dev *ena_dev = adapter->ena_dev; bool dev_up; + if (!test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags)) + return; + netif_carrier_off(netdev); del_timer_sync(&adapter->timer_service); @@ -2591,6 +2594,7 @@ static void ena_destroy_device(struct en adapter->reset_reason = ENA_REGS_RESET_NORMAL; clear_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags); + clear_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags); } static int ena_restore_device(struct ena_adapter *adapter) @@ -2635,6 +2639,7 @@ static int ena_restore_device(struct ena } } + set_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags); mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ)); dev_err(&pdev->dev, "Device reset completed successfully\n");