From patchwork Tue Jul 25 13:47:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitin Jadhav X-Patchwork-Id: 13326489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F2F1C41513 for ; Tue, 25 Jul 2023 13:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231475AbjGYNsT (ORCPT ); Tue, 25 Jul 2023 09:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231664AbjGYNsI (ORCPT ); Tue, 25 Jul 2023 09:48:08 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2081.outbound.protection.outlook.com [40.107.6.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 354D4A6 for ; Tue, 25 Jul 2023 06:48:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Inr9dIYMyDNs2XBjh1oDRQaT/o0phLojmTG/4nUlNB+gGhT/WgPnOfb0ftV4wSFVVoVUsF2A4c2+VeEZVD47GGGMeWreC78JanIbrPkysrbRCDMiQyOP1SYTQI80Ebp25BfO4hTepxJuy1cMVeRCJ6l5ZthmPlJlBsskc6dQndMtujuw5RzP5YxVgdJlsrFjS+CaQdHnLpvn6mw4rWcniiK/Fngv3/t8r5673MyWkxV2J/ktT4Ux2MZfrFu4NjrCWyjkWX+4e927tI0DUH01d1hdoti5CmFULcdP7JKxCiFZHROPmISN8OyFpPggvFTAFBqO17EYBY9Cv1+HbrkNXA== 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=5e+kH7jbavEfXy2CI+FXctgAclZYu0bRugEzfUjGJ1E=; b=FiA1XHYm6Ip+vwQWoD487S6Da090+v2JKzKGDx4u7ujnKgHDeZqxoaXNAeOt7zRshEnxjrm7KkbxT6kiTI6VI5DfQnMj0imMdi2JUJ0cYVFamc4feePpBf0cKkBzH0+plfgphuVjzgRVhyBkGGlKP/E6BYxQUKn2bb2Nw3kNdOccu4mZmD4vW6dore3g835TIVWF50bbLTIudSfCZIzjrYnhtLJW0gVr9pprZ7MQtJnUliZdNqzFbf7vbwWYcNA/CGlojj7tyf+nRWWD0HmQDqP9InPAOBcIWFrhUnBgtjG4N3MWHxXwggswoHq5Tr7maqzGoLjY+T82kCuHds4c+Q== 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=5e+kH7jbavEfXy2CI+FXctgAclZYu0bRugEzfUjGJ1E=; b=UJJXfWBdW/DNK/GfWhUc5utjuKUXgQZABu/FYCGhEjuC3bwLKZbc3qalx5J9GP50WlqZDXu8DefkNMCkJyUCwKt72jzTOuIovkZbp/MyqZ5joLOyOvhDsOlhqZec5m84T5C8MUPX8r6YIqZabdjQbUvHiL07lQTq5e19COEntwU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB9126.eurprd04.prod.outlook.com (2603:10a6:20b:449::16) by PAXPR04MB9593.eurprd04.prod.outlook.com (2603:10a6:102:24f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33; Tue, 25 Jul 2023 13:48:04 +0000 Received: from AS8PR04MB9126.eurprd04.prod.outlook.com ([fe80::273d:f528:aaa9:288]) by AS8PR04MB9126.eurprd04.prod.outlook.com ([fe80::273d:f528:aaa9:288%4]) with mapi id 15.20.6609.032; Tue, 25 Jul 2023 13:48:04 +0000 From: Nitin Jadhav To: linux-bluetooth@vger.kernel.org Cc: devyani.godbole@nxp.com, pav@iki.fi, luiz.dentz@gmail.com, sathish.narasimman@intel.com, nitin.jadhav@nxp.com Subject: [PATCH BlueZ v4 1/3] shared/vcp: Fix the crash observed with VOCS Date: Tue, 25 Jul 2023 16:47:40 +0300 Message-Id: <20230725134742.51651-2-nitin.jadhav@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725134742.51651-1-nitin.jadhav@nxp.com> References: <20230725134742.51651-1-nitin.jadhav@nxp.com> X-ClientProxiedBy: AS4P189CA0037.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5dd::8) To AS8PR04MB9126.eurprd04.prod.outlook.com (2603:10a6:20b:449::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB9126:EE_|PAXPR04MB9593:EE_ X-MS-Office365-Filtering-Correlation-Id: aa9e3cd9-729e-44d7-271d-08db8d15c556 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: odQLTL3MDOQXJwXtau4iRgPdjOc8PcPBF8GKGas2haOuA68CIfLUnIw7A6GThEZE9bTmoAgIsIB/YYfI232pgjX/C2elSQ90ibMqBxD9DXGKw3HiZSzA4EMYFS6DMxFvcbHuScXS87B5nezxgHzDtdSwq1AxPhpwzwhmDj7xsI6nxMyORwgVBIwBiWUjW3INJUPjDKOycbOh/U/D+cppuWkNP4IYiR/nxulvsSQjFl9l54dvTo3qjDSHjRd+q0EXUOsvso6qGEt3Oq5v7AiceiG/NKMA8JOfIJ9ttANYc8ExViNNkfosGLVktqX4vVgVL8z6XO1eT+nCewYulaheSOABgvVxeCSmiMtXcwqKxcy6/RM6mBbHscv/5YvDIySYlbYmzyhWukmtH8GlEBUEdeHokucuMkuVP+1o+PqcAQlMOydXCYBnS6cunm3SmljIWaMfOsQb2mGUWY25gH46NHi81mvKqSbCAvls2j9gNgpX/GJruc9kwTROLFWAGvqXxyZgQIbuvGO8wio8BJYgKxaiiDLzb5gU4HYVzMx3XTYLuWvrFwKXLXGN3Y/h2H/+B1Zc2tstBTW2eJqHp3P+Et59wisHD0YDHI7BEUhiR5Q/PGfVAS440xdLjJSVwSfw X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB9126.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199021)(36756003)(86362001)(2906002)(52116002)(478600001)(38100700002)(38350700002)(186003)(1076003)(26005)(2616005)(6506007)(55236004)(5660300002)(8676002)(41300700001)(6666004)(6512007)(44832011)(66946007)(6486002)(66476007)(4326008)(83380400001)(316002)(66556008)(8936002)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bwcdMmKlUP3dQVzzOo1CF8RLf8gAYBOZ4zBjxSN/VcGHJQyRdo5k/kNud7Fq0hHjY9jJug8RZNbe+bL3whH0wwDiFzHo1l6Cqg5JmToxGVmUTpzAJbpj6dg19Cxyp/VWqiT1ofXFFCdvybjX4vorj8JfdytqrlQOtkfSczahX9ZtxpPpWA8k8Vztl8zxlpBNk8duO8H4dq8f5t17V+f+UrFBhV0YHDCJnllagPf1XYH7nV2Ng61rVCE8DO4eAT1syjtoQuhHv2kiUkQvfHaWOBoOAKU8gWyyyk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47S0on3ONDoLtnz30m7/5r1jdqPUJ/GVIArh0di0v1rWAi3+wA3JUUvaDahX+T18+R8KGGPuxSu/F82iCgWiZ8rRU9tnjju31Ea4VHIfkomoAFJf8zQv5ed7j+0XI1x7xFdQlG9vvY270NNme6Mlk2teIUO3sKkARv2HMKiqmNr2yKEA1qH1b2JoodNapzNPV8JCDDM96SDSSviCQDZPC1y9jxBbvwf0d4aJaBTu X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa9e3cd9-729e-44d7-271d-08db8d15c556 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB9126.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2023 13:48:04.8423 (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: a8wWlgxVvvmn8qd+F+ovxhb6we7sZGODHWM3rIl9VziPiCiqmFfwYrWU2UeyTnD1bgowVpJZly5uQLcw+YvZag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9593 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Root cause - There are two types of database- Remote and Local (rdb and ldb). - In client mode currently the code was written to access ldb. Fix - Correcting it, to access rdb has resolved the problem in VOCS. - Same correction is done for VCS. Reported-by: Pauli Virtanen --- src/shared/vcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/vcp.c b/src/shared/vcp.c index 74bd01729..314618664 100644 --- a/src/shared/vcp.c +++ b/src/shared/vcp.c @@ -1719,10 +1719,10 @@ bool bt_vcp_attach(struct bt_vcp *vcp, struct bt_gatt_client *client) return false; bt_uuid16_create(&uuid, VCS_UUID); - gatt_db_foreach_service(vcp->ldb->db, &uuid, foreach_vcs_service, vcp); + gatt_db_foreach_service(vcp->rdb->db, &uuid, foreach_vcs_service, vcp); bt_uuid16_create(&uuid, VOL_OFFSET_CS_UUID); - gatt_db_foreach_service(vcp->ldb->db, &uuid, foreach_vocs_service, vcp); + gatt_db_foreach_service(vcp->rdb->db, &uuid, foreach_vocs_service, vcp); return true; } From patchwork Tue Jul 25 13:47:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitin Jadhav X-Patchwork-Id: 13326488 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D93BDC001DF for ; Tue, 25 Jul 2023 13:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231485AbjGYNsU (ORCPT ); Tue, 25 Jul 2023 09:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231724AbjGYNsM (ORCPT ); Tue, 25 Jul 2023 09:48:12 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2057.outbound.protection.outlook.com [40.107.15.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E58DE0 for ; Tue, 25 Jul 2023 06:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QJiaKDfG6JVGVY6fn4/VfcSoKXtKfOrcyC/wG1UWYeXHYNaEzQ7cWC2kyH8nL1OjNnTP8PJkMkV2SHdPcb9Ni5lWqKWQQygqqmks9nXucM+CMncj9J2v+xEbuP2l3AGgFBrnqvNMpfQMGPSFBZrYl8ytPgPk3oWDEpbLmeEI7da56R6VKwduNmHCTtgMKECWqOtQ0dr4vlnnetiVPMEWNOyYnll4natFnDOCioIRikCgGMUdVchj58abjWDFOZT1HPA/MOBZoDeOA0uOJTmLQAMppVLrdJJ9B8q8HfmBj828eiwP+LP31TvvKHr78zGkC9Rc4uYEXeM/LoNGt+R/zg== 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=V5uPLcb3lBZSZoQkNE1JLZCYriiHEbzyU2LLLOzjBOY=; b=gbQ60vTUD9rnEBwhWOhphr0J5248h53/DRY83rVPcPQWY4KKJ30D3atHPs3IF4XnNZIWePQWPMZJq/OtHwBJblfjinI3ugWvBGHm21nbwYfLEtJe5Wcr3JFd9MYctFqrxhSIXmvmX7++E7eKDqXnmVmCv3VUOjm+VHE7VywDf0ZBjxDKGtA2thMy/lKGiYw1kLGkekpCUh9D8MLq5IipbTnIw3PCgKCA1/LJxGD1qt0wPFlZKGQ5mr2V9rG1NBeK2twwF9bAvG1ZJaovn0QHcguLHPOi4TfsP5tONJqmCb1HowdReW5wyVODZYo0Og9pcXMJzwaLSXEqcUfaoac+ow== 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=V5uPLcb3lBZSZoQkNE1JLZCYriiHEbzyU2LLLOzjBOY=; b=CrDxtKEJ5SyMs8a6aLqOxM9YbN3aS3J7UsYaMOk/CLpcZcibJ3nYQO3O0VP29eGaQ65g/VVaMUnr5DDFDdmDsew0A/QN55e39R3le0zr6/2F7s8Yq/MBfsvytQEBe57T3UBSVpoq3Rz9voVen5xX5/nkhT7LtqIcDqlu3R29Afo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB9126.eurprd04.prod.outlook.com (2603:10a6:20b:449::16) by PAXPR04MB9593.eurprd04.prod.outlook.com (2603:10a6:102:24f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33; Tue, 25 Jul 2023 13:48:08 +0000 Received: from AS8PR04MB9126.eurprd04.prod.outlook.com ([fe80::273d:f528:aaa9:288]) by AS8PR04MB9126.eurprd04.prod.outlook.com ([fe80::273d:f528:aaa9:288%4]) with mapi id 15.20.6609.032; Tue, 25 Jul 2023 13:48:08 +0000 From: Nitin Jadhav To: linux-bluetooth@vger.kernel.org Cc: devyani.godbole@nxp.com, pav@iki.fi, luiz.dentz@gmail.com, sathish.narasimman@intel.com, nitin.jadhav@nxp.com Subject: [PATCH BlueZ v4 2/3] shared/vcp: Fix issues of audio location and descriptor Date: Tue, 25 Jul 2023 16:47:41 +0300 Message-Id: <20230725134742.51651-3-nitin.jadhav@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725134742.51651-1-nitin.jadhav@nxp.com> References: <20230725134742.51651-1-nitin.jadhav@nxp.com> X-ClientProxiedBy: AS4P189CA0037.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5dd::8) To AS8PR04MB9126.eurprd04.prod.outlook.com (2603:10a6:20b:449::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB9126:EE_|PAXPR04MB9593:EE_ X-MS-Office365-Filtering-Correlation-Id: e28c3f0a-9f80-4b84-db35-08db8d15c7ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /faB8oXdVDg/tFwn/N92ukWpPBdOcXhABtT1eULObB8RBlnsOkoR1JIno4yzf6G8FA5oRel2aea5n/ZOaNnoaCnD06XKoQtO8dSP8cFs4J5LKEfgMeZMpELB6FPw5GO/2ZD7HsFXWCaUfyllLhnnLKMeter/PCOFkGqMygf/n5Ydy+7wFY8/ILI6nl2vGxbj/f8kZz+593Rrw+Jmtr62CDgVhUl3bqI/qvqFBbJf/1fR9tZBsbXCEnYAdAhYThdMUz2xfwYsEAd60tevuE27hwyMh4Xxo1DnRLz5HawtfkrdAd9sS8Vgn5iUiMhXGibKGDRdzG2ggRc173AAAUSEKaQCbwagEjUepd+WdYxfJY6h29qIy/uzII5IxRKgyoaZEH4RETjn6ccvfXb/8qoxwL4kn6L58kLC/vdtHClkvAaOdRGu1UGYkrzkS6nSYkO7cY1kPFZfB0hp9wfh2ynVLxUd8N4GKcPsa+A7XiEI5tQP1AAKtZ03L5sbVWMF0/eTesOdfa1gSc0azZmbuYTP0gfN++xTO91MDGIeRqF+C/NOmVlD+/Ce/4SQ8Y8yq/IA3xeq8Zr9iNRosaydwvY5PxeE3vQ8nKEvzgk7t44sFdAskwc7IL6BTgELna9HcvQt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB9126.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199021)(36756003)(86362001)(2906002)(52116002)(478600001)(38100700002)(38350700002)(186003)(1076003)(26005)(2616005)(6506007)(55236004)(5660300002)(8676002)(41300700001)(6666004)(6512007)(44832011)(66946007)(6486002)(66476007)(4326008)(83380400001)(316002)(66556008)(8936002)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VW0avO5IPglbChi8KxnZKAmK5cH4cMupA483fqdWW2pXHYxIlsJFchQ1d7Ndiha2ped0sllX7N/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8oiCogLV5v1SkmNcVukP+nS7N9nEgorqEF9dnnhpvDo5OlQrHW7KEYTwCOFsDCrVGFnX/Vob+jq9aQ34hDfaTq4Vhn2GU57j6n7vdAIeO+zjV8fQoXmwxQdyYbNRYWvDH7f8AHcwy/aLhlbkfimUhwsqqZx/9nkpH7Iolo31IltTbIiPcDeYcoCtZuTpGgCdZu4oBDQmvF/wCdmEAYgvaZS+fRt1wvrtUqFAJDsoBZg81Z9BWEylA+ox9bEet98IZFTOGDwmdsAXEn89OlMy5RFeDnQI3bx02xNXWwx1pCjuIZlKmFrFo6IIQNbwlQ0OhDuf9FmsroF5No++jFLeT1FJC2N95RFIE5r/PyMWus0iF88dVv2w6vFnIp+LTbChFOTjymJfk2xT/4Zi57wrw1wXU9c2b8P524CCp5KHei6l12W/A X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e28c3f0a-9f80-4b84-db35-08db8d15c7ae X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB9126.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2023 13:48:08.7874 (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: qhMPz0D+kN5oNEaKQEwbdJEatsEMwGLX8+TES9SzKxZ3/FlLKd3RBfbljxbx3lPYlsWtB6VBBmvOsd0lCQPlCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9593 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Issues - Audio output descriptor & location read functions requires code correction. - During reading audio location descriptor value was checked instead of the pointer. DBG statement wrongly accessed value to print the log that caused the crash. Fix - Corrected audio output descriptor read variable - Corrected the audio location debug printing function - Allocated the memory as a char pointer to the audio descriptor variable. - Corrected the audio descriptor pointer checking condition --- src/shared/vcp.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/shared/vcp.c b/src/shared/vcp.c index 314618664..0408531b2 100644 --- a/src/shared/vcp.c +++ b/src/shared/vcp.c @@ -973,7 +973,7 @@ static void vocs_voaodec_read(struct gatt_db_attribute *attrib, struct bt_vocs *vocs = user_data; struct iovec iov; - iov.iov_base = &vocs->vocs_ao_dec; + iov.iov_base = vocs->vocs_ao_dec; iov.iov_len = strlen(vocs->vocs_ao_dec); gatt_db_attribute_read_result(attrib, id, 0, iov.iov_base, @@ -1385,11 +1385,12 @@ static void read_vocs_audio_location(struct bt_vcp *vcp, bool success, const uint8_t *value, uint16_t length, void *user_data) { - uint32_t *vocs_audio_loc; - struct iovec iov = { - .iov_base = (void *) value, - .iov_len = length, - }; + uint32_t vocs_audio_loc; + + if (!value) { + DBG(vcp, "Unable to get VOCS Audio Location"); + return; + } if (!success) { DBG(vcp, "Unable to read VOCS Audio Location: error 0x%02x", @@ -1397,13 +1398,9 @@ static void read_vocs_audio_location(struct bt_vcp *vcp, bool success, return; } - vocs_audio_loc = iov_pull_mem(&iov, sizeof(uint32_t)); - if (!*vocs_audio_loc) { - DBG(vcp, "Unable to get VOCS Audio Location"); - return; - } + memcpy(&vocs_audio_loc, value, length); - DBG(vcp, "VOCS Audio Loc:%x", *vocs_audio_loc); + DBG(vcp, "VOCS Audio Loc: %x", vocs_audio_loc); } @@ -1413,10 +1410,11 @@ static void read_vocs_audio_descriptor(struct bt_vcp *vcp, bool success, void *user_data) { char *vocs_ao_dec_r; - struct iovec iov = { - .iov_base = (void *) value, - .iov_len = length, - }; + + if (!value) { + DBG(vcp, "Unable to get VOCS Audio Location"); + return; + } if (!success) { DBG(vcp, "Unable to read VOCS Audio Descriptor: error 0x%02x", @@ -1424,13 +1422,18 @@ static void read_vocs_audio_descriptor(struct bt_vcp *vcp, bool success, return; } - vocs_ao_dec_r = iov_pull_mem(&iov, length); - if (!*vocs_ao_dec_r) { + vocs_ao_dec_r = malloc(length+1); + memset(vocs_ao_dec_r, 0, length+1); + memcpy(vocs_ao_dec_r, value, length); + + if (!vocs_ao_dec_r) { DBG(vcp, "Unable to get VOCS Audio Descriptor"); return; } - DBG(vcp, "VOCS Audio Descriptor:%s", *vocs_ao_dec_r); + DBG(vcp, "VOCS Audio Descriptor: %s", vocs_ao_dec_r); + free(vocs_ao_dec_r); + vocs_ao_dec_r = NULL; } static void vcp_pending_destroy(void *data) From patchwork Tue Jul 25 13:47:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitin Jadhav X-Patchwork-Id: 13326490 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EB08C0015E for ; Tue, 25 Jul 2023 13:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231522AbjGYNsV (ORCPT ); Tue, 25 Jul 2023 09:48:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231766AbjGYNsP (ORCPT ); Tue, 25 Jul 2023 09:48:15 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2052.outbound.protection.outlook.com [40.107.15.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43C8DA1 for ; Tue, 25 Jul 2023 06:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QtHt7o+peW5kW9PCJ+ylq8jEIwQcZopKYdFeJZJf4bC4C0VGjDlELgkhkI+GWJ7h7hQN4O/232EEghugFYObg9ueIBMskV+JVXcZOQgycOrF3i5ujLO7yjLlPXzgK1RGQNzzrMjO9fc/ZWsyzQWBigG9wqS6PwOg7LuPT1locyLXmF6+IZxatuBpGTzsX9vaNkYva2J8t3MFb6v5KpLvIGUrxx95XF+lEMeXu9N25u0BFzDJtCuV8qX+tSmMn4sB9V1HVNWAZ4Cq4gkCr/xc8xQ3AlzkZVfMAPAjv7U2EqnaW3IUE4TSFSOEnT6jQ+CprM7ag9VcPOt0LmLtJbTqwQ== 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=s2o9oMMTBRzrlvzvqRH03A06HPrm1knS7PpN3p1pbOs=; b=kyPPz9DcZOXGZQNOLepLxJl/nEEhnlHChnR++nXDgZKmB2xnw8v+m4P9FFd9aD5QL6u1ZJ+zUYVUOvXc2wzezCU9mI6+wlnC3y7MQ/zX5B6ShSjrthKdHSWSGWGzYHMADJS1b6io//fJmFMsmBK1baDhuOTLhqcj07w9O4+aLx1FMMoIayteei35NBkT+1se7qfBGE7QiudRKUekvnObEKz8LNC/n3vPlaCFvItJ7ZfORy911axhVODC/Yd3+im5GE6tKbLABNci5UXVWbryTz3qTorRsEvackN3elXSCCoEQVMxniENhrCc8pd9rH+n4VRZLuNeTExZpZ34WnMQAQ== 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=s2o9oMMTBRzrlvzvqRH03A06HPrm1knS7PpN3p1pbOs=; b=Ad/W2ujch3L6HFyB1iKTvfwswoPFmvwkTqSatDJCbu/rJyuc0Qs/jAaxFWDPwZ7YZYQFf9E28qerWklEfvnpMkgjzDbJHOseNjnNLVNu2GEbypWPXl/2zIbLD9ESSNdboB5CASBuTAqMtiZsRfcw4MA1Z8Vm1MD1g4/EH4iQ6KU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB9126.eurprd04.prod.outlook.com (2603:10a6:20b:449::16) by PAXPR04MB9593.eurprd04.prod.outlook.com (2603:10a6:102:24f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33; Tue, 25 Jul 2023 13:48:12 +0000 Received: from AS8PR04MB9126.eurprd04.prod.outlook.com ([fe80::273d:f528:aaa9:288]) by AS8PR04MB9126.eurprd04.prod.outlook.com ([fe80::273d:f528:aaa9:288%4]) with mapi id 15.20.6609.032; Tue, 25 Jul 2023 13:48:11 +0000 From: Nitin Jadhav To: linux-bluetooth@vger.kernel.org Cc: devyani.godbole@nxp.com, pav@iki.fi, luiz.dentz@gmail.com, sathish.narasimman@intel.com, nitin.jadhav@nxp.com Subject: [PATCH BlueZ v4 3/3] shared/vcp: Reserve one more handle in VCS for VOCS Date: Tue, 25 Jul 2023 16:47:42 +0300 Message-Id: <20230725134742.51651-4-nitin.jadhav@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725134742.51651-1-nitin.jadhav@nxp.com> References: <20230725134742.51651-1-nitin.jadhav@nxp.com> X-ClientProxiedBy: AS4P189CA0037.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5dd::8) To AS8PR04MB9126.eurprd04.prod.outlook.com (2603:10a6:20b:449::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB9126:EE_|PAXPR04MB9593:EE_ X-MS-Office365-Filtering-Correlation-Id: 834ec679-f3c7-4de4-38ab-08db8d15c989 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qyghHJM+x7in9nwntfK/t0Y1acEDqqZ7MH6VKJl/eMxAHJMnDPiCpznJvVDLTdTjTFv1I17HjvaoklysNzJP51E3frP53cw1Q5oKB3bkFc3nhAlmVATBgeodejC0Vdfh+I3eUU/fARj2xib8PUlGPimrujK2OvpFUmH4gcXzX2SCibonSk8cOwzOXzSnL+i3jvcnNYeJLl69hM/Gtw0yZoHRL/8ICDvlc9zkVR1rvDdNNfFGUnmibVhCqCslHmJYovi6nZdpp6uYS0WJgPsIrQQzEgsqRpzEh9ZQqJba4XQtNYhm9J3UpByXa0D2d5DKWc5LrnUQEbcPBjeYYUuYquQdMbqzP066de1I1is3h5BdvGc9p8QPOx9Aqfc5q13IO70XIfGIOlvt91tmXd6BWlJdNh7b5nl4+jjtT4fUFUEmJt1DwrV00VbF7b8fOrsElZZbOJDX3gaOT+jHt7sdhBYVkzjAKgyoTDHlrbR7O/WsmBopWzOLaALCkH/JAF+4Trq1WUgIoap7B6XI7C7s9Jn3d2UtllkU0YACDtHOJQXSl2RM84wD4235J8NBpZufm+TtgZtEeIut3cGVz2WqCHtTWgPunB3UkWdhb2LA3HNi1etexSuVpVRRfW1AUUZM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB9126.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199021)(36756003)(86362001)(2906002)(52116002)(4744005)(478600001)(38100700002)(38350700002)(186003)(1076003)(26005)(2616005)(6506007)(55236004)(5660300002)(8676002)(41300700001)(6666004)(6512007)(44832011)(66946007)(6486002)(66476007)(4326008)(83380400001)(316002)(66556008)(8936002)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-M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uiNGvknpOh7gRM/n2QOIfZAzFgSQUfw1N4J1qJhRMz3UnJMlo2U0kSMz5l9c5cDpt7DEz6Ny5QkIb0dD/aXN0YRkeJwDvB8V78qO5EtqZ3IAMyKE48DAjJYIorsOfxgeuyH7OY7kTmFT/Yn2hddNS1AKdc50Wwsgo78CE0+jPiCkndN2LFwLU8iCW+m3Zq3BZP3aqJSI31TET+nBdfSob6xemXPZqiyfDLki4w4J0HwbiXrA/+lFdY3VS3UGru7nbD965PUrVIUgKyc5oUHwXBxKST5FbXmpou/RSpug2vy1RNdk3LKrFol5zW2yvRB9ieURKUWKAr3Uvkgo1EHrY2oZHKQOTfghjQbMg8dTZuGUVGtWTdb8+WeyadqyBkoLm2AX+zy2ZJVcFBiy0VEGKx6ACUpP9F2uVaWfEo+UT0oJ+ryOyeJfj9UaESwtnjZHkynNoIqDxFBuMVWReTDO0aUAkLDomfHdK+TDh4haGKik77KvoAGecVCQTpF7KQRgwKJ6uaLNt4 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 834ec679-f3c7-4de4-38ab-08db8d15c989 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB9126.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2023 13:48:11.9159 (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: ZSD7gJh2eITAQUWwrREYIlwiHjKzLS2UKu/OpMIcb7a12jk1KoeYBBI0N+YnmkpqEv25o+lmYkxV47rwbzSIFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9593 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Fix: As per specs, VOCS is a secondary service; hence it should be included under a primary service VCS. The current number of handles is increased to accommodate the included service --- src/shared/vcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/vcp.c b/src/shared/vcp.c index 0408531b2..263da4c30 100644 --- a/src/shared/vcp.c +++ b/src/shared/vcp.c @@ -998,7 +998,7 @@ static struct bt_vcs *vcs_new(struct gatt_db *db, struct bt_vcp_db *vdb) /* Populate DB with VCS attributes */ bt_uuid16_create(&uuid, VCS_UUID); - vcs->service = gatt_db_add_service(db, &uuid, true, 9); + vcs->service = gatt_db_add_service(db, &uuid, true, 10); gatt_db_service_add_included(vcs->service, vdb->vocs->service); gatt_db_service_set_active(vdb->vocs->service, true);