From patchwork Mon Dec 16 12:31:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6IOh6L+e5Yuk?= X-Patchwork-Id: 13909660 Received: from HK3PR03CU002.outbound.protection.outlook.com (mail-eastasiaazon11011065.outbound.protection.outlook.com [52.101.129.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8060A204588; Mon, 16 Dec 2024 12:31:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.129.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734352314; cv=fail; b=EHoTxoRafrXTU3eoxz3W8LNGGc2kvOa2dz49WpgR/vNAMdyd5+5XO7bApPsPEu5ivSPX2w4cbXR1ErdGYsFPeOi3B2yvIsZnbfuj0D4zWD5g/cFJWPGVNvgdXYQin44E4vfroTgTc6LmiScj7QfjBEUwAFJtG3YWqRjnsbHPtYw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734352314; c=relaxed/simple; bh=vFoeEY74IzkqecGcOTdfJpWMtRTe/i7DsMiW5ZXMlUk=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=UWfnwikxCK3Odmy0YaDSNfxRvUVJ2nn5hpY1EeNgH1JoFOJKLA+V1TG7WDWFgKnroWP4Co0ahtOIh3USXa65p6wADGfojLo636/SkZyjSKwmCJu9vkJWORWehs3r+pfzlH3nkR8WVQ6mQUisiSyyHry1kPTXbgceeTZZCFM7bXg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=IUeZ3Jnh; arc=fail smtp.client-ip=52.101.129.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="IUeZ3Jnh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=C5doyofEaUHoe8RTrVdgXmpjyUKMWxaMzySNran/51bao7dxI12pKPtMJn+umxu8HRZG790pSKhskT5ysNtjatioZGBNY76eDL0kFvwPB4uGnsi6BCK2Sd3AGDctiMHPRJg2lelqD0nK1NOfn0rylwcNleMGZpOnjoI9c7RjNBsoypdsITdZxnnYDl203TyTV8PW16yvZstgqwba85RUYaOXJAX9/elJ6bl9aflRfYmKPF4RRFHMMRDCoT+0QFGbnRfDLwf0EuM9FjVS7cnuLQ07W1XEwBRZie3lk3HQC4qad6Dmd/qKJVuYSfSGJFEy71E/tVHyTScXzXMPtzunRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vFoeEY74IzkqecGcOTdfJpWMtRTe/i7DsMiW5ZXMlUk=; b=LCFYV5itrO489rypbPMeybdotGwvTT46UmRVuoCRiKj+HJyQe+OC7ol705LZgGSO4NdxZh+2r3jp4GrKo+FN66341AlLWRaInJtlYI0oGYNUeZloE+6GV94hXF4uLbNL4Yadu0C2hRmv1UNzftW8mWBvwhZpNb9c8KYuWd5/SaTsG2CM8IelN8Ts3+7GonEKXaMKFAOcCSoxHQuiPklpLOW4MlLVjzmfquHlJ/fgD9M2lwwZxbFF/v9pTKHWNXSKmppMXM1QLyXmrnv6vBpmEmY6K+jEpNmaVH6qXn1eXjULBJ3fD0R0WI+BBuouCJPYn7OL2lPEa+hu9Gjg0AgsIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vFoeEY74IzkqecGcOTdfJpWMtRTe/i7DsMiW5ZXMlUk=; b=IUeZ3JnhOEotpa2FIYdZoDMNVWkG2z0bwafu+SeQwJYxkAy0xv1vhS7XQfgfTsh4cUlrVm2NMvRo54wosyIsvTt+V+ggY5nKXRd5hxZ5+trzF2PPHvcHdvGqUokO6EA7zj8O8DI236wfG7o+NZGpw5BmgQpndECsYOc2/Ih7DZQwP9KVsduG0R7j2beeejTdKEjpNk834L4dR1UYi8xOYav+VtZu/Ryt/1VHKCPQ70/YL9wWwpld4z1mPRlmRt+4iBXJ6ndWbtADZIllNySDr6KY5Ht0oXS+WtUdZMNp3cftNXHzOeeKZ6cYg+h/RPzPfkuC8OY7cGvhzwtTIlw/aQ== Received: from TYUPR06MB6217.apcprd06.prod.outlook.com (2603:1096:400:358::7) by SG2PR06MB5406.apcprd06.prod.outlook.com (2603:1096:4:1ba::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.8; Mon, 16 Dec 2024 12:31:46 +0000 Received: from TYUPR06MB6217.apcprd06.prod.outlook.com ([fe80::c18d:f7c6:7590:64fe]) by TYUPR06MB6217.apcprd06.prod.outlook.com ([fe80::c18d:f7c6:7590:64fe%6]) with mapi id 15.20.8272.005; Mon, 16 Dec 2024 12:31:45 +0000 From: =?eucgb2312_cn?b?uvrBrMfa?= To: "gregkh@linuxfoundation.org" , Prashanth K , "mwalle@kernel.org" , "quic_jjohnson@quicinc.com" , "dbrownell@users.sourceforge.net" CC: "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , =?eucgb2312_cn?b?uvrBrMfa?= , opensource.kernel Subject: [PATCH v2] usb: gadget: u_serial: Disable ep before setting port to null to fix the crash caused by port being null Thread-Topic: [PATCH v2] usb: gadget: u_serial: Disable ep before setting port to null to fix the crash caused by port being null Thread-Index: AdtPtYeiqzUBNnqHShOjibIiJOIUEQ== Date: Mon, 16 Dec 2024 12:31:45 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: TYUPR06MB6217:EE_|SG2PR06MB5406:EE_ x-ms-office365-filtering-correlation-id: af6796de-cf31-4055-bbf8-08dd1dcd9a51 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|1800799024|38070700018; x-microsoft-antispam-message-info: =?eucgb2312_cn?b?ckQwamlpUVBHaG12RHJZakEzdGVt?= =?eucgb2312_cn?b?a1UxZWhvQXlvd2NGSkdQMkxFeEFya2Y3YmhmNUVDc0E0eXB2R2RWSDhNR3VCRU5F?= =?eucgb2312_cn?b?QmQ1VUNkMDNTc3c5OW1oL25MTXUzeUpJSlZ5WmRHb2pDaUFYbnZuUHdyaW1rVk83?= =?eucgb2312_cn?b?djFDelVUVk5qaFRnVXdIYXRmR1I1ZmtEUE1PcnFTRVIxVTFFcVJBbWprQnR3NG1y?= =?eucgb2312_cn?b?d1dWSjZWOVJtZ2ZmZWY1WTU1dHo3YS9tcTVqVnpYYTQ5RkxPL2tPbHF6YjB2T005?= =?eucgb2312_cn?b?MTByWmI3QUdJenI3ODBkQkMwQkVoeGxBWk1OU2lpRWFmZldqemlqRDZJdGpzTHRi?= =?eucgb2312_cn?b?VTNGRzJrRzF1emM5cVdpMlNxVGp6bit2UitrVis5OG9JdG9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kyb2U2SjlOOTVy?= =?eucgb2312_cn?b?aFFnNTdhaE1HdURaeGljWmM1RWFRQUJ6cHBnTzl5SG5vTlpGZFlna0tRTnIvTUti?= =?eucgb2312_cn?b?OEpmYnhjbGU0bWJqb3gvOFZCazhPekFVYk5xeEorazkzZ3NrN1AvajNkaHZLMy9m?= =?eucgb2312_cn?b?cDVQQnFNRkFsSzZwU2JYaFhIMVU2ZVVLaUVqell0cG8vSDJ0Ymdpdlp1QjVMaUFH?= =?eucgb2312_cn?b?eExSSERnejZadm5oY3daRjUvMU9Rb1V5YjhQVUFrSlVJa1dkc0xLLytub09pYUhH?= =?eucgb2312_cn?b?U0RncDhyaXk3SE5wU3VPNUNnOFhibEs1b1VTdUlRdXJxRUQrclYzcFFVMXBGN01h?= =?eucgb2312_cn?b?MWlseXpwcEl1Z1MyVEJ5V1JSWkcrcFlqbXA4U2ZDUFVzbXFTRVdldGg1TmZNVVJI?= =?eucgb2312_cn?b?KzNIUHZRR3d0UjYvSHNmbkNkY3NJbHBNT1YzZVZxcTl1Q25iSzJhRW1vTllDNFda?= =?eucgb2312_cn?b?VnRRRFA1Nm9uK29OVEUrZHZRL3prSjd4cUJhVExYc1k4cDl3bUVsTlFzMkdPd09v?= =?eucgb2312_cn?b?QzRtcDlNSytCcm9LZFRFSHFZdkNPem1KRjEycGh1a294aHBVZHpVVkJ1VUswa2lD?= =?eucgb2312_cn?b?b3NOdWF2TWg5UTltNGtmbW4vRW9BREZSYXpENmc4VzRkSXlLc2ptbDRDZ0ZZbXZ1?= =?eucgb2312_cn?b?NXdUYnN0WFBDOHVtTVZ5cTZKcmhlRHNmdHdnZUVBWlNXUkN3STRuTzRhZmNrUUlF?= =?eucgb2312_cn?b?SkpNaUdwQ0pWMko=?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYUPR06MB6217.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?eucgb2312_cn?b?aVB6VUF3K1lBV0hSVk54eDJL?= =?eucgb2312_cn?b?aXQ5MHpLditVbnI4QmdST1p1anBkOFJQNDgwdmg4SXNsNFhxNHkxbHp0VlhYS1VP?= =?eucgb2312_cn?b?eVEwWnFXakhGcjJFUzB3emExZnRIalpQb2t0YWxjMjJ5RGxRSFJFakcxNEgwQm4y?= =?eucgb2312_cn?b?UFptTjl4NE1lZG9GTVNmSHhSRFQzSkJCVDdEREcvMFV5elFYVHRpdThsU0psWVcz?= =?eucgb2312_cn?b?bjRPSEVnTEpOTk4xWFlGSm1nTUh6RWdwdURqL1JYd1JvS3NTNWZFbE5qWllkazBO?= =?eucgb2312_cn?b?TUFNS2xuMVhteWlsZU15SThHYTVLZWZZUndxZ0pHK0pmbXZHUVhnc2FPVE83cjlU?= =?eucgb2312_cn?b?NUc0OXh0NXNXRHdicmttUU8zNEJBeEYvSGw3QTNISnNuZ0lMcjBrbTAwN1NHRGRR?= =?eucgb2312_cn?b?SXM4NTV2Nzg4SnhGdXhnYTdKVXZHOHFzWlNqMzdpQ0NGclZ0ZFZlTVJHek9zWUdC?= =?eucgb2312_cn?b?WUYydUFiZFJTbEZaMGZXK3BSbEZsdmZmT0dwd1g5eU5Ca2p5ZGhvcFNtRmRGQW5T?= =?eucgb2312_cn?b?L3BMS3RUUlU2N1I5dkdlK0J4NDJlV3ZuVmx4SzFWQTdWQktFOTBsYXNHWjdsUFB1?= =?eucgb2312_cn?b?cW9lc3ZLT0o1ckNlYVpUL2Z4aWlQQWxKTEdEWUk2OHVRQm5vbjZibWF3cE01bDdG?= =?eucgb2312_cn?b?aTZJcmt5VGNHMm9kNFJkZW5obFdOcmFoZld6MExmblVMMTZITDRCUjV6akZuSmdB?= =?eucgb2312_cn?b?ZDA5SGRJZXkyNlFlb2FqWFBDZWNlTDhjZzc5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WXQrOXB0cWxHMHRoNWZl?= =?eucgb2312_cn?b?VXJyS2JYQlNKUHgzSDEyMko2QW5hQzFkTE8wZERyZjFaNWVkZXoyc1BDVmY2NWh4?= =?eucgb2312_cn?b?djRGUVBkNGpMeVEzY29oYno5UFhZb1dyRUs2YXZlQWw3cVBmY0wxOHlnU3pubGFr?= =?eucgb2312_cn?b?a3hmbU9TQW9vTVBEdDI5aFY3YTF2WUZxallzZENXcGFHR3NEMkRqOUZQZEJVWUVQ?= =?eucgb2312_cn?b?YWVNWC9kN2FDYTVmcUdETllPdFo2TkZOWjlLTTlMZjN2OTJvQ0FhWUdYVHN1MEFo?= =?eucgb2312_cn?b?alJUQSsxRG9laFBLLzZ4N21MOVZRelJCMnNGYUMzRUszMG9wUk9tZVV3dGRPQ0xn?= =?eucgb2312_cn?b?SGQ2NjBwb2RxQTlzQTYzNk5sOGRBbytqT0tlVVc3TXNvY296OVBFbnVwdG1yK21F?= =?eucgb2312_cn?b?c3dsclBMOG1hUTRHT2cwSEUrMEZkdXkydWNmRFBmbm9rZ3NtdGxuNkxYdFpLRDZm?= =?eucgb2312_cn?b?QUUvWndCazc5dGFYQXNSWnJlcjdNODVIQT0=?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TYUPR06MB6217.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: af6796de-cf31-4055-bbf8-08dd1dcd9a51 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Dec 2024 12:31:45.0611 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: z1FRNR+xtQTn8+bLF59fZpRNFV1xynd6lRjXMls+m7bo8NlSFgh9yHrUbNCFxTP+CIpjipAKGBXBxd41FBq4kQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB5406 From: Lianqin Hu Considering that in some extreme cases, when performing the unbinding operation, gserial_disconnect has cleared gser->ioport, which triggers gadget reconfiguration, and then calls gs_read_complete, resulting in access to a null pointer. Therefore, ep is disabled before gserial_disconnect sets port to null to prevent this from happening. Call trace: gs_read_complete+0x58/0x240 usb_gadget_giveback_request+0x40/0x160 dwc3_remove_requests+0x170/0x484 dwc3_ep0_out_start+0xb0/0x1d4 __dwc3_gadget_start+0x25c/0x720 kretprobe_trampoline.cfi_jt+0x0/0x8 kretprobe_trampoline.cfi_jt+0x0/0x8 udc_bind_to_driver+0x1d8/0x300 usb_gadget_probe_driver+0xa8/0x1dc gadget_dev_desc_UDC_store+0x13c/0x188 configfs_write_iter+0x160/0x1f4 vfs_write+0x2d0/0x40c ksys_write+0x7c/0xf0 __arm64_sys_write+0x20/0x30 invoke_syscall+0x60/0x150 el0_svc_common+0x8c/0xf8 do_el0_svc+0x28/0xa0 el0_svc+0x24/0x84 Fixes: c1dca562be8a ("usb gadget: split out serial core") Cc: stable@vger.kernel.org Suggested-by: Greg Kroah-Hartman Signed-off-by: Lianqin Hu v2: - Remove some address information from patch descriptions - Link to v1: https://lore.kernel.org/all/TYUPR06MB621763AB815989161F4033AFD2762@TYUPR06MB6217.apcprd06.prod.outlook.com/ - Link to suggestions: https://lore.kernel.org/all/TYUPR06MB6217DE28012FFEC5E808DD64D2962@TYUPR06MB6217.apcprd06.prod.outlook.com/ drivers/usb/gadget/function/u_serial.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 53d9fc41acc5..bc143a86c2dd 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -1420,6 +1420,10 @@ void gserial_disconnect(struct gserial *gser) /* REVISIT as above: how best to track this? */ port->port_line_coding = gser->port_line_coding; + /* disable endpoints, aborting down any active I/O */ + usb_ep_disable(gser->out); + usb_ep_disable(gser->in); + port->port_usb = NULL; gser->ioport = NULL; if (port->port.count > 0) { @@ -1431,10 +1435,6 @@ void gserial_disconnect(struct gserial *gser) spin_unlock(&port->port_lock); spin_unlock_irqrestore(&serial_port_lock, flags); - /* disable endpoints, aborting down any active I/O */ - usb_ep_disable(gser->out); - usb_ep_disable(gser->in); - /* finally, free any unused/unusable I/O buffers */ spin_lock_irqsave(&port->port_lock, flags); if (port->port.count == 0)