mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-12-04 01:36:58 -05:00
misc: ocxl: fix possible double free in ocxl_file_register_afu
[ Upstream commit 950cf957fe34d40d63dfa3bf3968210430b6491e ]
info_release() will be called in device_unregister() when info->dev's
reference count is 0. So there is no need to call ocxl_afu_put() and
kfree() again.
Fix this by adding free_minor() and return to err_unregister error path.
Fixes: 75ca758adb ("ocxl: Create a clear delineation between ocxl backend & frontend")
Signed-off-by: Hangyu Hua <[email protected]>
Acked-by: Frederic Barrat <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
7f287d0c70
commit
de65c32ace
1 changed files with 2 additions and 0 deletions
|
|
@ -558,7 +558,9 @@ int ocxl_file_register_afu(struct ocxl_afu *afu)
|
|||
|
||||
err_unregister:
|
||||
ocxl_sysfs_unregister_afu(info); // safe to call even if register failed
|
||||
free_minor(info);
|
||||
device_unregister(&info->dev);
|
||||
return rc;
|
||||
err_put:
|
||||
ocxl_afu_put(afu);
|
||||
free_minor(info);
|
||||
|
|
|
|||
Loading…
Reference in a new issue