Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp989633imu; Fri, 11 Jan 2019 12:49:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN7qhcAi/lTglfWzCYecu1hmGhYRngPB82WFwwhH3qNytpz/oiIWXseW11GYnUq973oBBaIk X-Received: by 2002:a17:902:42e4:: with SMTP id h91mr16421628pld.18.1547239772129; Fri, 11 Jan 2019 12:49:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547239772; cv=none; d=google.com; s=arc-20160816; b=oxQ33ZH3bIfILJf0K6Rt1+bVLCERCqYgwfIOI4RmXCF+WS6qwj8qWGp3K0nPHuvcMZ Fzcn1A6uJOKjxa7nyJsr60z2jqcI3sBVXlxBWH1q5Amj/UHHBRMEGMEbtsQnedTu8/UN qcBVJ7WEfD+VZOOZrSZP5ZDyxQLsTMgcTZDajjjdQf3JJuoKTrfMQNq9TE7Y7D+s9/0y jToCaS5YZCHscszJxdJgx+DIt7eIG/jveuT06Red6FkZR5WkPXgnJR6GvD27MCAE69c9 ZiQKzyQbR/fcW1M4/pJ/zK1DyxQO3htVbES4T+aRvOBX7vo/+HergIJx8tq9rw32XAGa PLkQ== 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=nImnGFG29P4+E8sJJu9Pohoi0ERmOC49JV9wPwZwJIc=; b=CehPvCZ8QzM2Xpd16Vknw4LHMekZbDqEATWxRJ/ik2eZqOWpPvmdGNHrdJYDCnouJv BqzuJyBcNBnX9+GWhpu9TsViVnEjJf4iqNNpQnJ2A2QDcnfu3JIs29ieprdu4tDs9yAD gew3RCdE3QwiwUFflCFM0h/knEib1jzmClLNpvX16nMmZOZ7VKmUhvxt+Bm/gZwHRxgU wd4JTL8Yt7403HLFIaJ9ud/OChfTMNFB7D0luhKF5sj7FT1BRobiITSWxExOdiOUvoSr lURoLkSwtiYLcoovlMMQjoeyPJC2KcPKgW5C8PSpiEwXKA+E3+U+4f4Sku5I6NgHCKuP 7oCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bObbdAp+; 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 r11si11776312plo.319.2019.01.11.12.49.16; Fri, 11 Jan 2019 12:49:32 -0800 (PST) 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=bObbdAp+; 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 S2403772AbfAKPKW (ORCPT + 99 others); Fri, 11 Jan 2019 10:10:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:33224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387757AbfAKOQx (ORCPT ); Fri, 11 Jan 2019 09:16:53 -0500 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 6B5DA21783; Fri, 11 Jan 2019 14:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547216212; bh=uaqGE23CK3zUIKgN59kcI1JN8xayUKHIyU+GVrEi+7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bObbdAp+/mYV00OeotZ+AOga31FyBueeO5fpqGdUy+3ggvlAvB5wP87xWPGAG3bop 8WUggJ5nxBnqfPzOBhvNH1aE6tzw0sSbRsVTbtwf8uWSvqTIddyTyDMBacjqZVN4JF 4bxqUOSBqGFA5fFYfP/Y0ynmWnghyXni2ttCyCEE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tyrel Datwyler , "David S. Miller" Subject: [PATCH 4.4 17/88] ibmveth: fix DMA unmap error in ibmveth_xmit_start error path Date: Fri, 11 Jan 2019 15:07:46 +0100 Message-Id: <20190111131048.670525163@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131045.137499039@linuxfoundation.org> References: <20190111131045.137499039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tyrel Datwyler [ Upstream commit 756af9c642329d54f048bac2a62f829b391f6944 ] Commit 33a48ab105a7 ("ibmveth: Fix DMA unmap error") fixed an issue in the normal code path of ibmveth_xmit_start() that was originally introduced by Commit 6e8ab30ec677 ("ibmveth: Add scatter-gather support"). This original fix missed the error path where dma_unmap_page is wrongly called on the header portion in descs[0] which was mapped with dma_map_single. As a result a failure to DMA map any of the frags results in a dmesg warning when CONFIG_DMA_API_DEBUG is enabled. ------------[ cut here ]------------ DMA-API: ibmveth 30000002: device driver frees DMA memory with wrong function [device address=0x000000000a430000] [size=172 bytes] [mapped as page] [unmapped as single] WARNING: CPU: 1 PID: 8426 at kernel/dma/debug.c:1085 check_unmap+0x4fc/0xe10 ... ... DMA-API: Mapped at: ibmveth_start_xmit+0x30c/0xb60 dev_hard_start_xmit+0x100/0x450 sch_direct_xmit+0x224/0x490 __qdisc_run+0x20c/0x980 __dev_queue_xmit+0x1bc/0xf20 This fixes the API misuse by unampping descs[0] with dma_unmap_single. Fixes: 6e8ab30ec677 ("ibmveth: Add scatter-gather support") Signed-off-by: Tyrel Datwyler Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/ibm/ibmveth.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -1163,11 +1163,15 @@ out: map_failed_frags: last = i+1; - for (i = 0; i < last; i++) + for (i = 1; i < last; i++) dma_unmap_page(&adapter->vdev->dev, descs[i].fields.address, descs[i].fields.flags_len & IBMVETH_BUF_LEN_MASK, DMA_TO_DEVICE); + dma_unmap_single(&adapter->vdev->dev, + descs[0].fields.address, + descs[0].fields.flags_len & IBMVETH_BUF_LEN_MASK, + DMA_TO_DEVICE); map_failed: if (!firmware_has_feature(FW_FEATURE_CMO)) netdev_err(netdev, "tx: unable to map xmit buffer\n");