History

qcom: soc: llcc-slice: Clear the global drv_data pointer on error

Currently the data structure for llc-slice is devm allocated and stored as a global but never cleared if the probe function fails. This is a problem because devm managed memory gets freed on probe failure the API functions could access the pointer after it has been freed. Initialize the drv_data pointer to an error and reset it to an error on probe failure or device destroy and add protection to the API functions to make sure the memory doesn't get accessed.

Jordan Crouse committed 7 years ago

Commit 72d1cd01 parent 4e2256d3 files · +66 −17Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/soc/qcom/llcc-qcom.h+6−0
@@ -162,6 +162,12 @@ int llcc_slice_deactivate(struct llcc_slice_desc *desc); · 161 unmodified lines
162 */162 */
163int qcom_llcc_probe(struct platform_device *pdev,163int qcom_llcc_probe(struct platform_device *pdev,
164 const struct llcc_slice_config *table, u32 sz);164 const struct llcc_slice_config *table, u32 sz);
165
166/**
167 * qcom_llcc_remove - remove the sct table
168 * @pdev: Platform device pointer
169 */
170int qcom_llcc_remove(struct platform_device *pdev);
165#else171#else
166static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid)172static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid)
167{173{

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t