Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1334639

[PATCH 02/20] stm class: Fix master deallocation in device unregistering

From Alexander Shishkin <alexander.shishkin@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH 02/20] stm class: Fix master deallocation in device unregistering
Date 2016-02-15 18:20 +0100
Message-ID <r2uYA-41S-59@gated-at.bofh.it> (permalink)
References <r2uvw-3zL-21@gated-at.bofh.it> <r2uYx-41S-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Chunyan Zhang <zhang.chunyan@linaro.org>

The device unregister path uses wrong master index range when it tries
to free the allocated masters, it should, as does the rest of the stm
class code, use real master IDs.

This patch fixes the device unregister path to use real master IDs to
avoid memory leaks after unloading the stm driver.

Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
[alexander.shishkin@intel.com: re-wrote the commit message]
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
 drivers/hwtracing/stm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index cdec240bd6..79cca94bfb 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -690,7 +690,7 @@ void stm_unregister_device(struct stm_data *stm_data)
 		stp_policy_unbind(stm->policy);
 	mutex_unlock(&stm->policy_mutex);
 
-	for (i = 0; i < stm->sw_nmasters; i++)
+	for (i = stm->data->sw_start; i <= stm->data->sw_end; i++)
 		stp_master_free(stm, i);
 
 	device_unregister(&stm->dev);
-- 
2.7.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[git pull] stm class/intel_th: Updates for char-misc-next Alexander Shishkin <alexander.shishkin@intel.com> - 2016-02-15 17:10 +0100
  Re: [git pull] stm class/intel_th: Updates for char-misc-next Greg KH <gregkh@linuxfoundation.org> - 2016-02-15 17:50 +0100
    [PATCH 07/20] intel_th: msu: Release resources on read error Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
    [PATCH 10/20] intel_th: Use real device index in the node names Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
    [PATCH 08/20] intel_th: sth: Sanitize packet callback's return values Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
    [PATCH 20/20] stm class: dummy_stm: Add link callback for fault injection Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
    [PATCH 00/20] stm class/intel_th: Updates for char-misc-next Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 12/20] stm class: Support devices with multiple instances Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 11/20] stm class: Use driver's packet callback return value Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 01/20] stm class: Use a signed return type for stm_find_master_chan Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 14/20] stm class: Add heartbeat stm source device Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 09/20] intel_th: Set root device's drvdata early Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 18/20] stm class: Fix a race in unlinking Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 13/20] stm class: dummy_stm: Create multiple devices Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 19/20] stm class: Plug stm device's unlink callback Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 04/20] intel_th: gth: Remove commented-out code Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 03/20] intel_th: Depend on HAS_IOMEM Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 15/20] stm class: Fix unlocking braino in the error path Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 16/20] stm class: Guard output assignment against concurrency Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 17/20] stm class: Fix unbalanced module/device refcounting Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 05/20] intel_th: Update scratchpad bits according to enabled output activity Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 06/20] intel_th: msu: Fix offset for wrapped block Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 02/20] stm class: Fix master deallocation in device unregistering Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
    Re: [git pull] stm class/intel_th: Updates for char-misc-next Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-16 13:30 +0100

csiph-web