linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Parri <parri.andrea@gmail.com>
To: Haiyang Zhang <haiyangz@microsoft.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	KY Srinivasan <kys@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	Andres Beltran <lkmlabelt@gmail.com>,
	Michael Kelley <mikelley@microsoft.com>,
	Saruhan Karademir <skarade@microsoft.com>,
	Juan Vazquez <juvazq@microsoft.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH v2] hv_netvsc: Add validation for untrusted Hyper-V values
Date: Fri, 11 Sep 2020 10:43:01 +0200	[thread overview]
Message-ID: <20200911084301.GA14414@andrea> (raw)
In-Reply-To: <BL0PR2101MB0930659825AD89FF5A8DC2C4CA270@BL0PR2101MB0930.namprd21.prod.outlook.com>

> > @@ -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

      reply	other threads:[~2020-09-11  8:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 12:47 [PATCH v2] hv_netvsc: Add validation for untrusted Hyper-V values Andrea Parri (Microsoft)
2020-09-10 21:10 ` Haiyang Zhang
2020-09-11  8:43   ` Andrea Parri [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200911084301.GA14414@andrea \
    --to=parri.andrea@gmail.com \
    --cc=davem@davemloft.net \
    --cc=haiyangz@microsoft.com \
    --cc=juvazq@microsoft.com \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkmlabelt@gmail.com \
    --cc=mikelley@microsoft.com \
    --cc=netdev@vger.kernel.org \
    --cc=skarade@microsoft.com \
    --cc=sthemmin@microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).