From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CEBB6A04C1 for ; Tue, 19 Nov 2019 09:23:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A78E82BA2; Tue, 19 Nov 2019 09:23:18 +0100 (CET) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id E17542AB; Tue, 19 Nov 2019 09:23:15 +0100 (CET) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id AB9B2280064; Tue, 19 Nov 2019 08:23:13 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 19 Nov 2019 00:23:08 -0800 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 19 Nov 2019 00:22:55 -0800 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id xAJ8MsN2024572; Tue, 19 Nov 2019 08:22:54 GMT Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 8ADE9161648; Tue, 19 Nov 2019 08:22:54 +0000 (GMT) From: Andrew Rybchenko To: Thomas Monjalon , Ferruh Yigit CC: , Date: Tue, 19 Nov 2019 08:22:50 +0000 Message-ID: <1574151770-25925-1-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-25050.005 X-TM-AS-Result: No-0.762800-4.000000-10 X-TMASE-MatchedRID: +aHVMaZTR5YuTfTZIiCqbVkxnoxnQfVSAp+UH372RZUZwGrh4y4izNJS OQbbF/mUyTEpIqig6S5TvVffeIwvQxtM6v9NhvjMAZ0lncqeHqGCjYCZBYLml1jBUeMsjed6QBz oPKhLashO9UxJ8vboSWGr6HtKJQTVzD8138PYfo6eAiCmPx4NwBnUJ0Ek6yhjxEHRux+uk8ifEz J5hPndGfo/h9VdVh3JPd5hLLuQG4pWgZtdlmHgGsQ1ZDzRrd4wUZMpXHCpmL8YpF8J+cX+gcRpJ 1sqySv21RYgfAtKDGEsYFfmoLs40ZN1JFeUKeMEiOOUXfTkScBZSbxIRLLN37zfneGoTKOTw8g2 HBNcF5k= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10-0.762800-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-25050.005 X-MDID: 1574151795-qoqHZDjb1TsJ Subject: [dpdk-stable] [PATCH] ethdev: avoid undefined behaviour on configuration copying X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" memcpy() source and destination areas must not overlap and equal pointers is the case which is really met, so handle it. Fixes: 68b931bff287 ("ethdev: eliminate interim variable") Cc: stable@dpdk.org Signed-off-by: Andrew Rybchenko --- slave_configure() in drivers/net/bonding calls rte_eth_dev_configure() with &slave_eth_dev->data->dev_conf. Alternative solution is to fix bonding and return error if dev_conf is equal to &dev->data->dev_conf since usecase is unclear and callers should not use dev->data. lib/librte_ethdev/rte_ethdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 8f48e8d659..8d2ce31a81 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1245,7 +1245,9 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, * Copy the dev_conf parameter into the dev structure. * rte_eth_dev_info_get() requires dev_conf, copy it before dev_info get */ - memcpy(&dev->data->dev_conf, dev_conf, sizeof(dev->data->dev_conf)); + if (dev_conf != &dev->data->dev_conf) + memcpy(&dev->data->dev_conf, dev_conf, + sizeof(dev->data->dev_conf)); ret = rte_eth_dev_info_get(port_id, &dev_info); if (ret != 0) -- 2.17.1