From patchwork Tue Apr 23 07:44:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarveshwar Bajaj X-Patchwork-Id: 791292 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2041.outbound.protection.outlook.com [40.107.20.41]) (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 05D4447A73 for ; Tue, 23 Apr 2024 07:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713858286; cv=fail; b=kEMbULQmYaItDfjZ/AcnuR0KbEmjn5e0S/v/ITaJ3LPDK9mQQprSTuHF7GmM1sABDpUsRxs1s9I4HMKohes+VjdFWZS+5Ylw18pX1PgqnTa0Pn9jhNh22g+CUJ1W9B3xDaCUVxRCdOhPjN0z5uVP49M+5DJDfHokFnfjLjdH5qk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713858286; c=relaxed/simple; bh=t3rQjh05zt6DsQagQgZQcdlXz0xh+aaNoHOkJ803UkQ=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=e7zxTPYiG9kiyZEuB/XaH7LO/LaRbS2SOQevcpSP6+4o7psmyVbeu/IdNnpjixLyR6tGUScaNZDaAI47PWEsWptOcxGSZiaQo/tZRg2GOFKqBjrchTHxlhsNePZs8PNpRf+eOfqjGUoV13NBDO3ZgW5Ja4xckQpb44UGg0Ypf9E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=oE5SThEO; arc=fail smtp.client-ip=40.107.20.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="oE5SThEO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V7OO96aQaLoP/QRZ+uQv2O4bgTvLS3ZNht6TREqi7zx+TuzMOL1jArvdpUCaf0JDqkxYNyA/tnOELsrGUnQQKir91L3hNaM3ccCVG5dzPkfrCE1a373y9ZaBXfbQUZHc6axFQn4qTk/olztSx6NF+QTD3imWHcKHCnbY5Mt1eWDogxG6hRnlGLCgl/YfXI4qe5BS93Tlc5GidtjVplvjcDrJXeGSBkYWXq0mx+iUYYVtUz9jzz6Wb4DkF2IFmLGTD80IMERJuCGiL2u7Q6EuhQ4nfqI52Jzo6lYOTx0GEL8NJQq3JwtYTyalBRGw3bDZsccqqUDBVr/lGGcgwCJ+CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=QeFybeu9nC66hu1+nqH8kGVSwL/KoHf49jJmUnt7dNc=; b=U+0tPujArxSuGwE98Np/n+2ncRFgdeqmQDn2H1m4keD3aGzh67B9QdHsKutbfTgbR4+9292JR1cYwpgBFjl3/B5qAzBYKq8CPZkQTtfZpQpxYMsK4bN/dBLuSZsDT0FQF9O9+2uyZeIpjHQUWDL/xFreb5d9J0bMWTBZG0HfB2y+5x63IhfI7wGNtS3HBTVHdwdzJqX6Hc/NT/743LqHg9epA0dd3GykU4E/YcxiW/325tCIPyfTaIcqGTmRxM3iN/SdHTwKy5QYzyt02tZ4+PE9lBrhDr+cAkbVr9l11rQiB1YiVE1HlRBXdCywDNHiQ9hIyYiDpAf6P7wpwzjFLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QeFybeu9nC66hu1+nqH8kGVSwL/KoHf49jJmUnt7dNc=; b=oE5SThEO/SX9HWX2Y04FOIlDA2LOf3LFuaEi/W/dwePPzqrlsT0kmaj+EFuI5uKRc6GAHX8zvVzjfMv21PG9IG+MG932Q549OuJbq/uO3oHRyqYDw2lBQzpH7i0M0XUUHlq4eEP3ekKztTEjhLqjJDzckY9fyqGdYuqpJFGhm9w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS1PR04MB9630.eurprd04.prod.outlook.com (2603:10a6:20b:475::16) by AM7PR04MB6920.eurprd04.prod.outlook.com (2603:10a6:20b:101::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Tue, 23 Apr 2024 07:44:42 +0000 Received: from AS1PR04MB9630.eurprd04.prod.outlook.com ([fe80::b627:61b5:39c1:91c0]) by AS1PR04MB9630.eurprd04.prod.outlook.com ([fe80::b627:61b5:39c1:91c0%3]) with mapi id 15.20.7472.044; Tue, 23 Apr 2024 07:44:42 +0000 From: Sarveshwar Bajaj To: linux-bluetooth@vger.kernel.org Cc: vinit.mehta@nxp.com, devyani.godbole@nxp.com, mahesh.talewad@nxp.com Subject: [PATCH BlueZ v1 1/1] Fix null pointer deference in bap_get_ascs() Date: Tue, 23 Apr 2024 13:14:25 +0530 Message-Id: <20240423074426.62480-1-sarveshwar.bajaj@nxp.com> X-Mailer: git-send-email 2.21.0.windows.1 X-ClientProxiedBy: SG2PR02CA0040.apcprd02.prod.outlook.com (2603:1096:3:18::28) To AS1PR04MB9630.eurprd04.prod.outlook.com (2603:10a6:20b:475::16) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS1PR04MB9630:EE_|AM7PR04MB6920:EE_ X-MS-Office365-Filtering-Correlation-Id: 20be2008-3971-4f1f-2920-08dc63693cc9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6bmyEuyyMN6gavluQS526SUqsGBr0KBDiDmZ9d2yWuPTcI3HLGK3uVAXHnc8BEoJnq/1+nuHswkD9iHdE0EL0wUxWelckBPYxNNQMIN5nbfQNDiHbMoKUmLjqd5y/6uOQJkzlKh02SJ2IwuFfeRne278qbQRdLfmapkK7tv6a5lcI1/l28oPO+ickVDAmfvnZKdCLfwT4YMRJdpx9tBfFqu2LvVxOIfk0vatXm0FYOTuzbECvmVn8Yj0MKli9mdNLXcDEMeZS1WDXp2Bgg7aD5rz5hDRJw09+itWJ67c0Lt93IOhLpAJyfPHurzQx6v9Zq5g+UfKTcnjtbiCJrZDSr0rg8KAwdHPNYWw0Zrvw51BEtyYRbfuQ4WfVgnlXRpZN+fKQrWkxB6jTAdB/HQUGPa+PHC8IiZnwDZjPdE3poOH5VJZW5nvBqzzIOE+oSuOWAuEku1cxVfvon1ezkSzu6KcH57swqgk2eAHYdQm+Dq/RnvP5kpx6Js8cYsk/WDERS9m5jehPT4b7fy4pwuJZTsyxd5EGn/WDcPoWBfEb7cfObJw8RfhnJiUjBd0aUIvfvAn57YnwbKDFxeJ1uLMtqGW4RmrIofjQgffwIEY6NoMc0OWu5tXpfb/k5W6LQh5OBC01HiTRQQNau2QcrZN+dodFga14N78yLOLZa1ZR0WTzV/C+vDSttWlRwqUAnD/ODWO0+CSBI+u9j5tc+FCMiIehS6Jp4VaVVQKhqzFAcdgQTb42aaT4oa62VZFZhKCMNh0uGF4f6tFjrR/hbhZyARNxLP2OYtwp1FNj5ByjO7CWuFeHIr9QPJCpAV6/TuVF8SO1uoyAVh186JCKsbRsdKvcXsXu3lV2Gzqa5vNOMjtLz+4W2fwNtVNiT3cReCzx3yx6dNJ4MMoxQUmTP6neUrEeNCwz1mM55MJoC/JEPQDDY6cN34EeKuWGsy9d0ZCJesZcPj2mm87Th1vvtrWKECE0S6VUkYf0PglZaOyBcvCokOsJw0pBXy9HoE73wyHBjBBMjLZ9AE+3SDIhY+xftfj9Oekz2/B/9V8AQCPJE2R3RlWC6UUhoNPiCd2xwc7ta0qjP6S0Fs9Pj8u5kFFDM8mwrpzRdRkjmMUt3S1p4OJmqe+taRUXT3DqDLanAurNhWH+0/vceloU5hKWlqUzmDPuY3tdboBivog11SfEMd0JU313v3G2B2n279URbREUS4ihdckJairA1MFOfKfKWiBs4i+wae826kqI72qiXp0BTMPY1IeccGDCVRj7r087B36pjuKebyYGn7c/gKF4if4krqcmhgJ4U57DLb82KCvkupLB8F9fFLi7k/UKS6d+ZH/qLsq4HV3+zv799EbvQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS1PR04MB9630.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(376005)(366007)(1800799015)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tHm8vshlmKaNsJuy+nal6TxDsjiFpYhfjXwLIWslATIymBNRNb3Za6fHD2JRj+iRYprVMMosQ14R/Mreo0PK1pxVjYk/97NYzQtcEP2T3mpPloppR/dDnhHKSrofRuuNvTo4bXDlzqdeEV8kf4t3XjqXXpO7y+NGyTMFTfGdAGaZzTHCuFuuVPOxmLMBpq+W9L7PUE8eWuVahUj7H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aMrYDrKxsMJydlM1xd2b8YAJ5wHboltCZYAXhbjx89VfEbivvXFXyFEMVgNknG86M+UL2hOW7MyNC3/SevlxHpqeCwB7SCQPcTgK37G0uxewPGqpH4fQAkmR8wgZP09eAsdOcJfDykdRy/4SJEtCPbOre8W/qMN4dJwd2TTIBC7UJO1Fy7UaBHj9uLKuK3AWRS8foNZsccGvSnkgpM3F7aZPDE0D9T2B+Q9qwjVGIS9j07fZJja1wnSOO84WPnLUnth7xZnagvswmirU7yzo4LgTYYdojW0JLUOLqNqah7+lqbaFPJvpaYoNu1EU88CIrY2jFVvvmhEA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20be2008-3971-4f1f-2920-08dc63693cc9 X-MS-Exchange-CrossTenant-AuthSource: AS1PR04MB9630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2024 07:44:42.5942 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EFOACHfpJHtKZm2RfDX4Fg1P3c5A+YMyGuEvHUyeIt1a3hbrZYcNafxd26q9S0RhkkBnsnNQx6d8mb2x3VU1y8vUiVNdGIy5vFoKCf2EJTk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6920 Ensure that bap and rdb pointers are valid before accessing or allocating memory for ascs. Added null check to prevent potential crash --- src/shared/bap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 71eadbdb6..0db9ba285 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -1405,7 +1405,7 @@ static bool match_req(const void *data, const void *match_data) static struct bt_ascs *bap_get_ascs(struct bt_bap *bap) { - if (!bap) + if (!bap || !bap->rdb) return NULL; if (bap->rdb->ascs)