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 C7A75A0093 for ; Fri, 22 May 2020 11:42:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B9ABE1D96A; Fri, 22 May 2020 11:42:09 +0200 (CEST) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id E98341D970 for ; Fri, 22 May 2020 11:42:07 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id l11so9562559wru.0 for ; Fri, 22 May 2020 02:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R+evMkjZhIlg5J5CNWM0mT03d1pE0dh4g0gYluYdV+M=; b=jsfDIlMe6NOU/p5OSzz3zS8ed6AVH6sq+sXkwBuObRtK80ty9pJFmMHAdU6I++grvG 5S3c5lnbi7Ml8eQH1A3wMh7I8fA4x9ha3/oKC+Ik48sQhvjsFPFD+wVWZLGsnwnmZdvR aUgAHBsDZ+kr+5v8w8pJvpLSulvquYAQRob/fl5U/jiEyeiN77Ec3bD5K86kMr1S9PMr 6FOS/p1a7x9BfcDKjIZoTbaMDekxmMEqBuANq1EDWscFd22niYVRt4Fd55d6IsbiqJnb AOQ0ClLpEQ2PZGUifJh9jwC2h7sD0uuLX2X/CHzibIaZOI2b8yiDL9q5FtUCwO4bdVZe MfTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R+evMkjZhIlg5J5CNWM0mT03d1pE0dh4g0gYluYdV+M=; b=EPk2HvqFMdjsa+co1qBO2nQo0hCLyhgYxrzAMPgxt25NQ0rDlrMCbktIvXScxSracm qyAIvmjSiOLVBR3ZGabv3lNwLs1BeyJ/6lIXPUO1xUjj/S7ESw/uo1XtGlBxOBIBX/fb VhEvvyY3IHw6NfFa6GWtBZTXlUJ0+mCvJSD9iqzjTIdNAXyaKUVkq5Sp/l67rD6CbHuI gbjucgNOzRUKj/6cbQqpbDfuVh/+MKkktXdFBlhoXMuqeNgnXOTfNhnKhcTmjECKTvxs P/O0HnbqvkkgIJq411oLqgFvE/g2ovtlFlWG9mkFaAsboJKy2+HuXpAzXxbSWvc7PBIC JnfQ== X-Gm-Message-State: AOAM531EOiQXrvfyogwSfMhi4fOXQsyI2fRXVH/d/k1vxXSf9iWY3mlO Z55Uq8GImoBb5vfccp3IOunY3mhJVHNLHg== X-Google-Smtp-Source: ABdhPJzErzBgsR4n1PFuSyBIg2QVWJqoL6/Km44tKoLP2Rc9UcFqhKC/0EJNlDzeFno/f7ib3wXOeg== X-Received: by 2002:a05:6000:1289:: with SMTP id f9mr2710466wrx.5.1590140527693; Fri, 22 May 2020 02:42:07 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id t6sm9403315wma.4.2020.05.22.02.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 02:42:07 -0700 (PDT) From: luca.boccassi@gmail.com To: Gaetan Rivet Cc: Darek Stojaczyk , dpdk stable Date: Fri, 22 May 2020 10:40:13 +0100 Message-Id: <20200522094022.1025696-34-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200522094022.1025696-1-luca.boccassi@gmail.com> References: <20200519130549.112823-214-luca.boccassi@gmail.com> <20200522094022.1025696-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'pci: reject negative values in PCI id' has been queued to stable release 19.11.3 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" Hi, FYI, your patch has been queued to stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/24/20. 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. Thanks. Luca Boccassi --- >From a7413810b94b89763b3af7ba97a9a91f17737732 Mon Sep 17 00:00:00 2001 From: Gaetan Rivet Date: Wed, 13 May 2020 12:47:50 +0200 Subject: [PATCH] pci: reject negative values in PCI id [ upstream commit 21a61fae51804cfdf7c6f7e6189c63f02025de89 ] The function strtoul will not return ERANGE if the input is negative, as one might expect. 0000:-FFFFFFFFFFFFFFFB:00.0 is not a better way to write 0000:05:00.0. To simplify checking for '-', forbid using spaces before the field value. 0000: 00: 2c.0 Should not be accepted. Fixes: af75078fece3 ("first public release") Signed-off-by: Gaetan Rivet Acked-by: Darek Stojaczyk --- lib/librte_pci/rte_pci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c index ad2cdfebb2..5f7726fa89 100644 --- a/lib/librte_pci/rte_pci.c +++ b/lib/librte_pci/rte_pci.c @@ -35,6 +35,12 @@ get_u8_pciaddr_field(const char *in, void *_u8, char dlm) if (*in == '\0') return NULL; + /* PCI field starting with spaces is forbidden. + * Negative wrap-around is not reported as an error by strtoul. + */ + if (*in == ' ' || *in == '-') + return NULL; + errno = 0; val = strtoul(in, &end, 16); if (errno != 0 || end[0] != dlm || val > UINT8_MAX) { @@ -70,6 +76,12 @@ pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr) unsigned long val; char *end; + /* PCI id starting with spaces is forbidden. + * Negative wrap-around is not reported as an error by strtoul. + */ + if (*in == ' ' || *in == '-') + return -EINVAL; + errno = 0; val = strtoul(in, &end, 16); if (errno != 0 || end[0] != ':' || val > UINT32_MAX) -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-22 10:37:40.590667334 +0100 +++ 0034-pci-reject-negative-values-in-PCI-id.patch 2020-05-22 10:37:39.240414721 +0100 @@ -1,8 +1,10 @@ -From 21a61fae51804cfdf7c6f7e6189c63f02025de89 Mon Sep 17 00:00:00 2001 +From a7413810b94b89763b3af7ba97a9a91f17737732 Mon Sep 17 00:00:00 2001 From: Gaetan Rivet Date: Wed, 13 May 2020 12:47:50 +0200 Subject: [PATCH] pci: reject negative values in PCI id +[ upstream commit 21a61fae51804cfdf7c6f7e6189c63f02025de89 ] + The function strtoul will not return ERANGE if the input is negative, as one might expect. @@ -16,7 +18,6 @@ Should not be accepted. Fixes: af75078fece3 ("first public release") -Cc: stable@dpdk.org Signed-off-by: Gaetan Rivet Acked-by: Darek Stojaczyk