Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1646853pxy; Mon, 2 Aug 2021 07:02:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtGgNTjF0A86xFfMvVoLjJERMiMFncR7gVLMVM1z+6IGWqvTs20RiyiYVSsE0mmoltBw8b X-Received: by 2002:a05:6e02:1142:: with SMTP id o2mr1200175ill.277.1627912921384; Mon, 02 Aug 2021 07:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627912921; cv=none; d=google.com; s=arc-20160816; b=yjbyUkIekphUsbZZQwCgglrHpAmNILqBSE5Tgr+BFPpZl4vWa5Yfz7hsPCkeHjTSL0 rExWasHk5v7HgeBwrDtO7IA1KVrJOuPONNGPY08Ky+h/C/wtzS27KA89y5aQ9esXaiRA dkQS6Z8pKNcHfxRC4tAQwzyONrQ3DUOYvIdAN1K9zlerwGFwB/nGqay9cvWTv+37T3wI 4mM2AjGBBb36IgWEx3MVtY/JoDInVDj7A4xqJoV9o3sw0Q/fKpNN1D3NTOOC75r6ZjUC CG0oMnyreCe9s65IOt+xx0QVQVjv6281ronFS9kNyqBVM8NTT9QeCe2JYVUDrrfppb5f WfnA== 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=F5NRafe2Z6XqY5tG2tJN0Zw1iP6p8EjLqN1fDYnrXh0=; b=hJ5FwpsdEpU26Xmqg+YWjnq7dqdS2eQt7A+WyYQvnHVlRUiCabc/loNusttWKvgiqr S5zzsisvygeCekhWNV1PpDrlqQ5HjqO2I4AF1rHvlfQLnSjCkQkuTq9GPPRVj2m+DcYa Fyhv77zgyYzx7Wu+bNtpS3y5jNCEVWRCKEY9BnUPoLutW6SRY3w3VvugX0SJHLhTMrH7 sdjJS7jmFsb/PVz4A1TsJ8EGHjZhpImFsKpQ1HuV4k2FJMT3EcKqKi5MgFRi/xTVTwnc rjA/IW3RkY7LYDT+gTy+75P8x84qIt+h9rkcG/y/AHzwaMXE1YuQBZY+8FtiI3mTvfJA qu5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0wiIS4Yh; 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 a6si15665695ilv.81.2021.08.02.07.01.48; Mon, 02 Aug 2021 07:02:01 -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=0wiIS4Yh; 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 S236045AbhHBN7L (ORCPT + 99 others); Mon, 2 Aug 2021 09:59:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:60854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235338AbhHBNxA (ORCPT ); Mon, 2 Aug 2021 09:53:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D234461151; Mon, 2 Aug 2021 13:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627912315; bh=qyXlOGeHt9NXmAZXVnILEg/+ZdVRHOo4Ox82SzfCijc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0wiIS4YhDJZAWOiBTsr+xMZSDlHrLwnTUyiwEgT0EBGuqaVvLdrgCSTmJVxHekO/8 cwYW1VKcCYQat/Pi8q8+I+CKenVbuzsoUkvHyC5/BDy4QNgJcC+Lxff+0hoQGL645u oG+JCbhWlYJNb8+4ixD2NxLHSqpZFWjYT6qZtpwM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yasushi SHOJI , Pavel Skripkin , Yasushi SHOJI , Marc Kleine-Budde Subject: [PATCH 5.4 12/40] can: mcba_usb_start(): add missing urb->transfer_dma initialization Date: Mon, 2 Aug 2021 15:44:52 +0200 Message-Id: <20210802134335.785733526@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210802134335.408294521@linuxfoundation.org> References: <20210802134335.408294521@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: Pavel Skripkin commit fc43fb69a7af92839551f99c1a96a37b77b3ae7a upstream. Yasushi reported, that his Microchip CAN Analyzer stopped working since commit 91c02557174b ("can: mcba_usb: fix memory leak in mcba_usb"). The problem was in missing urb->transfer_dma initialization. In my previous patch to this driver I refactored mcba_usb_start() code to avoid leaking usb coherent buffers. To archive it, I passed local stack variable to usb_alloc_coherent() and then saved it to private array to correctly free all coherent buffers on ->close() call. But I forgot to initialize urb->transfer_dma with variable passed to usb_alloc_coherent(). All of this was causing device to not work, since dma addr 0 is not valid and following log can be found on bug report page, which points exactly to problem described above. | DMAR: [DMA Write] Request device [00:14.0] PASID ffffffff fault addr 0 [fault reason 05] PTE Write access is not set Fixes: 91c02557174b ("can: mcba_usb: fix memory leak in mcba_usb") Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990850 Link: https://lore.kernel.org/r/20210725103630.23864-1-paskripkin@gmail.com Cc: linux-stable Reported-by: Yasushi SHOJI Signed-off-by: Pavel Skripkin Tested-by: Yasushi SHOJI [mkl: fixed typos in commit message - thanks Yasushi SHOJI] Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/mcba_usb.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/can/usb/mcba_usb.c +++ b/drivers/net/can/usb/mcba_usb.c @@ -653,6 +653,8 @@ static int mcba_usb_start(struct mcba_pr break; } + urb->transfer_dma = buf_dma; + usb_fill_bulk_urb(urb, priv->udev, usb_rcvbulkpipe(priv->udev, MCBA_USB_EP_IN), buf, MCBA_USB_RX_BUFF_SIZE,