Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp689707rwe; Fri, 26 Aug 2022 12:22:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR7U1TIVL0YiUaPi4W1xqcwJUptrDSrLesd7xXjvLXCL/Itz9TXaH9kDshZd8YbIJ3bvy6uS X-Received: by 2002:a05:6402:360d:b0:445:bd16:803b with SMTP id el13-20020a056402360d00b00445bd16803bmr7662909edb.318.1661541729869; Fri, 26 Aug 2022 12:22:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661541729; cv=none; d=google.com; s=arc-20160816; b=fWTOvPCXgFGdLmYJ9oE7HTdOnZf7KCxyIHuzt6+iNP67PieE2nc5wHx+BsNEGMT828 HxPPx52VIIAt1pwVy5Ormkz4wsWQgFmRdx3iiEvKLVwwC4BACC9JWNRnX+MgO0CTLHjE sWnlw8+iNQjpUfbFeTKZ++07niDc7LWwljpyrTK0NBX2yYA8/G05uKIbzqgTVeuonSmU S7VAjIsthP5cILNlsE9PLxBPKqa6r5KKYjfCkcUrp9GwBqrxqWfr/o85/JapbQSWAjZ8 I/v1KuuSZwFKLVv0ewcPGG9ucfR1HWxNIp4IiAa4lz/24BLdpXxCYqlciIpCT7r6jxFd G3nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=4D2H1lk1wXLGgODymDk0Ez+7pg17qvWTxWwW1+k0QUI=; b=JirgHXomqnEYqTS4FDTD1M7JMyQQCnH1SF2w6NWMtTgl4yNuPztNoIQTXLO6eAsqDM MJ5/I1u2Awr2mLXh3lDA+VKDdEVTJpS+3GNLD1FGjGdhWvWbeARxGNXxivw/KY2qbwSd nZPugYl38BJYdRIbhF6ClZ0GTtGE+YykdDuIcPifHR2+fe+mRy0C1Jxhfn8igEtsPTf8 sFLwGQT6Hy1Z80zHPoJV0sc72Ev65BEl0Duzr+7xw1k5kAT2lXIKsuOtDqW2wm7S0gkb a1RvGBVBpX1vozBnie95OYFB8OcSQRCFNNCx+rBju9G+TdAzpErINm3jv1nKN/qkrl65 jX6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f21-20020a0564021e9500b0043c1802a7b1si1833671edf.588.2022.08.26.12.21.38; Fri, 26 Aug 2022 12:22:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345165AbiHZS5g (ORCPT + 99 others); Fri, 26 Aug 2022 14:57:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345123AbiHZS5J (ORCPT ); Fri, 26 Aug 2022 14:57:09 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 9AC3DB41 for ; Fri, 26 Aug 2022 11:54:35 -0700 (PDT) Received: (qmail 47487 invoked by uid 1000); 26 Aug 2022 14:54:34 -0400 Date: Fri, 26 Aug 2022 14:54:34 -0400 From: Alan Stern To: Krishna Kurapati Cc: Maxim Devaev , Greg Kroah-Hartman , Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, quic_jackp@quicinc.com Subject: Re: [PATCH] usb: gadget: mass_storage: Fix cdrom data transfers on MAC-OS Message-ID: References: <1661535142-5204-1-git-send-email-quic_kriskura@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1661535142-5204-1-git-send-email-quic_kriskura@quicinc.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 26, 2022 at 11:02:22PM +0530, Krishna Kurapati wrote: > During cdrom emulation, the response to read_toc command must contain > the cdrom address as the number of sectors (2048 byte sized blocks) > represented either as an absolute value (when MSF bit is '0') or in > terms of PMin/PSec/PFrame (when MSF bit is set to '1'). Incase of > cdrom, the fsg_lun_open call sets the number of sectors to 2048 byte Sets the sector size to 2048 bytes, not the number of sectors. > sized blocks. > > When MAC OS sends a read_toc request with MSF set to '1', the > store_cdrom_address assumes that the address being provided is the > LUN size represented in 512 byte sized blocks instead of 2048. It > tries to modify the address further to convert it to 2048 byte sized > blocks and store it in MSF format. This results in data transfer > failures as the cdrom address being provided in the read_toc response > is incorrect. > > Fixes: 3f565a363cee ("usb: gadget: storage: adapt logic block size to bound block devices") > Signed-off-by: Krishna Kurapati Should include "Cc: stable@vger.kernel.org". > --- > drivers/usb/gadget/function/storage_common.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/usb/gadget/function/storage_common.c b/drivers/usb/gadget/function/storage_common.c > index 03035db..db40392 100644 > --- a/drivers/usb/gadget/function/storage_common.c > +++ b/drivers/usb/gadget/function/storage_common.c > @@ -295,7 +295,6 @@ void store_cdrom_address(u8 *dest, int msf, u32 addr) > { > if (msf) { > /* Convert to Minutes-Seconds-Frames */ > - addr >>= 2; /* Convert to 2048-byte frames */ Please leave a comment here saying that we already know the sector size is 2048 bytes. > addr += 2*75; /* Lead-in occupies 2 seconds */ > dest[3] = addr % 75; /* Frames */ > addr /= 75; Otherwise this is okay. In your next submission you can add: Acked-by: Alan Stern Alan Stern