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