Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1353118imm; Tue, 2 Oct 2018 06:59:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV62W0mn2DHAqNkwXB3AnhDAAzowyvbcoNh2AkinFUk2xHhDou5/akkTREmit3DfvUzA53BtM X-Received: by 2002:a65:528b:: with SMTP id y11-v6mr4391707pgp.269.1538488796741; Tue, 02 Oct 2018 06:59:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538488796; cv=none; d=google.com; s=arc-20160816; b=z00CwvKEJTMubk32IohMoWcYuTDJ2IHt9y6/Y1dMyHfp208QlkFxqZE6Siy2c0fKH0 e3zoRtIB0yCBprw5DxGIIeY2p5hIrBPZKag0BHv//7sPZw3E0wLiVtLbCHV2tfb00jSE tuJKuI+o0atstANwcyofXSz/qrmWyrHJ9qKsy8gm0942izdaasOXDEh1PVHnk3SqKZKx A0Reyv9k2za5IW1mojOTTJCh0cE5LG87se+3DuqVvKjE3eX1/A+2wIxSimA5l7DQTrbS kAv7JbnP7L1OEpbXLjT6FnGGWLe3JGP5J4jYi4e1exY6mPhhTwBEiL+VGEl1p8T7J8uI MQlQ== 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; bh=4glvOUX/tOl3saYn2jT1uHVVlaFe7WhQqCPrExpEnRI=; b=f1xyf2OrRUaqqo9rsVYPNQLITsKHovJ6M9sUunKVbiwyKOqKLxxS+hFLdY9OP7ZoiA aa2MmIhwwGFoP8uy5xFJKJr/pUOLeEer+olJNU+jJSCjh1j3K/qcIpKyRo+3j/vV/J9m 46UXq6RpRkO9NVPWe2veglZDNnJM8ZfTM4lQ9/1aM1YAWm8nM3qEOhrgWQAmrNiq5pT2 PqgSiaJtqyo+FKACk3tRtxC4jk+pEouWg/LlwBZylhGbvfjEwt4a9X4PEQaMx/tSYdL3 FndT1L102BUz3embJfJrP4odPKXuhy8uCnLQiHXuyrfRhw+qXwoGpcnHZuPt3vYsFus6 +0bw== ARC-Authentication-Results: i=1; mx.google.com; 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 cb2-v6si17553993plb.280.2018.10.02.06.59.41; Tue, 02 Oct 2018 06:59:56 -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; 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 S1730744AbeJBUOU (ORCPT + 99 others); Tue, 2 Oct 2018 16:14:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33880 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730732AbeJBUOU (ORCPT ); Tue, 2 Oct 2018 16:14:20 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A8D3AC2A; Tue, 2 Oct 2018 13:30:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bo Chen , Alexander Duyck , Aaron Brown , Jeff Kirsher , Sasha Levin Subject: [PATCH 4.18 204/228] e1000: check on netif_running() before calling e1000_up() Date: Tue, 2 Oct 2018 06:25:01 -0700 Message-Id: <20181002132511.616539296@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132459.032960735@linuxfoundation.org> References: <20181002132459.032960735@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: Bo Chen [ Upstream commit cf1acec008f8d7761aa3fd7c4bca7e17b2d2512d ] When the device is not up, the call to 'e1000_up()' from the error handling path of 'e1000_set_ringparam()' causes a kernel oops with a null-pointer dereference. The null-pointer dereference is triggered in function 'e1000_alloc_rx_buffers()' at line 'buffer_info = &rx_ring->buffer_info[i]'. This bug was reported by COD, a tool for testing kernel module binaries I am building. This bug was also detected by KFI from Dr. Kai Cong. This patch fixes the bug by checking on 'netif_running()' before calling 'e1000_up()' in 'e1000_set_ringparam()'. Signed-off-by: Bo Chen Acked-by: Alexander Duyck Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c +++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c @@ -644,7 +644,8 @@ err_setup_rx: err_alloc_rx: kfree(txdr); err_alloc_tx: - e1000_up(adapter); + if (netif_running(adapter->netdev)) + e1000_up(adapter); err_setup: clear_bit(__E1000_RESETTING, &adapter->flags); return err;