Re: [PATCH v2 1/3] Drivers: hv: vmbus: Add vmbus_requestor data structure for VMBus hardening

From: Andres Beltran
Date: Mon Jun 29 2020 - 18:09:19 EST


On Mon, Jun 29, 2020 at 5:56 PM Michael Kelley <mikelley@xxxxxxxxxxxxx> wrote:
> I'm not understanding the problem here. Any VMbus driver that uses
> this requestID allocation mechanism must set newchannel->rqstor_size
> to a non-zero value. But if a VMbus driver doesn't use the mechanism,
> then newchannel->rqstor_size will default to zero, and the mechanism
> will not be initialized for the channels used by that driver. I think the
> cleanup of the mechanism handles the case where it wasn't ever
> initialized. Or am I missing something?
>
> Michael

Yes, that is correct. I think the validation is necessary if there
exists an instance
where a driver call vmbus_next_request_id or vmbus_request_addr() with a rqstor
that has not been previously initialized. Currently, the rqstor
pointer is not being
validated in these 2 functions, because we assume that the driver has
initialized the
array with a non-zero value before calling next_id() or request_addr().

Andres.