Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2444916ybi; Thu, 4 Jul 2019 11:15:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLHbUS1MPmSgXCPs6mkg5yTivHF4J5zLG0c+q50MY+br3L5gH4AFKAY0CXGtyWiqcSJzpM X-Received: by 2002:a17:90a:3270:: with SMTP id k103mr891958pjb.54.1562264104802; Thu, 04 Jul 2019 11:15:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562264104; cv=none; d=google.com; s=arc-20160816; b=o9z6B5SAQKMpRWhdBpWoBWLM8GwishNJsXVAB1wjce0HHt6DDsGnz8wDS+lgImoe+j fxPg5h+bmXpenC3K4Q8rwV8Dy3gykz6PIfWbEvf/OYXZhv4IgDeB4EvZHXpP+XJk9H5L +LUTRL2hVAFZgAhrASvNRdf3FLgRUP+bo+hQy7JDkeTcM4lL1y033DPft2JZUa8NdN4O aMAQJNS5OOpWnttZkOFTLE2NHV8xtYEUkPdpPjawEUiEOk+E2vlBTU/iCWTtYPUV4vaD Y9DtFMwmSiLLpFn3jS7JA+2mAk5t/QShuEM3AkrpzYpILsOCtccsatsRwvxjJTuQwj8A nwyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=tvBzN6sU9mGFs+6Nq4tsyl6tRtQeFSebOF1YCtmkRjc=; b=Rv2o2+YpdQcrviTtW1p0McPXQAOzAOzmt4ClXW/XvzVgulozAA4zBOjp8xgZyHLlTj IcsGyodudzR49crTWvoZdAK5ETIT1fr5Jxnp44tKxMLDkOYrpkOHaYaKsJ/oUNf+USFm ZWMhNHxqGSoRBaer1gQBqNqTcMLzxhMfLUBbFddaP/zKe1s7bcZ1VeaGJRPijDkWrKe1 IhhOHKZvMRaBM+zU3BqfWHRi+zoSGDLxne2HqkKqMTVLF/UGuCn9TjPdz5wx7WPN13Yx 4dgDktO1SfnSznmmXtaR/BYTyf9YXIG8E2GyR6nq8L+Glc/j22AyPEVGRJ7G90+644oO KkvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p97si5366440pjp.34.2019.07.04.11.14.36; Thu, 04 Jul 2019 11:15:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727308AbfGDRZB (ORCPT + 99 others); Thu, 4 Jul 2019 13:25:01 -0400 Received: from mga06.intel.com ([134.134.136.31]:9062 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726881AbfGDRZB (ORCPT ); Thu, 4 Jul 2019 13:25:01 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jul 2019 10:25:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,451,1557212400"; d="scan'208";a="155095113" Received: from amruthas-mobl2.amr.corp.intel.com (HELO ingas-nuc1.sea.intel.com) ([10.254.89.41]) by orsmga007.jf.intel.com with ESMTP; 04 Jul 2019 10:25:00 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, michal.lowas-rzechonek@silvair.com, jakub.witowski@silvair.com, Inga Stotland Subject: [PATCH BlueZ] mesh: Fix segmentation fault when removing a node Date: Thu, 4 Jul 2019 10:24:59 -0700 Message-Id: <20190704172459.21335-1-inga.stotland@intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This fixes a segmentation fault introduced by earlier changes. Segmentation fault was used by accessing a queu that has been destroyed, but the corresponding pointer hasn't been set to NULL. --- mesh/node.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mesh/node.c b/mesh/node.c index ad94d885c..40b5256ec 100644 --- a/mesh/node.c +++ b/mesh/node.c @@ -222,7 +222,9 @@ static void element_free(void *data) struct node_element *element = data; l_queue_destroy(element->models, mesh_model_free); + element->models = NULL; l_free(element->path); + element->path = NULL; l_free(element); } @@ -260,9 +262,12 @@ static void free_node_resources(void *data) /* Unregister io callbacks */ if (node->net) mesh_net_detach(node->net); + mesh_net_free(node->net); l_queue_destroy(node->elements, element_free); + node->elements = NULL; + l_free(node->comp); free_node_dbus_resources(node); -- 2.21.0