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 51B4BA0C3F for ; Sat, 12 Jun 2021 01:14:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C2F14003F; Sat, 12 Jun 2021 01:14:36 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2081.outbound.protection.outlook.com [40.107.237.81]) by mails.dpdk.org (Postfix) with ESMTP id DF7694003F for ; Sat, 12 Jun 2021 01:14:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VbaiAh3uMXF8I4KjyMunzAQUwVF04cDvcsu2HhplOZCYSB3jg9vW0pwhrehelar4Otjvk7lB2oq0oS3R6mot7wNpVI+swpjKnUfxdGWxMm+pgRJ7QK3sji8rcEv08JvBgUIPdIZqnfFS56nCaSQae2rDpyTp5xsWzbs2WDCYnssDA6VPVyVT3MP4ri4UUKi2Tr3kZ9R/hBgGK2oDEJV0NwE/xlkDRJKhNKYAaE+N3dyATStEvxLcX/lBfAMOfE48EHf2sIGFuv0dVyZEcX6uA8blRNqj+6ba39U1a9SJegp21thYa/eQj7yGaCiUshhHPiNzfyPdMcod4lcRY/ZmTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9O+LFqXwDod4sABNK1RECjjkxrnpILn8qqhuSFXgqzg=; b=jTDa9vQ37bVtNAfRmNgt4G+OfhEcnjNbQO6RuGetGwUMVdGov1HaOaZIIYQgvV02mzi/W2qSeoLmhV7wQ6OdXzcL8rZCIu6+M2AzwIsPS1ekaaafk8pw4kYIm4eX/KgaFkwRN2hb1ybmBCalOBh42P718XGMjnhCfhFBqTSLYNu1Ucidj9fm80Iqsl+w9zB6mWBRG9Q/ugigO9261hN1tdfOdLFiTG7gnQ0rOH5ic9lml8cEguYxkBS9AsX+0+FAbAv36vAxxjyFBYi6d2PoJy/M8UoNIVl7SCYLNba5iekWaBJO/1EZaTsLOPUFB2XqkrAhcMKJm6miVxpH3jYYpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9O+LFqXwDod4sABNK1RECjjkxrnpILn8qqhuSFXgqzg=; b=J8QHfyJE38uo8M3yx4/QmxctP3zPLiPmLTzX9EeOysviKjwudOQYXL0Iq8x/vpIOZnRRrEBKTR4lMnd5Est9wU3QJR4QAuTzJW0D0u2J82W7CifJGz9P7ApRDMuTwt8tRu85N/TKQfMATWCsAV5xWwg7xmHQ79vZV4pPLzb6CWR71qKV2tHPvrD5MLfFGm52GAlP3ctCOi0gEwoZLIWDNgW50/gzgsHoEO3OygElx9RzlnsCPXXOnzwEC1julGypvfBaIIHYLe+6VSMxmvNNw2OMljl8fKZxpdPO6W/hxwgmMA09WyaNpf4iPx0r5hotCnhcNL1vDbiLHNfJJZZ4Zw== Received: from BN8PR04CA0042.namprd04.prod.outlook.com (2603:10b6:408:d4::16) by DM6PR12MB3307.namprd12.prod.outlook.com (2603:10b6:5:15d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20; Fri, 11 Jun 2021 23:14:33 +0000 Received: from BN8NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::6b) by BN8PR04CA0042.outlook.office365.com (2603:10b6:408:d4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 23:14:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT059.mail.protection.outlook.com (10.13.177.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 23:14:33 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 11 Jun 2021 23:14:30 +0000 From: Xueming Li To: Hongbo Zheng CC: Luca Boccassi , Min Hu , Reshma Pattan , David Hunt , dpdk stable Date: Sat, 12 Jun 2021 07:03:17 +0800 Message-ID: <20210611230433.8208-103-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611230433.8208-1-xuemingl@nvidia.com> References: <20210510160258.30982-229-xuemingl@nvidia.com> <20210611230433.8208-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 45daa62f-a629-466f-def8-08d92d2eac4e X-MS-TrafficTypeDiagnostic: DM6PR12MB3307: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RO7cK87VxQY9P14vtmw4W1BQHlO+L8Cio/yUIrtNQBIup4VpHV4nRSp/++bezTGXrc6dhBkWtyX1eWYVQ+ef1dxNl3EEGh3R4mYD1G0xNpZsC4E4lylUwsMBIym48NtftMEnXH7AyLmFr0mA+i1SqghowZINt7HiHFstMs9DcBoAD44K7DB8mZTu3/FsYcrqEuIEv12nxkY/tBWEfG5D01ZPEfTTGf2w51C4v+ZdL6LVJj3ACT4EWRwzbdEAvrIhUKSgMxrluxx/sdz8X4USUUs8lzYjI1h4dBefFUMX9kDTHTxpln8R4N9rEJW/PVMjTX6+nKdJG3ERCBazpYF3PiQstGcSbhiTY3K02qw1Aq9xSJQ9aqQxxkfggnesPbMlImSAdUAMeyYCe3ad2dNBcxF6m+NHe7ZTxstFe56OGfEWKeQippEBHiDBFf+97Er/G+EXiXSPv+m7+nTppLSetVEWuN4Uh2vVmg/IWJMlyLXw+sk7DM4SiyJcwCtgob5SWv+dPMSt50dYqmDg/t8En2/60uBSWrMo9SBm2PqZeT7saG+LGKfNZarZFLDP8zTsS98Wab2lr54nU6cY0+0loTwwSNIQWnBBCcEGechQ9LFg3uN/vQjNvb0809B7XxUGDbRweM10UUZmTUou50JeWwPSoq9rIiCjij7aPyELiD4mlbbfvVOxlRFLr97UgswUZmiQ4tg2dI155JyfT/d34HeJQHmcFxZtj2WJm17+XRcVpvZOHxdkES1RNyT6oEbTmt0GuItGLbBgt+jUEmCs0FoMK+0JuTCaPMtynkbAyyitplG9pTVeNN+khVZ+9II5 X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(346002)(136003)(376002)(39860400002)(396003)(46966006)(36840700001)(7636003)(36906005)(70586007)(2616005)(966005)(6666004)(47076005)(53546011)(2906002)(54906003)(186003)(7696005)(16526019)(8676002)(26005)(82310400003)(36756003)(5660300002)(6916009)(356005)(55016002)(336012)(83380400001)(8936002)(1076003)(70206006)(4326008)(426003)(6286002)(478600001)(316002)(82740400003)(86362001)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2021 23:14:33.0502 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45daa62f-a629-466f-def8-08d92d2eac4e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3307 Subject: [dpdk-stable] patch 'power: fix sanity checks for guest channel read' has been queued to stable release 20.11.2 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/14/21. 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/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/b7ab9f121d70b57465583b9c074d85fb3c6e7386 Thanks. Xueming Li --- >From b7ab9f121d70b57465583b9c074d85fb3c6e7386 Mon Sep 17 00:00:00 2001 From: Hongbo Zheng Date: Wed, 12 May 2021 10:19:19 +0800 Subject: [PATCH] power: fix sanity checks for guest channel read Cc: Luca Boccassi [ upstream commit 1fe00fd358c0b5cab798010a69e758bfead9fd84 ] In function power_guest_channel_read_msg, 'lcore_id' is used before validity check, which may cause buffer 'global_fds' accessed by index 'lcore_id' overflow. This patch moves the validity check of 'lcore_id' before the 'lcore_id' being used for the first time. Fixes: 9dc843eb273b ("power: extend guest channel API for reading") Signed-off-by: Hongbo Zheng Signed-off-by: Min Hu (Connor) Reviewed-by: Reshma Pattan Acked-by: David Hunt --- lib/librte_power/guest_channel.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c index 2f7507a03c..474dd92998 100644 --- a/lib/librte_power/guest_channel.c +++ b/lib/librte_power/guest_channel.c @@ -166,6 +166,17 @@ int power_guest_channel_read_msg(void *pkt, if (pkt_len == 0 || pkt == NULL) return -1; + if (lcore_id >= RTE_MAX_LCORE) { + RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 0...%d\n", + lcore_id, RTE_MAX_LCORE-1); + return -1; + } + + if (global_fds[lcore_id] < 0) { + RTE_LOG(ERR, GUEST_CHANNEL, "Channel is not connected\n"); + return -1; + } + fds.fd = global_fds[lcore_id]; fds.events = POLLIN; @@ -179,17 +190,6 @@ int power_guest_channel_read_msg(void *pkt, return -1; } - if (lcore_id >= RTE_MAX_LCORE) { - RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 0...%d\n", - lcore_id, RTE_MAX_LCORE-1); - return -1; - } - - if (global_fds[lcore_id] < 0) { - RTE_LOG(ERR, GUEST_CHANNEL, "Channel is not connected\n"); - return -1; - } - while (pkt_len > 0) { ret = read(global_fds[lcore_id], pkt, pkt_len); -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-06-12 06:53:59.270979100 +0800 +++ 0103-power-fix-sanity-checks-for-guest-channel-read.patch 2021-06-12 06:53:56.460000000 +0800 @@ -1 +1 @@ -From 1fe00fd358c0b5cab798010a69e758bfead9fd84 Mon Sep 17 00:00:00 2001 +From b7ab9f121d70b57465583b9c074d85fb3c6e7386 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 1fe00fd358c0b5cab798010a69e758bfead9fd84 ] @@ -14 +16,0 @@ -Cc: stable@dpdk.org @@ -21 +23 @@ - lib/power/guest_channel.c | 22 +++++++++++----------- + lib/librte_power/guest_channel.c | 22 +++++++++++----------- @@ -24 +26 @@ -diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c +diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c @@ -26,2 +28,2 @@ ---- a/lib/power/guest_channel.c -+++ b/lib/power/guest_channel.c +--- a/lib/librte_power/guest_channel.c ++++ b/lib/librte_power/guest_channel.c