Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5902278rdb; Thu, 14 Dec 2023 03:04:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDi0e+sf8tmYGdLlYXlnDrZbnYJUG3kEk2P0EZ4HQg3Lf2OfiinCjrm2Gh5+1uhPUXrmV8 X-Received: by 2002:a17:903:18a:b0:1d0:acd4:e711 with SMTP id z10-20020a170903018a00b001d0acd4e711mr13474858plg.15.1702551873505; Thu, 14 Dec 2023 03:04:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702551873; cv=pass; d=google.com; s=arc-20160816; b=Mh67UsgyiWlPzJftBjqb6wqJe3t93cKzxmFyA02tZBkq7bIgTZ4QsKKGalPFd5QH+O ROwP1QVZrRtlqVLBfmYwjEi7SrNeaA7TrYti0j6PRXBbxoBhFlh2Znkzuonfl5bRt2Zn tFaAJ88cfdghvyT0mr4HauzpneQ7InDX4OtOfGvaY9Ke689KluxuCtqe5AhfKMJlMhAf s+BHjuKlkGv6H/MBylFAtc1lt2eEt9d13ZNzoJm/tS9VLLHdO7ej7Y7dF57Jq8GAyxsS d8ZKbtn+ZdrhqATw+46v0OAzpvGjKiPf0SW1r+LexE2lPt/LgA5RUss04uMa6E+67Jsu sYnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=jYuuFBCyKpQvNxSbvDzNCovuE2DtcuMS9lIHsEOlJl8=; fh=TYf4X/ECjtAQabJHyLuGz6/+4fFfJBb/9yY9V0A8/zs=; b=cQ9sntDH8SrWl4etwadTp0nA+ybXeBhCKXhp9sIQ7RkPuPXl5KFml8eD6wOL7/heM/ 8ZPdrJ90KG1cvkQ4wISLlf18yRr6XOwbxcZ0C+T+uazCxw0pbO5HozyETq93cvNSWp2Q OUEPHJD6qQwLOBBpST02qkmTwFBGkGIgGkVc1wJE5WGcfsyY2kPVL1SSSz0KtCRbs/zO GdZ0d6X/gqYtrNAg1Ni4jRFBOYx5aKEPbZGGYNNDvrE88UAR5VQ1qp6O7meyOUAnH1lt aOXNuKO8N8uG+CIU5f6bdhqBouPOMx1ihjLWj3+Cfs1HvYVwg3d+nY5b1w24J9d0NNtn aJtg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Hy7Ta7Tx; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-bluetooth+bounces-588-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-588-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id jg2-20020a17090326c200b001d349c06871si3030389plb.324.2023.12.14.03.04.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03:04:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-588-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Hy7Ta7Tx; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-bluetooth+bounces-588-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-588-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A4D4828229F for ; Thu, 14 Dec 2023 11:04:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FCC53E483; Thu, 14 Dec 2023 11:04:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Hy7Ta7Tx" X-Original-To: linux-bluetooth@vger.kernel.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2047.outbound.protection.outlook.com [40.107.105.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C79BB120 for ; Thu, 14 Dec 2023 03:04:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ODesKXfYphCa66QNQDlGUOdDtVbI5LvuKuXTNUBDXg1Book8BKrDiJ+509FoVKm3uENkn3uKDS74DozErluPLX8Z06zUHsk8lx1+sBOhs3Dz5QGTQWvOiHR9qMBOyR5LnsgV+wMt/RNv+jYYxviGxMvwJ9tDD3Tl0EHnTGCxJXy2PY5kwyO90pe50M0Dr2EpkInBA4L26+i2v26RFoP08+qJv0YNUn8oOl5Dp8GbHnYzLVP5iQuAu5C2w5S734XbNV3KpHXfrnAZsycHHtaorSSsjPOPMTjUCW8ABoG79r/V2XUXtUZACxmq+Vm2mobz/hj4mzYx5cRbFsY7jnc4Vw== 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=jYuuFBCyKpQvNxSbvDzNCovuE2DtcuMS9lIHsEOlJl8=; b=JNjuPkkaBH0YfwQZ1MywhcNPeDCGkn9XwcmSfiU79r6ihCjwBRaWz5Bk+yrRqJ/LaYPzMKfK67Rcj2o+XMopomIZve4cjuXrus8vYH7QdH/3Lul9I8Mjnu16/ESxMnSYbB2LcuTqIpkGvscjR4jPzgrG5sYosdJnqlttEniuhDYlfSdsHka92n6iWO0DN8tCR2JIxHpmDwCKwMRfInt/CQQOv+7PyfOFbhP879nm4Wj+PnSEKXAAPf4Qs68YlwhkqukHOAC8Qzq0naBkssoHAIqogwZ9IdOvRIrQvyd2cbh5vp1VkvJKAi72p4kcpxtZh9+l2xteRM57WOfPjPY82A== 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=jYuuFBCyKpQvNxSbvDzNCovuE2DtcuMS9lIHsEOlJl8=; b=Hy7Ta7TxasUoQ4qc7P4SBOefT5X9BZjxU3xINAer76inbwAbtxW3xb4MnY9T3Yus31k/7a2YaqGJiNHfg5PD16KtFqmhBsEs8ssYzXhvN881ZttVjvarKu6s+rrLcKM6NZDxZl8fR/ydYNgDXCnKbpejseFT0vhG/zxjc+2vmm8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PA4PR04MB7709.eurprd04.prod.outlook.com (2603:10a6:102:e3::11) by AS5PR04MB10042.eurprd04.prod.outlook.com (2603:10a6:20b:67e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Thu, 14 Dec 2023 11:04:22 +0000 Received: from PA4PR04MB7709.eurprd04.prod.outlook.com ([fe80::9f65:a4bf:7753:21bb]) by PA4PR04MB7709.eurprd04.prod.outlook.com ([fe80::9f65:a4bf:7753:21bb%6]) with mapi id 15.20.7091.022; Thu, 14 Dec 2023 11:04:22 +0000 From: Vinit Mehta To: linux-bluetooth@vger.kernel.org Cc: devyani.godbole@nxp.com, nitin.jadhav@nxp.com Subject: [PATCH BlueZ v1 1/1] mgmt: Fix crash after pair command Date: Thu, 14 Dec 2023 16:33:38 +0530 Message-ID: <20231214110339.1763-2-vinit.mehta@nxp.com> X-Mailer: git-send-email 2.42.0.windows.2 In-Reply-To: <20231214110339.1763-1-vinit.mehta@nxp.com> References: <20231214110339.1763-1-vinit.mehta@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0194.apcprd06.prod.outlook.com (2603:1096:4:1::26) To PA4PR04MB7709.eurprd04.prod.outlook.com (2603:10a6:102:e3::11) 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: PA4PR04MB7709:EE_|AS5PR04MB10042:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b119719-0bea-4c61-2c17-08dbfc946d12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0k8RLJ5HGb1TkZqhSTe8g9CRhGNq6J4a0sDThUqqIZbl/p7JxsiCdNUzA+QweuOxmybV9edVb82n2GHy5zhxBX0LcCflo7s1fWpqpeLr1Yl1ebOLYDswFL3M6KnWbziATmSuqCxdTGk15r9rvndDzFWuN07Gal0Pyy+Kmx7N1NwfWw9/Gi6R6kbpphMYWGf+cq41Kp/pbXmg6CaXZKQ1wukqpPhAPs3mI9FoQRf7bCAD7S91bfUG6L77w4XZkzsgbHEPMWrz+Bgyho/YJ9IwrfN+QJBRwQqY126fAUrf8NRPdpZM/1Nfh1Elzvzcdb92smupeaTxEz8mxTaAou9JBaaqsL3eePK8rlabJM+FrMO10Ld6/yoiU0C6c1kK1MuVYRFpRJsdzrDXGkFm3AeKZEbqfzFhxwJPAA27PAB3rSfdJ4/S11hUM9b3SIPIiFiyeF+zvVgEEuTSZJAmHMkALin2qjVrlaPPpEqFyHEtR8aOw9CTu3aaiQUY8CLhCgwEm3/uMIVPJXF4RiNRNx0yBK6VgMo9i8TDu+k3HNO11RFpkHwrA6zo2b/13EB0g5UWUOhqd212LIXMOTxi68xo8+XM45Qt1IN6szdrkuKP+v5oQ/TI6joZb2j3HGYhIstC X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR04MB7709.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(136003)(346002)(396003)(366004)(39860400002)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(1076003)(2616005)(26005)(6666004)(6512007)(6506007)(86362001)(38350700005)(36756003)(38100700002)(5660300002)(4326008)(8936002)(8676002)(44832011)(52116002)(83380400001)(66476007)(66946007)(66556008)(478600001)(41300700001)(6916009)(2906002)(316002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?RrflxE+M50dQ3QW9dX4uLrj1ENCzYx8vSEGPAmS+pwHWvv6bJuQ7gAN72Wt7?= =?us-ascii?Q?x/QtphAdgIoYDGdLjzh0r/lLKjUiUGLfPQ47emCxJLRoHDcM+q80yWqIfTHt?= =?us-ascii?Q?cq8ihAp+0Z9YCfiIUSv8/63EaQOo3ZP+tPMPuB33jQXv5EmVOqJv3c5R7nmU?= =?us-ascii?Q?G56NGBA3KxuKYlBIfd5kIOPgMK6VEIIN/qk7SQ8G1qKBabN+osgkDyXk5DcC?= =?us-ascii?Q?lBYgEEWLTWpJh7k8idQNbkL6242c+mM/WoOj6Oh4/HvhejJxx7g381xRjXrR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VEiGFNZkdI2COKgoJgQz7Dl8AmoFfXR?= =?us-ascii?Q?pWoqcwMKYw7c1l5gQ+ML3OjtXraAoNrkmn55TNDYUELtyR3p8Sn4hY7vlFAP?= =?us-ascii?Q?WnVCtYqYlt64d/mCMmeD0EMEJ8gV8tRtJUsC1EOGYj+NMYf+Nd6ixjNE3KIU?= =?us-ascii?Q?MLR1c0ZZJ3Fiw1/LeGZRQM24C06wdzMrx3TyyUeIMNTCKLXfg+oanEArPXpQ?= =?us-ascii?Q?pY4fzBtlQnXyVLjYadHSs95UsbCAr7ikBnlj6fD2eSalXOhgJ2/vRVCATESa?= =?us-ascii?Q?/CMi5fN5VyZZzdpm4itjmT1sjKUE66Qzwf7I+Antzx9BPcyXgy3TkwZwCJLk?= =?us-ascii?Q?FXIlmV3ILCurKC5mbYcSC+cAK9HkXZuMlv/GbA11Zo6RUt+ehzWr5de3yx6k?= =?us-ascii?Q?CFveX2DuB65VwEtQeSraD/nIDw87PtgDP8jbsuEM?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b119719-0bea-4c61-2c17-08dbfc946d12 X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB7709.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2023 11:04:22.0896 (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: c4d2duZPl2B+Hvly4M4ek4N0CyWwUan748HjgixRTeLyrPo1aOoBoMwGiOvNBebnOzijfzabqYW85k8fxzsyJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10042 After pair command, if the user doesn't provide any input on bluetoothctl CLI interface after receiving the prompt(yes/no) below crash is observed: dbus[782]: arguments to dbus_message_get_no_reply() were incorrect, assertion "message != NULL" failed in file /usr/src/debug/dbus/1.14.10-r0/dbus/dbus-message.c line 3250. This is normally a bug in some application using the D-Bus library. /usr/lib/libc.so.6(+0x27534) [0xffffa1b67534] /usr/lib/libc.so.6(__libc_start_main+0x9c) [0xffffa1b6760c] bluetoothctl(+0x188f0) [0xaaaac9c088f0] Aborted (core dumped) --- client/mgmt.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/client/mgmt.c b/client/mgmt.c index c056d018a..940e25f3c 100644 --- a/client/mgmt.c +++ b/client/mgmt.c @@ -54,6 +54,7 @@ static uint16_t mgmt_index = MGMT_INDEX_NONE; static bool discovery = false; static bool resolve_names = true; +static const char *dummy_input = "N"; static struct { uint16_t index; @@ -849,10 +850,28 @@ static void prompt_input(const char *input, void *user_data) &prompt.addr); break; case MGMT_EV_USER_CONFIRM_REQUEST: - if (input[0] == 'y' || input[0] == 'Y') - mgmt_confirm_reply(prompt.index, &prompt.addr); + if(len) + { + if (input[0] == 'y' || input[0] == 'Y') + mgmt_confirm_reply(prompt.index, &prompt.addr); + else + mgmt_confirm_neg_reply(prompt.index, &prompt.addr); + } else + { + /* After pair command, if the user doesn't provide any input on + * bluetoothctl CLI interface after receiving the prompt(yes/no), + * than subsequent CLI command will trigger a call to DBUS + * library function (dbus_message_get_no_reply) with a NULL + * message pointer which triggers assertion in DBUS library + * causing the bluetoothctl process to crash. The change below + * will ensure in case if no input is given by the user, a + * conditional check is added to handle this scenario and a + * default character ('N') will be passed so as to avoid the + * assertion.*/ + input = dummy_input; mgmt_confirm_neg_reply(prompt.index, &prompt.addr); + } break; } } -- 2.42.0.windows.2