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

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

 



> > @@ -740,12 +755,45 @@ static void netvsc_send_completion(struct
> > net_device *ndev,
> >  				   int budget)
> >  {
> >  	const struct nvsp_message *nvsp_packet = hv_pkt_data(desc);
> > +	u32 msglen = hv_pkt_datalen(desc);
> > +
> > +	/* Ensure packet is big enough to read header fields */
> > +	if (msglen < sizeof(struct nvsp_message_header)) {
> > +		netdev_err(ndev, "nvsp_message length too small: %u\n",
> > msglen);
> > +		return;
> > +	}
> > 
> >  	switch (nvsp_packet->hdr.msg_type) {
> >  	case NVSP_MSG_TYPE_INIT_COMPLETE:
> > +		if (msglen < sizeof(struct nvsp_message_init_complete)) {
> 
> This and other similar places should include header size:
> 		if (msglen < sizeof(struct nvsp_message_header) + sizeof(struct nvsp_message_init_complete)) {

Thanks for pointing this out; fixing for v3...

  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