Skip to content
Commit 43e33924 authored by Yihao Wu's avatar Yihao Wu Committed by Chuck Lever
Browse files

SUNRPC/cache: Fix unsafe traverse caused double-free in cache_purge



Deleting list entry within hlist_for_each_entry_safe is not safe unless
next pointer (tmp) is protected too. It's not, because once hash_lock
is released, cache_clean may delete the entry that tmp points to. Then
cache_purge can walk to a deleted entry and tries to double free it.

Fix this bug by holding only the deleted entry's reference.

Suggested-by: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarYihao Wu <wuyihao@linux.alibaba.com>
Reviewed-by: default avatarNeilBrown <neilb@suse.de>
[ cel: removed unused variable ]
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent e1e8399e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment