From: Tiwei Bie <tiwei.bie@intel.com>
To: Kevin Traynor <ktraynor@redhat.com>
Cc: Brian Russell <brussell@brocade.com>,
Luca Boccassi <bluca@debian.org>, dpdk stable <stable@dpdk.org>
Subject: Re: [dpdk-stable] patch 'net/virtio: fix PCI config error handling' has been queued to stable release 18.08.1
Date: Mon, 26 Nov 2018 10:02:31 +0800 [thread overview]
Message-ID: <20181126020231.GA16607@debian> (raw)
In-Reply-To: <20181123102713.17309-6-ktraynor@redhat.com>
On Fri, Nov 23, 2018 at 10:26:10AM +0000, Kevin Traynor wrote:
> Hi,
>
> FYI, your patch has been queued to stable release 18.08.1
>
> Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
> It will be pushed if I get no objections before 11/29/18. So please
> shout if anyone has objections.
Hi,
This patch can't be backported, as it depends on some API
change in newer release.
Thanks,
Tiwei
>
> Also note that after the patch there's a diff of the upstream commit vs the patch applied
> to the branch. If the code is different (ie: not only metadata diffs), due for example to
> a change in context or macro names, please double check it.
>
> Thanks.
>
> Kevin Traynor
>
> ---
> From e0af7542c97f172f44d633389d33920b889e8b22 Mon Sep 17 00:00:00 2001
> From: Brian Russell <brussell@brocade.com>
> Date: Tue, 28 Aug 2018 11:12:40 +0100
> Subject: [PATCH] net/virtio: fix PCI config error handling
>
> [ upstream commit 49bb1f7a0ab760a0f1fb39e27c90a1cb2ad42edd ]
>
> In virtio_read_caps and vtpci_msix_detect, rte_pci_read_config returns
> the number of bytes read from PCI config or < 0 on error.
> If less than the expected number of bytes are read then log the
> failure and return rather than carrying on with garbage.
>
> Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")
>
> Signed-off-by: Brian Russell <brussell@brocade.com>
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
> drivers/net/virtio/virtio_pci.c | 65 ++++++++++++++++++++++++---------
> 1 file changed, 48 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
> index 6bd22e54a..b6a3c80b4 100644
> --- a/drivers/net/virtio/virtio_pci.c
> +++ b/drivers/net/virtio/virtio_pci.c
> @@ -568,14 +568,16 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw)
>
> ret = rte_pci_read_config(dev, &pos, 1, PCI_CAPABILITY_LIST);
> - if (ret < 0) {
> - PMD_INIT_LOG(DEBUG, "failed to read pci capability list");
> + if (ret != 1) {
> + PMD_INIT_LOG(DEBUG,
> + "failed to read pci capability list, ret %d", ret);
> return -1;
> }
>
> while (pos) {
> - ret = rte_pci_read_config(dev, &cap, sizeof(cap), pos);
> - if (ret < 0) {
> - PMD_INIT_LOG(ERR,
> - "failed to read pci cap at pos: %x", pos);
> + ret = rte_pci_read_config(dev, &cap, 2, pos);
> + if (ret != 2) {
> + PMD_INIT_LOG(DEBUG,
> + "failed to read pci cap at pos: %x ret %d",
> + pos, ret);
> break;
> }
> @@ -587,5 +589,14 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw)
> * cap; next two bytes are the flags.
> */
> - uint16_t flags = ((uint16_t *)&cap)[1];
> + uint16_t flags;
> +
> + ret = rte_pci_read_config(dev, &flags, sizeof(flags),
> + pos + 2);
> + if (ret != sizeof(flags)) {
> + PMD_INIT_LOG(DEBUG,
> + "failed to read pci cap at pos:"
> + " %x ret %d", pos + 2, ret);
> + break;
> + }
>
> if (flags & PCI_MSIX_ENABLE)
> @@ -602,4 +613,12 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw)
> }
>
> + ret = rte_pci_read_config(dev, &cap, sizeof(cap), pos);
> + if (ret != sizeof(cap)) {
> + PMD_INIT_LOG(DEBUG,
> + "failed to read pci cap at pos: %x ret %d",
> + pos, ret);
> + break;
> + }
> +
> PMD_INIT_LOG(DEBUG,
> "[%2x] cfg type: %u, bar: %u, offset: %04x, len: %u",
> @@ -690,23 +709,35 @@ vtpci_msix_detect(struct rte_pci_device *dev)
> {
> uint8_t pos;
> - struct virtio_pci_cap cap;
> int ret;
>
> ret = rte_pci_read_config(dev, &pos, 1, PCI_CAPABILITY_LIST);
> - if (ret < 0) {
> - PMD_INIT_LOG(DEBUG, "failed to read pci capability list");
> + if (ret != 1) {
> + PMD_INIT_LOG(DEBUG,
> + "failed to read pci capability list, ret %d", ret);
> return VIRTIO_MSIX_NONE;
> }
>
> while (pos) {
> - ret = rte_pci_read_config(dev, &cap, sizeof(cap), pos);
> - if (ret < 0) {
> - PMD_INIT_LOG(ERR,
> - "failed to read pci cap at pos: %x", pos);
> + uint8_t cap[2];
> +
> + ret = rte_pci_read_config(dev, cap, sizeof(cap), pos);
> + if (ret != sizeof(cap)) {
> + PMD_INIT_LOG(DEBUG,
> + "failed to read pci cap at pos: %x ret %d",
> + pos, ret);
> break;
> }
>
> - if (cap.cap_vndr == PCI_CAP_ID_MSIX) {
> - uint16_t flags = ((uint16_t *)&cap)[1];
> + if (cap[0] == PCI_CAP_ID_MSIX) {
> + uint16_t flags;
> +
> + ret = rte_pci_read_config(dev, &flags, sizeof(flags),
> + pos + sizeof(cap));
> + if (ret != sizeof(flags)) {
> + PMD_INIT_LOG(DEBUG,
> + "failed to read pci cap at pos:"
> + " %x ret %d", pos + 2, ret);
> + break;
> + }
>
> if (flags & PCI_MSIX_ENABLE)
> @@ -716,5 +747,5 @@ vtpci_msix_detect(struct rte_pci_device *dev)
> }
>
> - pos = cap.cap_next;
> + pos = cap[1];
> }
>
> --
> 2.19.0
>
> ---
> Diff of the applied patch vs upstream commit (please double-check if non-empty:
> ---
> --- - 2018-11-23 10:22:54.406494254 +0000
> +++ 0006-net-virtio-fix-PCI-config-error-handling.patch 2018-11-23 10:22:54.000000000 +0000
> @@ -1,15 +1,16 @@
> -From 49bb1f7a0ab760a0f1fb39e27c90a1cb2ad42edd Mon Sep 17 00:00:00 2001
> +From e0af7542c97f172f44d633389d33920b889e8b22 Mon Sep 17 00:00:00 2001
> From: Brian Russell <brussell@brocade.com>
> Date: Tue, 28 Aug 2018 11:12:40 +0100
> Subject: [PATCH] net/virtio: fix PCI config error handling
>
> +[ upstream commit 49bb1f7a0ab760a0f1fb39e27c90a1cb2ad42edd ]
> +
> In virtio_read_caps and vtpci_msix_detect, rte_pci_read_config returns
> the number of bytes read from PCI config or < 0 on error.
> If less than the expected number of bytes are read then log the
> failure and return rather than carrying on with garbage.
>
> Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")
> -Cc: stable@dpdk.org
>
> Signed-off-by: Brian Russell <brussell@brocade.com>
> Signed-off-by: Luca Boccassi <bluca@debian.org>
next prev parent reply other threads:[~2018-11-26 2:04 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-23 10:26 [dpdk-stable] patch 'ip_frag: fix overflow in key comparison' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'eal/linux: fix memory leak of logid' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'malloc: check size hint when reserving the biggest element' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'bus/vdev: fix devargs after multi-process bus scan' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'vfio: fix sPAPR IOMMU mapping' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/virtio: fix PCI config error handling' " Kevin Traynor
2018-11-26 2:02 ` Tiwei Bie [this message]
2018-11-26 15:42 ` Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'bus/pci: compare kernel driver instead of interrupt handler' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'vfio: check if group fd is already open' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'vfio: fix read of freed memory on getting container fd' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'vfio: share default container in multi-process' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'fix global variable issues' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/virtio: register/unregister intr handler on start/stop' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'eal/linux: handle UIO read failure in interrupt handler' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'examples/vm_power: respect maximum CPUs' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'mk: disable gcc AVX512F support' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'crypto/scheduler: fix build with gcc 8.2' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'bus/dpaa: fix build with gcc 9.0' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'eal: " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'app/testpmd: fix shaper profile parameters' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'app/testpmd: fix RED byte stats' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'examples/ip_pipeline: fix port and table stats read' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'crypto/openssl: fix RSA verify operation' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'compressdev: clarify usage of op structure' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'compressdev: fix op allocation' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'compress/isal: fix uncleared compression states' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'ring/c11: synchronize load and store of the tail' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'ring/c11: move atomic load of head above the loop' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/i40e: fix offload not supported mask' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/mlx5: use pkg-config to handle SUSE libmnl' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/vhost: fix parameters string' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/virtio-user: do not stop stopped device again' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/virtio-user: do not make vhost channel non-block' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/virtio-user: do not reset owner when driver resets' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/virtio-user: fix device features for server mode' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/virtio: fix guest announce support' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net: fix build with pedantic' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/ixgbe: fix busy polling while fiber link update' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/virtio: do not re-enter clean up routines' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'ethdev: fix redundant function pointer check' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'app/testpmd: fix Tx offload flags' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/bonding: fix crash on probe' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'doc: clarify TSO Tx offload prerequisite' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'vhost/crypto: fix inferred misuse of enum' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/igb: update Tx offload mask' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/avf/base: fix shifting 32-bit signed variable 31 times' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/i40e: fix Rx instability with vector mode' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'net/bnxt: fix uninitialized variable access' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'lib: fix shifting 32-bit signed variable 31 times' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'service: fix possible null access' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'vhost: fix possible out of bound " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'ip_frag: check fragment length of incoming packet' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'bus/pci: fix config r/w access' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'examples/flow_filtering: filter out unsupported offloads' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'examples/flow_filtering: remove VLAN item' " Kevin Traynor
2018-11-23 10:26 ` [dpdk-stable] patch 'test/hash: fix build' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'eal/x86: remove unused memcpy file' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'test: fix build' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'ring/c11: keep deterministic order allowing retry to work' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'ring/c11: relax ordering for load and store of the head' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'pci: fix parsing of address without function number' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'bpf: fix x86 JIT for immediate loads' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'ipc: remove panic in async request' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'hash: fix TSX aborts with newer gcc' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'bus/vmbus: fix directory handle leak on error' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'net/tap: fix file descriptor " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'net/tap: fix file descriptor check' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'examples/flow_filtering: fix capability setting' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'app/testpmd: fix Rx offload search' " Kevin Traynor
2018-11-23 10:27 ` [dpdk-stable] patch 'net/tap: fix probe for multiq or flowq failure' " Kevin Traynor
2018-11-23 11:02 ` Varghese, Vipin
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=20181126020231.GA16607@debian \
--to=tiwei.bie@intel.com \
--cc=bluca@debian.org \
--cc=brussell@brocade.com \
--cc=ktraynor@redhat.com \
--cc=stable@dpdk.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).