Re: [PATCH] hv_netvsc: Add validation for untrusted Hyper-V values

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

 



Hi Haiyang,

[I'm resuming this work by Andres.  Sorry for the delay.]


> >  	switch (nvsp_packet->hdr.msg_type) {
> >  	case NVSP_MSG_TYPE_INIT_COMPLETE:
> >  	case NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE:
> >  	case NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE:
> >  	case NVSP_MSG5_TYPE_SUBCHANNEL:
> > +		if (msglen < sizeof(struct nvsp_message)) {
> > +			netdev_err(ndev, "nvsp_msg5 length too small: %u\n",
> > +				   msglen);
> > +			return;
> > +		}
> 
> struct nvsp_message includes all message types, so its length is the longest type,
> The messages from older host version are not necessarily reaching the 
> sizeof(struct nvsp_message).

I split the check above into several checks, one for each "case", using
(what I understand are) the corresponding structures/sizeofs...

> 
> Testing on both new and older hosts are recommended, in case I didn't find out all issues
> like this one.

Sure, will do.

Thanks,
  Andrea



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux