[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200814103919.GA12689@andrea>
Date: Fri, 14 Aug 2020 12:39:19 +0200
From: Andrea Parri <parri.andrea@...il.com>
To: Haiyang Zhang <haiyangz@...rosoft.com>
Cc: Andres Beltran <lkmlabelt@...il.com>,
KY Srinivasan <kys@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Michael Kelley <mikelley@...rosoft.com>,
Saruhan Karademir <skarade@...rosoft.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] hv_netvsc: Add validation for untrusted Hyper-V values
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
Powered by blists - more mailing lists