Message ID | TYUPR06MB62178D00DC96CC2702114CF5D2222@TYUPR06MB6217.apcprd06.prod.outlook.com |
---|---|
State | Superseded |
Headers | show
Received: from HK3PR03CU002.outbound.protection.outlook.com (mail-eastasiaazon11011020.outbound.protection.outlook.com [52.101.129.20]) (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 994511CEAB8; Thu, 21 Nov 2024 12:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.129.20 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732192869; cv=fail; b=ULdnXFzne2jUO2UgmxJXL34+jC+wkXztJfduhAONWHi6jDu9VcnRSBsVrdln++sFm0FOA3TwW2mwg8BSUdxWUUltEZg9NNwaDSPWfT0ooWWWKtzufdHir4HzirpCvUBlIL8U+hHrankbyjmU4h7MUb3gmLQcIuG7DaysGTEA53w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732192869; c=relaxed/simple; bh=Bl2Vo2YAhKqhmGMeTvmwWtNsUkk1cM32tCOXMlVPwVM=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=VoBLA5gx7aCrGFYzRofCG4IMDOzLkH+e+z4ujkC34p+88plBKaIfQM1QVVMo6eW+674OJi/LB+esR3SpOzm7MwW2R59udizRUSTHvAQtfXNCwwzvTnSLtgXVET1U1ZIFUDG+NDmn1llC2dmw9QSXldhyudA3HRPWU8bbzEGeJ2Y= 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=FVBZFwDT; arc=fail smtp.client-ip=52.101.129.20 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="FVBZFwDT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Vdluo+6VMCV4irXTAFQMtXWXK8J9SnRR0pAmrqRb1uEzXLkx4Kkug1ElYnbxVfJao1WNIOi5tJQVCluOIONG7ufDRm+/B9vY0hSk9BR3dJp+e/FOul6lV5TuMSm/Ebh6zie+PS6e4dj7KY78q/UlsAcH7Cq1s+jMvKFH4IH5azQjOCVlu55cJsIhVswDUL9yfQe3k6wGxapXCSwMqMnLD1doe98zYog1IErGW+cxs1c8NxdlNyPNKkMx2w3j5uUt8x0bNkxEW3bsVOYfukxn+wmnnGrUGFsjhQ2bJ5wcff3NFsOvO/Z+Q6oeH9QqvqTy5lguoqi7YoHHB+R80vTu5A== 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=Bl2Vo2YAhKqhmGMeTvmwWtNsUkk1cM32tCOXMlVPwVM=; b=FjwCjEYVNtdJswYXtHzpbWygd79fZXH2roSC91LFnnNQwaP0JJlS+9yuAfKYZ9Rk/wgw0Qdwi+Nkfb+3Mtfu1Mrc2Q//gChmWxAvi4lYQveNrgo4SrB+BuCx7QmBT+7INXvMFLmkch9RGFFKbeZIY1X14bHG0sqe+6Ak/3ooSnlePyr7SYfmZx9DNHWsQRTh2mPMwchNMdBnNLNx4aJxdapdYDgteLVEqHh2lxB6rWq2eprHXQ+MVTXsQEDC5BAJ2MNlogwTE/QaiCHSZeJ6xuMUn/d4XtJ0KHmAFeqxYqCVCZ+Qh782LuMvTPEXbIGbbYmZkr6r4BbU8jZAw6UxMw== 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=Bl2Vo2YAhKqhmGMeTvmwWtNsUkk1cM32tCOXMlVPwVM=; b=FVBZFwDTUYHWAQmVStqsCbrRDPJ6tDAowFxtp0A6b/oVPF4nY1WMPo2eus/PLX+Kl8hH9U0Zjin33/66ADrjzwIc+dnFP6wNGEXHTXLYh+sYzlThha+w0E6up6uT9URzLcJ+anowJs8iAvCLy29qh1A8matimqQwWDHvP0bGN6325sDpJU1ol+BTgsDx3sIS6pgei6BtJScdaepIQHpvHQ+sayaUiKBVDw/irTUmMOWRq2vzA23IQjyZLUSob7iSBpQmdUyuRjRFmCbkpUA2Z0scvI54xTqRU4BOcpklNnp/fXC5qs+c+nC27bCHHLTTML0gly2wobztV0DZnndW4Q== Received: from TYUPR06MB6217.apcprd06.prod.outlook.com (2603:1096:400:358::7) by JH0PR06MB6966.apcprd06.prod.outlook.com (2603:1096:990:68::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.11; Thu, 21 Nov 2024 12:41:01 +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.8182.014; Thu, 21 Nov 2024 12:41:00 +0000 From: =?utf-8?b?6IOh6L+e5Yuk?= <hulianqin@vivo.com> To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>, "quic_jjohnson@quicinc.com" <quic_jjohnson@quicinc.com>, "mwalle@kernel.org" <mwalle@kernel.org>, Prashanth K <quic_prashk@quicinc.com> CC: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, opensource.kernel <opensource.kernel@vivo.com>, =?utf-8?b?6IOh6L+e5Yuk?= <hulianqin@vivo.com> Subject: [PATCH v2] usb: gadget: u_serial: Fix the issue that gs_start_io crashed due to accessing null pointer Thread-Topic: [PATCH v2] usb: gadget: u_serial: Fix the issue that gs_start_io crashed due to accessing null pointer Thread-Index: Ads8EVVJRUOwpsmOSCeQNLdPNS2SOg== Date: Thu, 21 Nov 2024 12:41:00 +0000 Message-ID: <TYUPR06MB62178D00DC96CC2702114CF5D2222@TYUPR06MB6217.apcprd06.prod.outlook.com> 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_|JH0PR06MB6966:EE_ x-ms-office365-filtering-correlation-id: 171d027a-58d1-4db8-063d-08dd0a29c11b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?Rot9t9x2QtImm+suunSdjFCSGSBkQLH?= =?utf-8?q?YZqGcLOB8gw09F57H0WNOlFmxTpa5jw3ofX+/SfhB9RuGLSFHgvNbNhZO0wuKHKSV?= =?utf-8?q?HEYGg3UQhv5bao23GuJIP7Dl8PMoticmu5DhkBMYiN8nG6cjUdOYzYSoC3lKI/3m7?= =?utf-8?q?3LuiTolTBNjL0vGpKWS2P+0tjzTaxIX2ut78UzHriUa1gaH6R9bcFj7zLz6A8c/iy?= =?utf-8?q?IRw8HDrDtNMJzJNfNSU7BdCcdWVfaRf67OVAcUA/MMi5b4hs7Y6iGhdVzQspm5cus?= =?utf-8?q?JrzZ7T452L4gK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2BpWM14Gc8eKpiwGf3/5dwm72f6/FYDow3YMSs6o?= =?utf-8?q?P7y8MyUItQIMY83eP5xDmLhtj8EpbQq9hjQnD5kPsm/2NpNaD6vkiGmT5eQzhh/5n?= =?utf-8?q?0K5e4vjj7X9vO?= 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)(376014)(1800799024)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?ycC4kWiLf+WVm+vLuPMcqIikAmwf?= =?utf-8?q?b88cE57PCBpFwmDxvjcWBe1u6C3KPyXlh7Q/uJuCujtjA7OxC5GQm/jSOSSLxwp1v?= =?utf-8?q?od6TR1NrFWwcf7noSAypH8IYx4ZaRSxss8roQHyWCkiUZwO9MRMdJM36+yWqBWfu2?= =?utf-8?q?rIGWCClaH9VRsFBLQBVwbHYpKVoT0deTDHKdZh7WaNLx4T3HW6peT8u1XttFRgl4x?= =?utf-8?q?t85IoEO22EgdpQpxI6lEpSUH4EcibwUmIB0n2qoshk1fWQEh3wPDMKIaE6JE6HC6t?= =?utf-8?q?qtJyf/A7y7lzqpjUJwEVbgiSqR/ZoXYxARuT3y/hXiOPbfBqQSRn9YNoTM0TDG7yI?= =?utf-8?q?YhfdBb3TU/G72iM91L04XNuapOLZZHhpUI0chJ2oFMpIcLojEF3KaT1GG0CS24JIT?= =?utf-8?q?Z0q0AUIXneMqMAg+TP+P4FUd/PnvzD52OloAkDBLpKiB22JBxdlk0nis3DOKnE99s?= =?utf-8?q?lUx6asbeHz58h30exGB5GfnN8oUcbZ2r2gyfS7xyKinIP60QW4CYCt7vLSmECzBDa?= =?utf-8?q?8q8RNJENUQpSxVvUhpMJp4Gwt+S2k2zPkPDrB1B1HJmKPoKtJXF4OX2SstKhEjEQ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?utf-8?q?NwMgcWaxYKmCoVVrEG3v7Z46dDOw91iVVOtS8cWbP8HTJ5ibP+IDSr4o=3D?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: <linux-usb.vger.kernel.org> List-Subscribe: <mailto:linux-usb+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-usb+unsubscribe@vger.kernel.org> 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: 171d027a-58d1-4db8-063d-08dd0a29c11b X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2024 12:41:00.5832 (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: euz/8mVhmgAUPsb/ihy1+PTr+JNdCzcrq1X1DqYWBpiB41jFYJsonaNbpHrr2QkW44dzLDleKQtI0ANhVlHjRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6966 |
Series |
[v2] usb: gadget: u_serial: Fix the issue that gs_start_io crashed due to accessing null pointer
|
expand
|
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 0a8c05b2746b..53d9fc41acc5 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -579,9 +579,12 @@ static int gs_start_io(struct gs_port *port) * we didn't in gs_start_tx() */ tty_wakeup(port->port.tty); } else { - gs_free_requests(ep, head, &port->read_allocated); - gs_free_requests(port->port_usb->in, &port->write_pool, - &port->write_allocated); + /* Free reqs only if we are still connected */ + if (port->port_usb) { + gs_free_requests(ep, head, &port->read_allocated); + gs_free_requests(port->port_usb->in, &port->write_pool, + &port->write_allocated); + } status = -EIO; }