From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CED9C4321E for ; Tue, 5 Apr 2022 23:26:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347586AbiDEXFG (ORCPT ); Tue, 5 Apr 2022 19:05:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453691AbiDEP5M (ORCPT ); Tue, 5 Apr 2022 11:57:12 -0400 Received: from mail1.bemta33.messagelabs.com (mail1.bemta33.messagelabs.com [67.219.247.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 010CFD1125 for ; Tue, 5 Apr 2022 08:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; s=Selector; t=1649170904; i=@motorola.com; bh=XuimDw4+iVhi9gEj1se5IBFh/YWO1jnu2M7n1+SW2uE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=YR89p1j1ZF1Rzk3uPdUgiL4ncC3Xd+8s5A6rvRL3aOXHamL2P1Gll/SA6SczawBIh S3Mds2cZo/UPnAq6d6ZebYD1CHOYZ528ioMFgWtWEuM1XIZc11tQanOIJFkyeSeLth UAItQj3wr2QqEKB5wVKh94P/y7QiejKBs9YB6YhPFLAe9yEqCKZDJUWReXpIvS5Lfn Se4VGwoo+Pli4biGoM+zEf8iDiQj8lBqj6CvGJ7b7+y5Y7ofofHReW7Qd6ShBNFn39 l6mwG4W5jnX/Tl+dYy7/j5UjkuXPBExHfwplqkDog5oacVySmcgQOVPLHEnDZ3z/qG rqVeW36fwT9LA== X-Brightmail-Tracker: H4sI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KltZ13AwAA X-Env-Sender: w36195@motorola.com X-Msg-Ref: server-8.tower-635.messagelabs.com!1649170903!12437!1 X-Originating-IP: [104.232.228.22] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.85.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22166 invoked from network); 5 Apr 2022 15:01:43 -0000 Received: from unknown (HELO va32lpfpp02.lenovo.com) (104.232.228.22) by server-8.tower-635.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 5 Apr 2022 15:01:43 -0000 Received: from va32lmmrp01.lenovo.com (va32lmmrp01.mot.com [10.62.177.113]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by va32lpfpp02.lenovo.com (Postfix) with ESMTPS id 4KXrT31b9Nz50GGy; Tue, 5 Apr 2022 15:01:43 +0000 (UTC) Received: from p1g3 (unknown [10.45.5.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: w36195) by va32lmmrp01.lenovo.com (Postfix) with ESMTPSA id 4KXrT25w5Czf6f0; Tue, 5 Apr 2022 15:01:42 +0000 (UTC) Date: Tue, 5 Apr 2022 10:01:34 -0500 From: Dan Vacura To: Sergey Shtylyov , Michael Grzeschik Cc: linux-usb@vger.kernel.org, balbi@kernel.org, laurent.pinchart@ideasonboard.com, paul.elder@ideasonboard.com, kernel@pengutronix.de, nicolas@ndufresne.ca, kieran.bingham@ideasonboard.com Subject: Re: [PATCH 1/5] usb: gadget: uvc: reset bytesused on queue cancel Message-ID: References: <20220402233914.3625405-1-m.grzeschik@pengutronix.de> <20220402233914.3625405-2-m.grzeschik@pengutronix.de> <3a6bb767-a114-1d60-3600-52cef493ed58@omp.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3a6bb767-a114-1d60-3600-52cef493ed58@omp.ru> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Hi Michael, Looks like we found the same issue, I submitted the same change the other week here: https://lore.kernel.org/all/20220331184024.23918-1-w36195@motorola.com/ One difference is you had the reset outside of the queue lock. I figured to keep it within the lock since we can get a cancel while the pump worker is running and this can negate the reset. Do you agree? Thanks, Dan On Tue, Apr 05, 2022 at 11:43:16AM +0300, Sergey Shtylyov wrote: > Hello! > > On 4/3/22 2:39 AM, Michael Grzeschik wrote: > > > On uvcg_queue_cancel the buf_used counter has to be reset. Since the > > encode function uses the variable to decide if the encoded data has > > reached the end of frame. Intermediate calls of uvcg_queue_cancel can > > therefor lead to miscalculations in the encode functions, if buf_used > > Therefore? > > > was not properly reset. > > > > Signed-off-by: Michael Grzeschik > [...] > > MBR, Sergey