From patchwork Wed Sep 21 08:39:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isak Westin X-Patchwork-Id: 12983376 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 1943FECAAD8 for ; Wed, 21 Sep 2022 08:40:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230484AbiIUIkk (ORCPT ); Wed, 21 Sep 2022 04:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbiIUIki (ORCPT ); Wed, 21 Sep 2022 04:40:38 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2034.outbound.protection.outlook.com [40.92.89.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 062735C361 for ; Wed, 21 Sep 2022 01:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bCk7Nk5cmSvDjYqPm2ctL0Adl+D/tMFJPOrkTIGZkMTPsJ3er29VkYqSER478ANvbzmwvjzVOQEhO7CXJ6JDRJp8DXzUOrmtxpYz0JPh3mnUDLk8uGdq9Q6/u3174NIXwVqcbNqdNp6ZQKOhalhXr7mKtwS02nMIO2+z+r5aJtQNkzdsFoGt35V9y/H0m1/Er0ghz2Lelr2MBcHiwaALWpotv1aQObLGoL0cnkp5C06DNo6m98mM+WSR3ZE+QmUzWGyusU4cMgFvUZ3ru5tFqkFzrRVeBic6nQ96lBMgvmzrb1mKKsjKp5gkJuhroDgLLZpDObie2LU47GP8WU+Guw== 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=P5uXjaZQyRXarP7Y9PMiCenglPfrhPY5jGIkOCQa1Sw=; b=nSO+djKVtU0D4gSk6Zg1pN95livmz0qX95SBlG1jEydIZW5Lrr3XRSR3dfBeJ9ggOG7d/YQSbmobBDbVYEPneUzH5vRlDEQahn3zNaFYgnzzDp7fhOd5WYy4SZk+F7Z+HXLXlwLtuPGmT8coKFj6zX47ZW6x0nSsfyyQlohsLN73EfrM1Q/5WqDy9Hmm/yU22yHexkokgNtXH8tmbLeY01QlyjlBMs9Stl8dy6AYkhr/MYaOAACpMFMipug5xkxV0DFhS5nWBiQn65vKeKmybhvTeTJOBE3EBGJ+oreXM7Y0loQv8LaHNBTMfGFCy5SjtP0vbIdE0MycWgJad6BueA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P5uXjaZQyRXarP7Y9PMiCenglPfrhPY5jGIkOCQa1Sw=; b=rr6KhmxWocalCSDd+LEzxiWXs//rdu9VSGJC9Ifv7S3ZgPBo6u8rn4iiwgFk1r6bIqcrs4NQwOMfLsrKsYSRFF33nudaOXqVnk/D4cWIJdIBlSE1XYxoZqr+ewqlteEwYg2zeTK/uEgzf07aGAGQSmSL0sOQWBOqOsN436ZneveuCq+aOJ1kmWRwk/l/WLHqSnBl3IttZfVppPeGXBfISnlNvP7KgRMeHNhrXOn7pkPVVR6+mV+GxxdSGQ5ZWp7WCsCeTOirw75FCDJB7Sel/EQicnjRK6ZusN1W8A0goqek3p1XG5+R3YBdkwmtfY1hRHGwQbuixSE3jv1u1//WFQ== Received: from VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) by DU0PR09MB5693.eurprd09.prod.outlook.com (2603:10a6:10:31e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.18; Wed, 21 Sep 2022 08:40:33 +0000 Received: from VI1PR09MB4239.eurprd09.prod.outlook.com ([fe80::adeb:7a9b:9960:27bf]) by VI1PR09MB4239.eurprd09.prod.outlook.com ([fe80::adeb:7a9b:9960:27bf%2]) with mapi id 15.20.5632.021; Wed, 21 Sep 2022 08:40:33 +0000 From: Isak Westin To: linux-bluetooth@vger.kernel.org Cc: Isak Westin Subject: [PATCH BlueZ 2/3] mesh: Do not accept publication for unbound appkey Date: Wed, 21 Sep 2022 10:39:40 +0200 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220921083941.8461-1-isak.westin@hotmail.com> References: <20220921083941.8461-1-isak.westin@hotmail.com> X-TMN: [KaF+parQ2TQjhVyNfNH0rXyHutcJhi+K] X-ClientProxiedBy: ZRAP278CA0008.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::18) To VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) X-Microsoft-Original-Message-ID: <20220921083941.8461-3-isak.westin@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR09MB4239:EE_|DU0PR09MB5693:EE_ X-MS-Office365-Filtering-Correlation-Id: 00cc7ee8-d28b-4714-63d7-08da9bacf27d X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3lUkjXuSDdeTQka1McTh6g4uhRitKZOWH7RZPMTNYfuYHzfo8yhypC+gnyecp/34vCveu7mx3G/5X43Reui07lZuyTEPtvPjyd52ZDcstIurPvlfvD2GQTXu+tF0aI2rcz9NJVcd0SKyw5OfyMMrstRIaZLThQ1GnBTch/GCc9I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eksJDGV7eekLyJyQrTFdv4S/PJBtab8IfyxqAuETFLBvIm43WUa338q7G2K0Af8PDj0EAUJStPVVmbC9+I5lb1FDEjE7Tp652JE1/wl5OTf/Yu4aps21gaRbV+KJmOHgDJeO7BbVPH9t0n6PVvALb1JHNAGPALJXplkKR9t4nMf6oSjfVEdgzK4B+xeA0JIV7h2i6gfXgSoZJa2MHm8JI+uXXwXLpagaZ1NWWNBc7BcIDfVwbBEPuECbcEPhHvi2Xz4XcRIa6F7nfAkkcienWROKbKWiT1bfuyHgknW/GwfibafAzxs4hgrXmZtyg1+6q63L0VTekh65oRMB7K0LAkXBqM7gSGn9Qld4VgoR7TYGUGonNgGq/oQxwkHpD0D8uoCK9e8DYC9jHTc/ipsBOWhrhoj5M/KXViPfwXIIFoWABrTbeeqrYUEntu3EGPfH1MSwa5ekxOAZEUivHCwCFJuqWSgKE3yvAIfXxwZnZGzwAKj7kTBe45p4UoUOrePpZoX6d1/+GSQ2uheucxg== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 00cc7ee8-d28b-4714-63d7-08da9bacf27d X-MS-Exchange-CrossTenant-AuthSource: VI1PR09MB4239.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 08:40:33.3673 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR09MB5693 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org If a user tries to configure publication of a model with an appkey that is not bound to that model, an error should be returned. --- mesh/model.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mesh/model.c b/mesh/model.c index 82078ed85..46ead30ac 100644 --- a/mesh/model.c +++ b/mesh/model.c @@ -1063,7 +1063,8 @@ int mesh_model_pub_set(struct mesh_node *node, uint16_t addr, uint32_t id, if (!mod->pub_enabled || (mod->cbs && !(mod->cbs->pub))) return MESH_STATUS_INVALID_PUB_PARAM; - if (!appkey_have_key(node_get_net(node), idx)) + if (!appkey_have_key(node_get_net(node), idx) || + !has_binding(mod->bindings, idx)) return MESH_STATUS_INVALID_APPKEY; /*