Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp621210rwe; Fri, 26 Aug 2022 11:00:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR5LnclFMm2vYfIGRksoe0VHMJpSpz495ByYS0S3rS2y+8cOgoi9/G1Sm8SfN57C9hqXbHYI X-Received: by 2002:a17:906:db03:b0:741:337e:3600 with SMTP id xj3-20020a170906db0300b00741337e3600mr1952311ejb.343.1661536802255; Fri, 26 Aug 2022 11:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661536802; cv=none; d=google.com; s=arc-20160816; b=BIcY+UDpKERRX5xkdNGxWinc5j2PC0kErJh4aUhB+FXIZKDmetgZeMtLM7iI4e/6Bn bgiSBKxDZz6DyFqSzU9TVEOlLj5QtbovwaG7A2BepGJP//B7edU+DAopfssjBrlY1uXs aHqjmUygnsGK/H48JeuYx0uzbO0MbW1f24lWFqa2qr9tciroSNaLC3HpfdDemqHkFiIZ nTSCamhDAvmUS1fMrnL5OZtZddQiVgF7Czr/5eT5XtE1JRnD4Hal4JQt8BmccZZA8IcH JbYVTNEgvbFVUY2tRJW+wV+tsIESEFZzAszxzZVnJ0tuhdDqG7THP7gdUmYiIODxfbjQ 4CxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=ecRmlNQsuaYmhxcydyYYt1QTJ13LiRhIIAvbEV3Gjis=; b=iwkEZJ0GWj3z79aZnJrYHtCovfNVCRcZfUAXctHawZggyjjGwdiRq1J+AyrY2GgTOL MiVQk7CBtR6u+TyYXTIjwcoLXwaV1RqI9J+KmD//3cSyEGNlW98u4EZYVOtjNvlHLRBT dU/pKLmk001d/taRqPkcoode/3cqW4fMWyUX2Xp4CdP+k3hc1Xy0diFCP7Wzf4sw277D t96mLy1d5KlTv1Z+prNnLk8BnLZWdT7Mc1D/bnw6hVyvvkD6QYjPS1Mf1So/XGMbFFxy 5QO3BGRfrGsdYsoA1eH9BpEUdyqx9rvk8/FtHWE8aQV5NAnibXaPQaHlSzN3YyPfDPgP BC/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=YHK3vvq6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t22-20020a056402525600b0043bee43477csi1893302edd.576.2022.08.26.10.59.36; Fri, 26 Aug 2022 11:00:02 -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; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=YHK3vvq6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344462AbiHZRcs (ORCPT + 99 others); Fri, 26 Aug 2022 13:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232757AbiHZRcq (ORCPT ); Fri, 26 Aug 2022 13:32:46 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B827DB06E; Fri, 26 Aug 2022 10:32:45 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27QFRlGU003072; Fri, 26 Aug 2022 17:32:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=ecRmlNQsuaYmhxcydyYYt1QTJ13LiRhIIAvbEV3Gjis=; b=YHK3vvq6Lh+xuq6OAG6Lfth7Y7QXGrtYi3wQxKJ+cR4xuLznqq0a6Z9OQshnEKHghyVR 9AQpBwqjOBsAtDRD9WP3JfdgiQcZrh4se4gjeQS9FcWjVHe6qtZH9MjjS2uO48LgKPCX I8/wEj+uCVK3koGZVUKTg7AHyJv2Pm2cCnYRw/ejxiuAmKZNclq0k1lVrB0APFXqH7Y/ zdUj8vsX9qXtEHm8QIosundBYJtuqZVHcpsf6y4rKccvyhghtPiRQ3d8rKwk7696DXVt 1ubFbawk8TnNvLVNylYUXqS4c/zgC7CtJsTB9NnKVVcVpihmQnNT0b+bZPqQfffi0+CN FQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3j6j4mk1bf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Aug 2022 17:32:34 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 27QHWX2c009617 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Aug 2022 17:32:33 GMT Received: from hu-kriskura-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Fri, 26 Aug 2022 10:32:30 -0700 From: Krishna Kurapati To: Alan Stern , Maxim Devaev , Greg Kroah-Hartman , Felipe Balbi CC: , , , Krishna Kurapati Subject: [PATCH] usb: gadget: mass_storage: Fix cdrom data transfers on MAC-OS Date: Fri, 26 Aug 2022 23:02:22 +0530 Message-ID: <1661535142-5204-1-git-send-email-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 06b6ufFt0kq0JvjKySi3Kg_FNqHHzp0L X-Proofpoint-ORIG-GUID: 06b6ufFt0kq0JvjKySi3Kg_FNqHHzp0L X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-26_10,2022-08-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 bulkscore=0 spamscore=0 malwarescore=0 clxscore=1015 suspectscore=0 phishscore=0 impostorscore=0 adultscore=0 mlxlogscore=258 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208260070 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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 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 --- 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 */ addr += 2*75; /* Lead-in occupies 2 seconds */ dest[3] = addr % 75; /* Frames */ addr /= 75; -- 2.7.4