From patchwork Wed Feb 5 22:53:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Stotland, Inga" X-Patchwork-Id: 11367323 X-Patchwork-Delegate: brian.gix@gmail.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6421514D5 for ; Wed, 5 Feb 2020 22:53:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B88720730 for ; Wed, 5 Feb 2020 22:53:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727598AbgBEWxp (ORCPT ); Wed, 5 Feb 2020 17:53:45 -0500 Received: from mga09.intel.com ([134.134.136.24]:6172 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727355AbgBEWxp (ORCPT ); Wed, 5 Feb 2020 17:53:45 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2020 14:53:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,407,1574150400"; d="scan'208";a="264391692" Received: from ingas-nuc1.sea.intel.com ([10.251.142.16]) by fmsmga002.fm.intel.com with ESMTP; 05 Feb 2020 14:53:44 -0800 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ] mesh: Allow to finish key refresh when no AppKeys are stored Date: Wed, 5 Feb 2020 14:53:43 -0800 Message-Id: <20200205225343.6271-1-inga.stotland@intel.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This handles a case when a Key Refresh procedure is in place with no application keys stored in the keyring. When KR procedure is finalized, the check for the presence of AppKeys storage directory does not return failure if the directory does not exist. Also, remove duplicate include. --- mesh/keyring.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mesh/keyring.c b/mesh/keyring.c index 41cb2e980..4a6f9f27d 100644 --- a/mesh/keyring.c +++ b/mesh/keyring.c @@ -24,10 +24,10 @@ #define _GNU_SOURCE #include #include +#include #include #include #include -#include #include @@ -166,7 +166,10 @@ bool keyring_finalize_app_keys(struct mesh_node *node, uint16_t net_idx) snprintf(key_dir, PATH_MAX, "%s%s", node_path, app_key_dir); dir = opendir(key_dir); if (!dir) { - l_error("Failed to App Key storage directory: %s", key_dir); + if (errno == ENOENT) + return true; + + l_error("Failed to open AppKey storage directory: %s", key_dir); return false; }