Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1646998pxy; Mon, 2 Aug 2021 07:02:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZH5N6L97AaWjN3/XxFhv9tBkB37EbMFe1nGVy9hPSAkRe0ih87WFiHhDbS3tTSL3IVtg5 X-Received: by 2002:aa7:d6cf:: with SMTP id x15mr19271654edr.59.1627912928259; Mon, 02 Aug 2021 07:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627912928; cv=none; d=google.com; s=arc-20160816; b=hsh4tNIzPVf/3vNEVKBaLNgyyLBarWMUqp30NA+pL+2oY/7iQEDk0mneiUk78GK0YX vaukYMKnbnVofak5nOJy+LA3MSjbfSe0ar3AIUhq1IVcOsFzsVeQcU1IHoWurBphWg77 oqJztRWvoz0SragYKp8i3GlCz8xYXy2hz4aZyG1LLjLjK/KnWeod7dGQLL/50C0gKb0O kFQ+GiJclg8r+ZK3qtrT+Z0AubhdmuUfbPBFTKY2AL4sky58mG8IUpxuGHoBuPeLBr/S TXqHnW35eV7WQ4umOudY5tEeM3X6AOX8WguaTfZLUhnSA7bgR3HjEOKnGaRqVLozd2Px 5yVQ== 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=jCnrONNmxixOoGs0o5FegA3k6I+1dWHPh9reaSeUeWRI87XDGPFemwOAmoKQ3ZdAiw cRiGg82y6SRkgVpf/Q5OykkE85FcAO8ibzLYo3LSPMxPfdNezSzAb0aJc6A2amT8CxPm xMieFi6r3YMRMh3N/B69yQ1VP53qdZ3pB13jeOvPkE6neSVTYvauhgQd1a/ao9rw0a9T bn7xXrlrGhWwHsL3wwEdaSGjYHYPKg65Nw/TnqKK/MxjDBZKMtFPZHnWfZaavv2NDZg8 7xOoQPk74l8dySx9kUEedZn3AWjiqepw0lGCkKw23fYPfux3n3uQ2YSioarYjTZGh8kh UHuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lk71PkK+; 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 s17si11329662ejz.554.2021.08.02.07.01.38; Mon, 02 Aug 2021 07:02:08 -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=lk71PkK+; 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 S236930AbhHBOAF (ORCPT + 99 others); Mon, 2 Aug 2021 10:00:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:34094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235229AbhHBNxk (ORCPT ); Mon, 2 Aug 2021 09:53:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B8BE61166; Mon, 2 Aug 2021 13:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627912339; bh=qyXlOGeHt9NXmAZXVnILEg/+ZdVRHOo4Ox82SzfCijc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lk71PkK+rxxAOtS6cJ0HFQUspEhvpPb2FsinuFBAR4nqrpGiuKFrWr49DU/AKN44P nwg2hp5NC2QQ3++zN+CpknWHg2tdXfQCGqGPNcRGjWSKuuEC07SZwOBUg0vrB1C6DP w+XQ0a2iLq1+E4tX+yyeNn2HZCKY5hGExfLtCJp4= 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.10 15/67] can: mcba_usb_start(): add missing urb->transfer_dma initialization Date: Mon, 2 Aug 2021 15:44:38 +0200 Message-Id: <20210802134339.541354225@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210802134339.023067817@linuxfoundation.org> References: <20210802134339.023067817@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,