From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A888DA0544 for ; Fri, 11 Nov 2022 12:40:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A4E6C427EB; Fri, 11 Nov 2022 12:40:25 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id C4BB940141 for ; Fri, 11 Nov 2022 12:40:24 +0100 (CET) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 37EE33F0C8 for ; Fri, 11 Nov 2022 11:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1668166824; bh=7cQEkOvIUUguqp3x6rxJv4VrD+Wz0180JgHb6WOSscY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dEu+XUAtPzX8SKeTfYw7ClxBbVGST1DLJaTe4IV6xGxFOaSE/1xN3pnsJvh/e0ZuJ P2CM6yN2KDp+6H4QNEhaSLZc+q5Nu7mmndF/MGeGFzRlo/FFbAJxKZ01TVjhpiKe2k jQtEbyIfh66jhqGyHFRDLYgnh1gvqgMsU0KoFM2JZuAjhzOBbZcxp8BCefYxYGSOx6 OCIIugYxETUvpS3xvix1rBZCLAeaJqHjLr/sqmn563iA1RzP8XjrLUcEFkheMS8EQL TaI72oeiIfe6FKt1M+wAgK994NcBBO7cL9obK3ga2bf2EiJ1akxeFLtfpTxOmNzN0a FNCvnIPWcxsiQ== Received: by mail-ej1-f70.google.com with SMTP id hp16-20020a1709073e1000b007adf5a83df7so2910046ejc.1 for ; Fri, 11 Nov 2022 03:40:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7cQEkOvIUUguqp3x6rxJv4VrD+Wz0180JgHb6WOSscY=; b=SfyaNoGxh6pQcsCSVu66r+REDgZJs8Y39aoS0fJplE0OKCkpuzPo8Kbdbm6Ccxn2u4 zNmnjccDXb/awQrnaAPfOZNlgBjLKHpVVXlUvHAxyJ4WVQmNLp9GgkhSZ9VT8WyMnPad IUISUAN3nprgkUz+xq1Te4eT7NPJQ71son4ooYYru3DT9cDcX763667ORzCiO5+SK5AY Wk1xQQ0xuqs0POALa0wgCS4hyFzDowTh/t3xDdWhmXVcfCAJLJvakg1xcbFg+ANgjMnu F78T4gwbYho5PptZ+/Q15LTnGUBUAIVqJtpGBp4T0s2lnz4dQwhHq9S7ZuUYixm3zvV9 2enQ== X-Gm-Message-State: ANoB5pkb41zoIIGsmYOa7+QCr/BzqPvc/6rGhDz22qFxN2LjBCChNJQ1 7tXjKvmlOUaYR6RXr414zitmHmHlc9a6CKchdtAQbUmG/gixMLKNAA2Xp7hO7TtbFW77AlPC2UG +BX1cw9Ku/upaLBgEvp7L3Swg X-Received: by 2002:a05:6402:398:b0:461:8250:620c with SMTP id o24-20020a056402039800b004618250620cmr1139794edv.90.1668166823757; Fri, 11 Nov 2022 03:40:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf5RSm3JK7WLS0EwAe6pit8/T6OHFrqw+S/PszLpqW8Yx6OqsYIa/1OThJvFgOZ4TfItn0LNzA== X-Received: by 2002:a05:6402:398:b0:461:8250:620c with SMTP id o24-20020a056402039800b004618250620cmr1139776edv.90.1668166823512; Fri, 11 Nov 2022 03:40:23 -0800 (PST) Received: from localhost.localdomain ([2a02:6d40:39af:c100:1891:6c61:50fd:e567]) by smtp.gmail.com with ESMTPSA id n23-20020a170906701700b0078db18d7972sm777713ejj.117.2022.11.11.03.40.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 03:40:22 -0800 (PST) From: christian.ehrhardt@canonical.com To: Alexander Chernavin Cc: Chenbo Xia , dpdk stable Subject: patch 'net/virtio: fix crash when configured twice' has been queued to stable release 19.11.14 Date: Fri, 11 Nov 2022 12:38:39 +0100 Message-Id: <20221111113904.1549618-22-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221111113904.1549618-1-christian.ehrhardt@canonical.com> References: <20221111113904.1549618-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 19.11.14 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/18/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/03a6d4d8daa763a4f21746efdaf3aa1b124ee9ef Thanks. Christian Ehrhardt --- >From 03a6d4d8daa763a4f21746efdaf3aa1b124ee9ef Mon Sep 17 00:00:00 2001 From: Alexander Chernavin Date: Tue, 27 Sep 2022 10:15:04 +0000 Subject: [PATCH] net/virtio: fix crash when configured twice [ upstream commit 52bd03e969e9b38a7357287aece2488c7f92158f ] When first attempt to configure a device with RX interrupt enabled fails for some reason (e.g. because "Multiple intr vector not supported"), second attempt to configure the device with RX interrupt disabled and feature set unchanged will succeed but will leave virtio queues not allocated. Accessing the queues will cause a segfault. First attempt: - virtio_dev_configure() - virtio_init_device() is called to reinit the device because "dev->data->dev_conf.intr_conf.rxq" is "1" - virtio_configure_intr() fails and returns an error - virtio_free_queues() frees previously allocated virtio queues - virtio_init_device() fails and returns an error - virtio_dev_configure() fails and returns an error Second attempt: - virtio_dev_configure() - This time virtio_init_device() is not called, virtio queues are not allocated With this fix, reinit the device during configuration if virtio queues are not allocated. Fixes: 2b38151f745a ("net/virtio: fix queue memory leak on error") Signed-off-by: Alexander Chernavin Reviewed-by: Chenbo Xia --- drivers/net/virtio/virtio_ethdev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 4e615d2b4b..7a634189b4 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -2129,6 +2129,13 @@ virtio_dev_configure(struct rte_eth_dev *dev) return ret; } + /* if queues are not allocated, reinit the device */ + if (hw->vqs == NULL) { + ret = virtio_init_device(dev, hw->req_guest_features); + if (ret < 0) + return ret; + } + if ((rx_offloads & (DEV_RX_OFFLOAD_UDP_CKSUM | DEV_RX_OFFLOAD_TCP_CKSUM)) && !vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM)) { -- 2.38.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-11 12:35:05.578299390 +0100 +++ 0022-net-virtio-fix-crash-when-configured-twice.patch 2022-11-11 12:35:04.761191997 +0100 @@ -1 +1 @@ -From 52bd03e969e9b38a7357287aece2488c7f92158f Mon Sep 17 00:00:00 2001 +From 03a6d4d8daa763a4f21746efdaf3aa1b124ee9ef Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 52bd03e969e9b38a7357287aece2488c7f92158f ] + @@ -30 +31,0 @@ -Cc: stable@dpdk.org @@ -39 +40 @@ -index 7e07270a8b..574f671158 100644 +index 4e615d2b4b..7a634189b4 100644 @@ -42 +43 @@ -@@ -2617,6 +2617,13 @@ virtio_dev_configure(struct rte_eth_dev *dev) +@@ -2129,6 +2129,13 @@ virtio_dev_configure(struct rte_eth_dev *dev) @@ -53,3 +54,3 @@ - if ((rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) && - !virtio_with_feature(hw, VIRTIO_NET_F_RSS)) { - PMD_DRV_LOG(ERR, "RSS support requested but not supported by the device"); + if ((rx_offloads & (DEV_RX_OFFLOAD_UDP_CKSUM | + DEV_RX_OFFLOAD_TCP_CKSUM)) && + !vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM)) {