Re: [PATCH] block, bfq: fix waker_bfqq UAF after bfq_split_bfqq()

From: Jan Kara
Date: Thu Jan 09 2025 - 04:01:58 EST


On Thu 09-01-25 09:32:08, Yu Kuai wrote:
> Hi,
>
> 在 2025/01/08 22:42, Jan Kara 写道:
> >
> >
> > > */
> > > if (bfqq_process_refs(waker_bfqq) == 1)
> > > return NULL;
> > > - break;
> > > +
> > > + return waker_bfqq;
> >
> > So how do you know bfqq_process_refs(waker_bfqq) is not 0 in this case?
>
> Because in this case, waker_bfqq is in the merge chain of bfqq, and bfqq
> is obtained frm the current process, which means waker_bfqq should have
> at least one process reference that is from current thread.

Ah, right. Thanks for explanation. The except for the typo the patch looks
good to me. Feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

(although I can see Jens has already picked up the patch so probably this
is immaterial).

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR