From patchwork Wed Sep 21 11:16:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isak Westin X-Patchwork-Id: 12983611 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 90D6BECAAD8 for ; Wed, 21 Sep 2022 11:17:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229610AbiIULRm (ORCPT ); Wed, 21 Sep 2022 07:17:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbiIULRl (ORCPT ); Wed, 21 Sep 2022 07:17:41 -0400 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069091.outbound.protection.outlook.com [40.92.69.91]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 810EB7756F for ; Wed, 21 Sep 2022 04:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T/3RaeG63tDBtl3jlHV0B1B6eW9Xzdr6PSiczvkjCc1RMRrEH0ITfgrmVDr7dXH4w5kKwOvpez4Ndwjfq8H/2oAkUcexRMc607UeOeIAzMi5sTGQpxeh8ysFdXJQtm56oJ6IQVI3NAxzkjKF25XicT8Des2BwvUn0cGKzV+CKXsXz0xqaq6QYRiZykK5rE7Cgu5lyksSmDJyvjZy7rgEwbgB6UjXSxG+mpQhkGby1pQMFLWmOf7lGJJwYN4KjCzOw5ErznG6rCSjmxYtHpZ9Vk/SGwpD9GNXqJ+1hrX07BlBxu90UrSnV65MJS+ozoDX7AW3X5wEkG6flvhyi1u3vA== 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=Dr9l7AIIPCk+EeoqyB01vF9Fi1ucpPBAGwWASqexoE8=; b=cXvf5moIWla3hFe02a8MCGufVasW4/Md+gJqzmDRljpMiI9+LFQZk68n3sJqVPNtDfkuvs+PrLrw6GpegIN7ce+cCh1121iamMRrc84fWOCRvHzrf+cmTMTJXj085W/jn0bckCV/YTR/wsLn2t4pSHwMpbXdqir6GlD2qCMhsUHvbRXZ8vOWUv8aXm1/ggUrzem8aBo07QX7XRf6bRHLAYHc/w8SRHvDYE//U++f9TNqFHxGSz5YX4JWU9UMYGiTlcyRHISfuEXc0KRG4q7FBZc7Tb8YAua73NRZfCuXld7iSPxUE2VUM6tq8DzS31czicODYRE+FjG1tnNtfDk6aQ== 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=Dr9l7AIIPCk+EeoqyB01vF9Fi1ucpPBAGwWASqexoE8=; b=qhYK+KhwEU83ZpWCgeWApzWciMJsTJGiKszKaFPGy4DZaMbzm9FyaEK8aKFX5+3RdrCclTA/ixEFA8Df+hf7d8stjOGPwmry1mY11rwLtJtTkDuZQPVBgBPSYYMUWb94m/XSD/sdrohkOAhHtFWgfxudLwdXpFIm0/EHnws1EPWq+TW6v00zGf9iAj9CL4cjNOqjpKS/BQUYngzuUoGTjU3JfMniXWHuomk9Vr+1pZ0b29fDRB5eBgGq9WKdoEZz7sTurd6EjiGwF8JztASJ1eKgxiRmv0l0Yu+BAsl3qTzPd37yBO+m1rtbrYbinWk5tu7wbx2XUCQFjxrUIAaXXA== Received: from VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) by AS2PR09MB6342.eurprd09.prod.outlook.com (2603:10a6:20b:579::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Wed, 21 Sep 2022 11:17:38 +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 11:17:38 +0000 From: Isak Westin To: linux-bluetooth@vger.kernel.org Cc: Isak Westin Subject: [PATCH BlueZ v2 2/3] mesh: Do not accept publication for unbound appkey Date: Wed, 21 Sep 2022 13:16:29 +0200 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220921111630.23589-1-isak.westin@hotmail.com> References: <20220921111630.23589-1-isak.westin@hotmail.com> X-TMN: [nTm4Bam/qFbLim2/3u2CkZN9GoEB92Xu] X-ClientProxiedBy: ZRAP278CA0017.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::27) To VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) X-Microsoft-Original-Message-ID: <20220921111630.23589-2-isak.westin@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR09MB4239:EE_|AS2PR09MB6342:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e742cf7-d1b3-498f-73e1-08da9bc2e420 X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3lUkjXuSDdeTQka1McTh6g4fbbaNHcFdNnzsfNEqlJinPcbRlCG85P9V7MKfdaLCQ41HWzHgKgtwl2cz9+gnaedJ27vaFF9XlXc4LhClvqDs0C5jMwC93QFG9xf/td+q+bQNnu+ab7sPGll0Wk9ozNeM5nthjIja8knVcmoj6K/7PP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/Y432+VszNNzwXvKKfZWs+Ht8GGWdDWL/O9BK9yzgumRvas1xawn8Gy7tUFBulhkAar05SGprFMybexAxzjQKk2cDRk0rsnSodebmjaHc0FtgFMcpGmym9r/g4L38E+wJZjeAZv+tzhh1YJS6GEdqcwQRKFFejPul8l3cR9zLsh9CTxymL0JwaOaI0M1ZODAPWhTw1INrJLDFwL1sSvrEAd7xi1Ss84poHRE1Fyu/5DeIa2L2SUTtKBv7iMBqpwLvBZSYEIsB8SxnBImD4nIwT70QHSDQGgydSQ3fSqjcu+d0ykXQYMuEJZpxC/ZunHqVTba9ObERngYpqtLwcwcxWnLgr8Kv8yxuxtJPgPYteSEWFNW9nyVHeOCcuNRhaIe4Tia/YQpitYV+3ovIDfoAEfvw9RlirWh6FnBv0F//hjHsTtW6BWVlz1snhTHU8B2/xdYLUHzCuWN9573tue0N5pN3aGnx2CXsZmgMklzY4HmHASJRiUSpJu0PA3kAdkK0nUS3N3Nnfoqvv2g== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 9e742cf7-d1b3-498f-73e1-08da9bc2e420 X-MS-Exchange-CrossTenant-AuthSource: VI1PR09MB4239.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 11:17:38.2607 (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: AS2PR09MB6342 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..d48e6ef12 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; /*