[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220401160036.GA437893@anparri>
Date: Fri, 1 Apr 2022 18:00:36 +0200
From: Andrea Parri <parri.andrea@...il.com>
To: "Michael Kelley (LINUX)" <mikelley@...rosoft.com>
Cc: KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
Wei Hu <weh@...rosoft.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Rob Herring <robh@...nel.org>,
Krzysztof Wilczynski <kw@...ux.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 2/4] PCI: hv: Use vmbus_requestor to generate
transaction IDs for VMbus hardening
> > @@ -91,6 +91,9 @@ static enum pci_protocol_version_t pci_protocol_versions[] = {
> > /* space for 32bit serial number as string */
> > #define SLOT_NAME_SIZE 11
> >
> > +/* Size of requestor for VMbus */
> > +#define HV_PCI_RQSTOR_SIZE 64
>
> Might include a comment about how this value was derived. I *think*
> it is an arbitrary value based on the assumption that having more than
> one request outstanding is rare, and so 64 should be extremely generous
> in ensuring that we don't ever run out.
Right, I've added a comment to that effect.
> > @@ -2696,8 +2699,9 @@ static void hv_pci_onchannelcallback(void *context)
> > const int packet_size = 0x100;
> > int ret;
> > struct hv_pcibus_device *hbus = context;
> > + struct vmbus_channel *chan = hbus->hdev->channel;
>
> Having gotten the channel as a local variable, could also use the local as
> the first argument to vmbus_recvpacket_raw().
Applied.
> > @@ -2743,11 +2747,13 @@ static void hv_pci_onchannelcallback(void *context)
> > switch (desc->type) {
> > case VM_PKT_COMP:
> >
> > - /*
> > - * The host is trusted, and thus it's safe to interpret
> > - * this transaction ID as a pointer.
> > - */
> > - comp_packet = (struct pci_packet *)req_id;
> > + req_addr = chan->request_addr_callback(chan, req_id);
> > + if (req_addr == VMBUS_RQST_ERROR) {
> > + dev_warn_ratelimited(&hbus->hdev->device,
> > + "Invalid request ID\n");
>
> Could you include the req_id value in the error message that is output? I
> was recently debugging a problem in the storvsc driver where having that
> value would have been handy.
Sure.
Thanks,
Andrea
Powered by blists - more mailing lists