Skip to content

Commit

Permalink
stm class: Fix master deallocation in device unregistering
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Chunyan Zhang authored and Greg Kroah-Hartman committed Feb 20, 2016
1 parent f45f40a commit 73a3ed1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hwtracing/stm/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 73a3ed1

Please sign in to comment.