Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2459048imd; Fri, 2 Nov 2018 11:46:04 -0700 (PDT) X-Google-Smtp-Source: AJdET5cnhNRta+aOYqAtBfERY2KVWtWz7QDQIU43K7ialgyEQdScWA0p3CVJ34n0ZyLYVy0p9kVl X-Received: by 2002:a63:fb0b:: with SMTP id o11mr11895101pgh.211.1541184364826; Fri, 02 Nov 2018 11:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184364; cv=none; d=google.com; s=arc-20160816; b=t4dooMjmSI61CVNciBF8ViUamqJeVg9fMlImowjbXc/QTjkfvlXIxQ60WpgJ+CI+sK /JTifRZO2F9bhnTAWiHyJ7WxoYi52uDDievnXMTrL9MBm1vyWzTlBHHgl3WEgvNCn++B HIFWsUMsYVPsI2hpgxTozvI92E1PBGNNhDscUHzLk+PT+FYyE4ai2qba6E5CRo1BPbtt 8PWjPH9rETwC2ywLSPn73+C8NxwElSRaRJt15yvFgmvdAGBnl/zFw2CqtRYdP09vl0ZX AjijGUErSUTUp5yTO3YEdi1RGLSNr7XkYqCUenbG6irNXytMM6E0+jLEdTs9kuEEadTu XiqA== 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=8ujgonKqhnKKXp5UH9ncWFwUuIYARoRFWPbNxSWctxM=; b=ooQWrV5xw6m8FYBvjNlLYBGpX6odHfZP1LfXUEAcnGlDeNR7o4OKRybu+d40EDdFRz DwGP23iw5qJG1vI8+6Hx7i8wQWd8iP9pwLqnGNNBlxy8IsbickjDy3EKp+vKsnxqt5Gz RkpWV+Ra5ntxO05/1cmPbhlgCIjal2G695xdtMKmYzgOwLqbbgWrqwRN5cL0mdCcNqXD iSW/NfRZc6X7xbmA0IGPec5i5/BMT5nTo6dkfnnjuuuPPlxGHlY8uhcg/x4Nuqaphs3j ilqT7t+HuV86lxJdGu6T5kiU0MO2/yR9Zx9qu3XGIz3ALSCQaTY/uggFfsjtWHv4AKHs RpOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wYMHHkgk; 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 31-v6si7217057plk.397.2018.11.02.11.45.50; Fri, 02 Nov 2018 11:46:04 -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=wYMHHkgk; 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 S1730066AbeKCDw7 (ORCPT + 99 others); Fri, 2 Nov 2018 23:52:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:48346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726849AbeKCDw6 (ORCPT ); Fri, 2 Nov 2018 23:52:58 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.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 796DA2084A; Fri, 2 Nov 2018 18:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541184286; bh=moYln7qFla3a73l3jA1aY7imxwxUDhFI1dbgaoT/Kks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wYMHHkgkSppqF49Siit5O1THRzZNajdJR+k0J63VrfHyEE9avAuz+xgXoXfMIuE+Y wwleU8h2K1NbakSgxYixw0BJK+N2GeLb4+lwNbNILVViwDkP35OUGW56t1rEUCOr+H 6KTPGQwx25FM7iZoqv1wpfxKahGZRcYO9KP9YdKk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arthur Kiyanovski , "David S. Miller" , Sasha Levin Subject: [PATCH 4.18 090/150] net: ena: fix NULL dereference due to untimely napi initialization Date: Fri, 2 Nov 2018 19:34:12 +0100 Message-Id: <20181102182909.764164751@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@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. ------------------ [ Upstream commit 78a55d05def95144ca5fa9a64c49b2a0636a9866 ] napi poll functions should be initialized before running request_irq(), to handle a rare condition where there is a pending interrupt, causing the ISR to fire immediately while the poll function wasn't set yet, causing a NULL dereference. Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") Signed-off-by: Arthur Kiyanovski Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/amazon/ena/ena_netdev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index 72dbdebf4b5d..000f0d42a710 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -1580,8 +1580,6 @@ static int ena_up_complete(struct ena_adapter *adapter) if (rc) return rc; - ena_init_napi(adapter); - ena_change_mtu(adapter->netdev, adapter->netdev->mtu); ena_refill_all_rx_bufs(adapter); @@ -1735,6 +1733,13 @@ static int ena_up(struct ena_adapter *adapter) ena_setup_io_intr(adapter); + /* napi poll functions should be initialized before running + * request_irq(), to handle a rare condition where there is a pending + * interrupt, causing the ISR to fire immediately while the poll + * function wasn't set yet, causing a null dereference + */ + ena_init_napi(adapter); + rc = ena_request_io_irq(adapter); if (rc) goto err_req_irq; -- 2.17.1