Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3493109pxf; Mon, 29 Mar 2021 03:56:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTnMgcMG4oWlDVknM8CxXa449cZAZJbkttq+2upztmwF1ClpQ8VLM2CgY5lkAYX8BUGU1q X-Received: by 2002:a17:906:3395:: with SMTP id v21mr28014490eja.322.1617015386658; Mon, 29 Mar 2021 03:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617015386; cv=none; d=google.com; s=arc-20160816; b=oSMxxdAxz+5bk8gnsBvKu2jdKDPLgoEciL55AkEFp5PLiy6eT+mHqyrUIoYF/B2LUn 0G/hPlyJL6C5M58au4zjtWvVOERoJCP9AcjFPvY18JCEsVXNpncGgbRqqtBZhwcR3WQk bFUrLA35ccURkVv3aoZ/jGNQfOUozqbuJqgeE/0F+VtX3pEXGkBvZ6bEzxZNl0xFANS1 jnLxdXo5L+l3zGLTsYLOpnyAt8Wa4XltEfjPU25NeHw96RgC8YDg3dyHq8vPMsQj6ttO TD2kkFkE4BLwK5PCAYfUiBn+58Ii99ubpQc9MS9Zy+dIjWV7HSNmwJDhvNBIPBZnzojG eMZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DKbGsWIaak+YU0QCcUHnKdhqfbGYN5hjt59kJioSlIY=; b=EPC8UQF9vIwhMTVqEypEkEKwXoMkGg7Db7L73Ruimv/cfyuniiL3Ifr0YkVjCVdsS+ d+mbpzybfIhBGgg5cCEtbjUhH/jNQbz9VROHOIeGDlPqrROZQoeA48HiZtL4uwkNvzsm 4UCidSNdmFZFosQfnhGLk3YiuuXyweWoMDqYU3mygQ9JlOhxoDbsBBQR0VABbtwBv1dl 2CO/qipCww7JjYhise8SXhTgECKP6K/a8IxQemPoF7MinVrXKfXPhqeRpblKiBZEAA10 Y3ujtRlmbVQsXOA6YLcW3qpG0zwYZQOaPXIvx/qMzNUCAbg4V2qRo9McjkF5p1lR5DVy HfRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yWv3JUSb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v25si12518401eju.48.2021.03.29.03.56.04; Mon, 29 Mar 2021 03:56:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yWv3JUSb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233878AbhC2Iom (ORCPT + 99 others); Mon, 29 Mar 2021 04:44:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:41084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233874AbhC2I10 (ORCPT ); Mon, 29 Mar 2021 04:27:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B769B61601; Mon, 29 Mar 2021 08:26:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006364; bh=ZHsArqYuuUC/v9nphoP08BZ8B8MbS87LrXNasQ4cU08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yWv3JUSbzKfRyUW7mbyXLh8APv4XAR8jkM9J6Md9kn08XRKS0MVfi34xxVJytUvH8 P5Bv8OAq5oxl2EYrPHPID2/lv3af0ENgIAdcomDTuB/RK1yQ4m0lEBv3CK9pH0cNUj OkjA76/jBGnndMMslN4BtkZL71IQPTEzeGYYCDnc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Blazejowski , Heiner Kallweit , "David S. Miller" Subject: [PATCH 5.10 213/221] r8169: fix DMA being used after buffer free if WoL is enabled Date: Mon, 29 Mar 2021 09:59:04 +0200 Message-Id: <20210329075636.239478548@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heiner Kallweit commit f658b90977d2e79822a558e48116e059a7e75dec upstream. IOMMU errors have been reported if WoL is enabled and interface is brought down. It turned out that the network chip triggers DMA transfers after the DMA buffers have been freed. For WoL to work we need to leave rx enabled, therefore simply stop the chip from being a DMA busmaster. Fixes: 567ca57faa62 ("r8169: add rtl8169_up") Tested-by: Paul Blazejowski Signed-off-by: Heiner Kallweit Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/realtek/r8169_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -4726,6 +4726,9 @@ static void rtl8169_down(struct rtl8169_ rtl8169_update_counters(tp); + pci_clear_master(tp->pci_dev); + rtl_pci_commit(tp); + rtl8169_cleanup(tp, true); rtl_pll_power_down(tp); @@ -4733,6 +4736,7 @@ static void rtl8169_down(struct rtl8169_ static void rtl8169_up(struct rtl8169_private *tp) { + pci_set_master(tp->pci_dev); rtl_pll_power_up(tp); rtl8169_init_phy(tp); napi_enable(&tp->napi); @@ -5394,8 +5398,6 @@ static int rtl_init_one(struct pci_dev * rtl_hw_reset(tp); - pci_set_master(pdev); - rc = rtl_alloc_irq(tp); if (rc < 0) { dev_err(&pdev->dev, "Can't allocate interrupt\n");