From: Andrea Parri <parri.andrea@gmail.com>
To: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Andres Beltran <lkmlabelt@gmail.com>,
KY Srinivasan <kys@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Michael Kelley <mikelley@microsoft.com>,
Saruhan Karademir <skarade@microsoft.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH] hv_netvsc: Add validation for untrusted Hyper-V values
Date: Fri, 14 Aug 2020 12:39:19 +0200 [thread overview]
Message-ID: <20200814103919.GA12689@andrea> (raw)
In-Reply-To: <BL0PR2101MB0930BC0130F6AE5775E62604CA4C0@BL0PR2101MB0930.namprd21.prod.outlook.com>
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
prev parent reply other threads:[~2020-08-14 10:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-28 22:53 [PATCH] hv_netvsc: Add validation for untrusted Hyper-V values Andres Beltran
2020-07-30 23:49 ` David Miller
2020-08-02 22:26 ` Haiyang Zhang
2020-08-14 10:39 ` 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=20200814103919.GA12689@andrea \
--to=parri.andrea@gmail.com \
--cc=davem@davemloft.net \
--cc=haiyangz@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).