Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3000133ybi; Mon, 17 Jun 2019 14:23:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCtoy8r3U0HYgZmTxBw2fTT3YA6gJHrOe78G/gtWGnnyodm8e5u2aNrATrUKaZBlmDQNh2 X-Received: by 2002:a17:90a:30e4:: with SMTP id h91mr1097439pjb.37.1560806603489; Mon, 17 Jun 2019 14:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560806603; cv=none; d=google.com; s=arc-20160816; b=F5jgEQTowiUSiLbHqyqC/98GMniVfQrR/reBMVbgof0QBsr9YMRGVZybBMdChXkHlk eovQ8bMDRhzjdkvOEp6nMbqRA9a+o3QT0sTQRNcKsCPw/gj6IlQ1ktS8GCNRpOyrWkMa cegJhHMu2Nrtk750tD/aCOsXWWo2KFUd2Aow2CKR6sNBMFb8eY6lXMeP0dE35KQZpYVl xBMeXubY2Dbs60X/D3wHds6nEOCNTFfuzmtYksq8GO0Lu24/UwPwYEDFNNfB6LRJ3E9D 9PwB7icZ7T3jwCEZB4Oyyb1QUqjXDcKMotWjkLkMP1B7tDie0ryTg3Z+tJWmu9+5yVxf WSrQ== 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=2oCLR3nKvISDIfDeOkPfspjsypEDtvBGzf49MKBEKMA=; b=XH3F60/hSNy4wUlzetKUuQZ2n0JTpQNTujCYJA2vC+Sjez4N8QTpYui7zWsa7gBl8J fCfLURbWEd3YZPFSW9VTb+ZwD4iMCR/KrmA0I1kgPIdXYgAN4BiCQWNw0NJM48VWIkI2 kGrZ5cMJ6UG/ubw4PCMm/uqzEcD6uw85ACBY/9u6IcC6nNiNyKG6bWTCo/dAzn9JeHkk sG1UGf0qRMK06Hqj3ZNRQ0TAZX229Ylmdrq166vD+mBwtw53qn38kEjBtt0CGp1QhZmC T5I+NvDwQ2yui9ekfeZKCuA48CCG6K5QlmEkyU+VCVtMSYzzmaowmPmjdmCXYYUs2nKs kwEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TX7XVNJ9; 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 j4si11137718pgh.251.2019.06.17.14.23.08; Mon, 17 Jun 2019 14:23:23 -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=TX7XVNJ9; 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 S1729268AbfFQVVC (ORCPT + 99 others); Mon, 17 Jun 2019 17:21:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:45422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729255AbfFQVU7 (ORCPT ); Mon, 17 Jun 2019 17:20:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 C056620652; Mon, 17 Jun 2019 21:20:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806459; bh=Ze0tQg+VYoEJTS66SX6YjnPROS4quAqXyFUgMLVNzW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TX7XVNJ9agtiY/gUFqTRLiSkNXlAxAhAWn1Z8KILP5RWgtXWBEPpAdxAe4dCkjUtU Kgh1q97/uYJVk02s7EZaN1OVjd7jl+0t4IQ3t6rlxO9qqRD0HfC5RcPOIwRxZFjgu2 /1tTkucg+y5C+URk1qqmEV5qb8gugmUh95DgVJ5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Manoil , "David S. Miller" , Sasha Levin Subject: [PATCH 5.1 060/115] enetc: Fix NULL dma address unmap for Tx BD extensions Date: Mon, 17 Jun 2019 23:09:20 +0200 Message-Id: <20190617210803.334871153@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190617210759.929316339@linuxfoundation.org> References: <20190617210759.929316339@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit f4a0be84d73ec648628bf8094600ceb73cb6073f ] For the unlikely case of TxBD extensions (i.e. ptp) the driver tries to unmap the tx_swbd corresponding to the extension, which is bogus as it has no buffer attached. Signed-off-by: Claudiu Manoil Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/enetc/enetc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 5bb9eb35d76d..491475d87736 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -313,7 +313,9 @@ static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ring, int napi_budget) while (bds_to_clean && tx_frm_cnt < ENETC_DEFAULT_TX_WORK) { bool is_eof = !!tx_swbd->skb; - enetc_unmap_tx_buff(tx_ring, tx_swbd); + if (likely(tx_swbd->dma)) + enetc_unmap_tx_buff(tx_ring, tx_swbd); + if (is_eof) { napi_consume_skb(tx_swbd->skb, napi_budget); tx_swbd->skb = NULL; -- 2.20.1