Skip to content

Commit 60623d7

Browse files
virtuosogregkh
authored andcommitted
stm class: Fix a use-after-free
commit fd085bb1766d6a598f53af2308374a546a49775a upstream. For reasons unknown, the stm_source removal path uses device_destroy() to kill the underlying device object. Because device_destroy() uses devt to look for the device to destroy and the fact that stm_source devices don't have one (or all have the same one), it just picks the first device in the class, which may well be the wrong one. That is, loading stm_console and stm_heartbeat and then removing both will die in dereferencing a freed object. Since this should have been device_unregister() in the first place, use it instead of device_destroy(). Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Fixes: 7bd1d40 ("stm class: Introduce an abstraction for System Trace Module devices") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c85e944 commit 60623d7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/hwtracing/stm/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ void stm_source_unregister_device(struct stm_source_data *data)
952952

953953
stm_source_link_drop(src);
954954

955-
device_destroy(&stm_source_class, src->dev.devt);
955+
device_unregister(&src->dev);
956956
}
957957
EXPORT_SYMBOL_GPL(stm_source_unregister_device);
958958

0 commit comments

Comments
 (0)