Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3930640imm; Mon, 8 Oct 2018 11:52:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV60fEdTxuLxGEOozh3WTZk8HKUqfXTT0sLvmZy2z1vmmWs0S09bFIhMmhY4Z8bzR7Oyl3yqK X-Received: by 2002:a63:3cc:: with SMTP id 195-v6mr22561573pgd.262.1539024774105; Mon, 08 Oct 2018 11:52:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024774; cv=none; d=google.com; s=arc-20160816; b=x/w3aSWR1VSZ/RxwYkkd/tAXulIhzQXFQrv8i/cPZJagRI2qRlQe57+kxY7cODLs1r U4snx4S4ybtj2yF/TwStzs4bG1g7hEMpKJpQB1HEixplx46/I23C+kawfq67TDSV8s+2 blFiN64o6BIEPomMUJRwVrOQeQo/cMTPqw5JJqfQYDXyVAtlaOWDriC0ftgnjm/OFpJ4 Wikx1EU9jldmduwlN2zObF5JEATnPB/AB2sYFOB5u4Zr5dsu1OaWIgIWaGtZ8lDStE5r zI9S1sK6WmJf+7qZQFhuOiwRJ5/c3cFTssAD00vaTy3dJ76TFOli6C6zC9TuWYksbKwW 2wbA== 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=h+LmAykCpGhlVs9HpIhMxenVfQvfG4cjk07pqQ1bUkY=; b=EeEV09hP37EU9PT9RClxDmCKshC+TiMbzcoS+UFXwEc9RrZ3x8ZrXek/xsP/sk70uR eEYv6pGhPoENO4C0k8vuHjPxwiG1oYF1smWCfvkPVynEQgfLbHjhTSET61aZIkCMXyqD 183jDG4rWbmbSbwsBgE4rJJfnHLZjkGEXSiuf01UI8nShIIu4nful5nmQ5iBkVgViKh9 MwoF8t7qXDqSUtUiic2iwZXchwEz/hKRnwbVpBg4DkRYWYfdJIi7T11DuLjzRos7yLxD +ITRpgLvFW8n1ukDuwH3s2hdZdnD9hRbfqYqz3JYq/G2LPGuoAt1SIhvG98n79EmP78A r6gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uT+gBkSq; 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 o2-v6si16948662pgj.111.2018.10.08.11.52.39; Mon, 08 Oct 2018 11:52:54 -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=uT+gBkSq; 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 S1732554AbeJICFk (ORCPT + 99 others); Mon, 8 Oct 2018 22:05:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:55806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbeJICFj (ORCPT ); Mon, 8 Oct 2018 22:05:39 -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 5ACE42087D; Mon, 8 Oct 2018 18:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024751; bh=69mxjho+QiNb5gvH7t3aoxzWKHhsMGexQuKa4RnZBU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uT+gBkSqQ6np4HEmF9BI+vSvlei1QR72GgdGlnsx0HDWgcmYqV/lKgBwUZ7O9aZ8B lJb77dJg5j7Gsmow84KS7luGmSW9/2V7xPcsLSONCO8xPPUo9xoCP3MyOu7kUp8WJ5 tiG8lGj1qFjrrOHqTp7tsS1c3RHyS7D/iu9frm9k= 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 118/168] net: ena: fix surprise unplug NULL dereference kernel crash Date: Mon, 8 Oct 2018 20:31:38 +0200 Message-Id: <20181008175624.531580718@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 772ed869f535b4ec2b134645c951ff22de4d3f79 ] Starting with driver version 1.5.0, in case of a surprise device unplug, there is a race caused by invoking ena_destroy_device() from two different places. As a result, the readless register might be accessed after it was destroyed. 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -3408,12 +3408,12 @@ static void ena_remove(struct pci_dev *p netdev->rx_cpu_rmap = NULL; } #endif /* CONFIG_RFS_ACCEL */ - - unregister_netdev(netdev); del_timer_sync(&adapter->timer_service); cancel_work_sync(&adapter->reset_task); + unregister_netdev(netdev); + /* Reset the device only if the device is running. */ if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags)) ena_com_dev_reset(ena_dev, adapter->reset_reason);