From patchwork Mon Nov 26 20:18:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 10699113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A282614E2 for ; Mon, 26 Nov 2018 20:18:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 091392012F for ; Mon, 26 Nov 2018 20:18:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F10C6295C2; Mon, 26 Nov 2018 20:18:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AC0E29494 for ; Mon, 26 Nov 2018 20:18:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727245AbeK0HNq (ORCPT ); Tue, 27 Nov 2018 02:13:46 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:35319 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726918AbeK0HNp (ORCPT ); Tue, 27 Nov 2018 02:13:45 -0500 Received: by mail-wr1-f66.google.com with SMTP id 96so20358846wrb.2; Mon, 26 Nov 2018 12:18:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=/Ar2S07Zh93PGedCv3f0jv/RB9V/K1xpmj0spwUhCJs=; b=Vp2Z7vFqZcj1roi8dbVjONtraDx//5qF1Awrue0Tn6+EOxua0jbgXMc8M2EE2NrQ9z 8q34EZkX1+MsfgbBxgJi5wjyeKuPK+HsK/XwEM6AeyEwE/MDQLDxKdznprow6HDRLHv1 FbTO/myzXJ29lyYU9jdTqLEj7gcTv4HxSWqC7qmmuudJe1szbOEsDE0nDrouVXlIsisp rBI5cfNC+elCvPt9Dr/atGbOSFUxAMj+7TE9Bja1odUyq1qrh6LRXmgWm+tF/eqLVeWS S+Pr+DTgXLRC5dE+TWvZte3EBG4wsu6FrSJbxc08lzDPtx/0wtfjA9OsaWo/SspnAUEO rc6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=/Ar2S07Zh93PGedCv3f0jv/RB9V/K1xpmj0spwUhCJs=; b=avg1JPBl4pwZ8CbF4WNUuzUp3n6LyvITFEAqnx2kpDLfvEhPoiWo0u/EktaM6YZQ5n IxKycoc/WzImTT1UvYjFVB7V3VlO3wyFsowGq+auSIX0mgtkHyvzPGKVun7ma7MTSNGA g96zfqoMSabgWLQeh8rKUhRIbCC2Xx8A5r6bNOOyhfHcnyndGx/GKMCcAe66AZQPhLT9 ZPww1Vw+6LmDVNbJgY7InoBUFtLydh47ukcSPMFCtwVyCqS4ktEbsi9sgX0swea5hNOQ 0mMcnURr9g1HPWk7dn3qOKvVcvxfu6/wce+zgruO5sdUg3vd50rjDAuaoIl4QDMjttG+ 6yzw== X-Gm-Message-State: AA+aEWbAv6w2cftUyC09ai3OKCuTKqDw4ziukgH6I+tCaizH+W/zK1mP Bo+gLxBKtpsyb7nbDW4hWId8L9Eh X-Google-Smtp-Source: AFSGD/UEusOGMxsbdwNY2GupjYE8v4rxHnfeTyziARc7CQ11uOPJNR/fQnN+Tb5UmbRq7uhiRMBTiw== X-Received: by 2002:adf:a109:: with SMTP id o9-v6mr24401483wro.169.1543263508265; Mon, 26 Nov 2018 12:18:28 -0800 (PST) Received: from [192.168.43.227] (94.197.121.88.threembb.co.uk. [94.197.121.88]) by smtp.gmail.com with ESMTPSA id 125-v6sm2629376wmm.25.2018.11.26.12.18.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 12:18:27 -0800 (PST) From: Malcolm Priestley Subject: [PATCH v3] [bug/urgent] dvb-usb-v2: Fix incorrect use of transfer_flags URB_FREE_BUFFER To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Antti Palosaari , stable@vger.kernel.org Message-ID: <7dd3e986-d838-1210-922c-4f8793eea2e9@gmail.com> Date: Mon, 26 Nov 2018 20:18:25 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Language: en-US Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In commit 1a0c10ed7b media: dvb-usb-v2: stop using coherent memory for URBs incorrectly adds URB_FREE_BUFFER after every urb transfer. It cannot use this flag because it reconfigures the URBs accordingly to suit connected devices. In doing a call to usb_free_urb is made and invertedly frees the buffers. The stream buffer should remain constant while driver is up. Signed-off-by: Malcolm Priestley CC: stable@vger.kernel.org # v4.18+ --- v3 change commit message to the actual cause drivers/media/usb/dvb-usb-v2/usb_urb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/usb_urb.c b/drivers/media/usb/dvb-usb-v2/usb_urb.c index 024c751eb165..2ad2ddeaff51 100644 --- a/drivers/media/usb/dvb-usb-v2/usb_urb.c +++ b/drivers/media/usb/dvb-usb-v2/usb_urb.c @@ -155,7 +155,6 @@ static int usb_urb_alloc_bulk_urbs(struct usb_data_stream *stream) stream->props.u.bulk.buffersize, usb_urb_complete, stream); - stream->urb_list[i]->transfer_flags = URB_FREE_BUFFER; stream->urbs_initialized++; } return 0; @@ -186,7 +185,7 @@ static int usb_urb_alloc_isoc_urbs(struct usb_data_stream *stream) urb->complete = usb_urb_complete; urb->pipe = usb_rcvisocpipe(stream->udev, stream->props.endpoint); - urb->transfer_flags = URB_ISO_ASAP | URB_FREE_BUFFER; + urb->transfer_flags = URB_ISO_ASAP; urb->interval = stream->props.u.isoc.interval; urb->number_of_packets = stream->props.u.isoc.framesperurb; urb->transfer_buffer_length = stream->props.u.isoc.framesize * @@ -210,7 +209,7 @@ static int usb_free_stream_buffers(struct usb_data_stream *stream) if (stream->state & USB_STATE_URB_BUF) { while (stream->buf_num) { stream->buf_num--; - stream->buf_list[stream->buf_num] = NULL; + kfree(stream->buf_list[stream->buf_num]); } }