mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
percpu_ref: don't refer to ref->data if it isn't allocated
We can't check ref->data->confirm_switch directly in __percpu_ref_exit(), since
ref->data may not be allocated in one not-initialized refcount.
Fixes: 2b0d3d3e4f
("percpu_ref: reduce memory footprint of percpu_ref in fast path")
Reported-by: syzbot+fd15ff734dace9e16437@syzkaller.appspotmail.com
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
f4ac712e4f
commit
7ea6bf2e6c
@ -109,7 +109,7 @@ static void __percpu_ref_exit(struct percpu_ref *ref)
|
||||
|
||||
if (percpu_count) {
|
||||
/* non-NULL confirm_switch indicates switching in progress */
|
||||
WARN_ON_ONCE(ref->data->confirm_switch);
|
||||
WARN_ON_ONCE(ref->data && ref->data->confirm_switch);
|
||||
free_percpu(percpu_count);
|
||||
ref->percpu_count_ptr = __PERCPU_REF_ATOMIC_DEAD;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user