Re: [PATCH V3 1/1] ublk: add io_uring based userspace block driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 05, 2022 at 04:06:16PM +0800, Ming Lei wrote:
> On Mon, Jul 04, 2022 at 06:10:40PM -0400, Gabriel Krisman Bertazi wrote:
> > Ming Lei <ming.lei@xxxxxxxxxx> writes:

...
> 
> > 
> > 
> > > +			__func__, cmd->cmd_op, ub_cmd->q_id, tag,
> > > +			ub_cmd->result);
> > > +
> > > +	if (!(issue_flags & IO_URING_F_SQE128))
> > > +		goto out;
> > > +
> > > +	ubq = ublk_get_queue(ub, ub_cmd->q_id);
> > > +	if (!ubq || ub_cmd->q_id != ubq->q_id)
> > 
> > q_id is coming from userspace and is used to access an array inside
> > ublk_get_queue().  I think you need to ensure qid < ub->dev_info.nr_hw_queues
> > before calling ublk_get_queue() to protect from a kernel bad memory
> > access triggered by userspace.
> 
> Good catch!

Turns out the check on 'qid < ub->dev_info.nr_hw_queues' isn't needed,
since the condition of 'ub_cmd->q_id != ubq->q_id' is more strict.


Thanks,
Ming




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux