Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix double free in zfs_ioc_log_history()
Under Linux tsd_set() will call the destructor on the thread specific data when the passed value is NULL. Therefore, there is no need to call strfree() on the poolname after tsd_set(). The call to tsd_set() must also be moved after spa_open() to prevent a use-after-free style defect. Signed-off-by: Brian Behlendorf <[email protected]> Issue openzfs#4872
- Loading branch information
2d713a6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dear behlendorf , I am happy to see it. thinks for Answer it!
I agree with tsd_get, to determine whether poolname is NULL,
To ensure that the poolName spa_open is not NULL.
but, if isn't call to strfree, Will cause the memory leak poolName.
When to call tsd_set, set the entry he_value is NULL , therefore, when the call to strfree still is NULL. cause to coredump
I have a commit pull requests,
Signed: openzfs#4890
Proposed fix in openzfs#4890
reviews welcome.