Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2446036ybi; Thu, 4 Jul 2019 11:16:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyg5KzEsUhYEFO4RQSkVA3EzIORF9NTfwKaDhXLR4iYACjhrkEZMko19YIktwZwF/FqtxjL X-Received: by 2002:a63:4103:: with SMTP id o3mr44781573pga.385.1562264186586; Thu, 04 Jul 2019 11:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562264186; cv=none; d=google.com; s=arc-20160816; b=XuNA91o6J/jBhhMWigME4xtMj/Ok0o7VuzC5CRPQDq+vF9yJ46e7N7MOaYEeYGT3JU m8LGc/YhaTlwZD7UqiVRkY1plM35gaUO8vWvKszbC7tZ0xEQ67EjgRfUlIkmv0gY5ujr Uq3vfhiVA7O2ACWGRDl5WVSnKva1HV8AAHO4sHqppAV9c00nQJNMUoYKggZV50z8CXgn T+OvEj02uDwdt2cPcoQAXqSQffqp37Nfeogp2MnXiBh4aM4o8qFXYi/l7/wOw8+nKvvZ mFzLHrVt3pYXmV70NYhtz3aKpZUFFyYx667PfYDWGvExvVxEh9i/B0Qcdi1pvmzMyMbS Rnjg== 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=W7Y+SVwkRzL+qxYU1Qpfe847K/sHc6toLL/Kjk+YNqc=; b=BT/7PUCoeTNnFcwxEG9/WoU6ML0i/eJhsSnwShJPY7ClniqLI0ARIp5sSuL+CjV6PX 8N6kWBnKmY6c16AqG/ksryTh+zOQgPHRUCADbxbLJ5u7F/ouC/pjqHy4fJyyMZ5RFezT dJAx06YRCMjX75Ij8fEj6fB8SnlzLjzH66VQB0GofeOBo7ll+txcCBZLiU+q6fTSegnr 9N2ktXt6rqAyxigtCNuX5EdX/X4uMlqYZpmWHh1y6uwcbftrv2azdnztz+WDOt9B2G/S qJv0EGePV6AsYpshaF8OsR4AXjYf8QwPdkzvhXQzzPry/kMBN0YBoI6LlRCv8hfs02Ud QUNw== 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 w64si6092063pgd.485.2019.07.04.11.16.11; Thu, 04 Jul 2019 11:16:26 -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 S1727014AbfGDRgI (ORCPT + 99 others); Thu, 4 Jul 2019 13:36:08 -0400 Received: from mga06.intel.com ([134.134.136.31]:9590 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726900AbfGDRgI (ORCPT ); Thu, 4 Jul 2019 13:36:08 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jul 2019 10:36:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,451,1557212400"; d="scan'208";a="247988735" Received: from amruthas-mobl2.amr.corp.intel.com (HELO ingas-nuc1.sea.intel.com) ([10.254.89.41]) by orsmga001.jf.intel.com with ESMTP; 04 Jul 2019 10:36:07 -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 v2] mesh: Fix segmentation fault when removing a node Date: Thu, 4 Jul 2019 10:36:06 -0700 Message-Id: <20190704173606.21793-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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mesh/node.c b/mesh/node.c index ad94d885c..8e9da8988 100644 --- a/mesh/node.c +++ b/mesh/node.c @@ -260,12 +260,16 @@ static void free_node_resources(void *data) /* Unregister io callbacks */ if (node->net) mesh_net_detach(node->net); + mesh_net_free(node->net); + node->net = NULL; l_queue_destroy(node->elements, element_free); - l_free(node->comp); + node->elements = NULL; free_node_dbus_resources(node); + + l_free(node->comp); l_free(node); } -- 2.21.0