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 6E96DA0C47 for ; Tue, 10 Aug 2021 17:41:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 63CB34114F; Tue, 10 Aug 2021 17:41:26 +0200 (CEST) Received: from smtp-relay-canonical-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) by mails.dpdk.org (Postfix) with ESMTP id 1E332411C8 for ; Tue, 10 Aug 2021 17:41:25 +0200 (CEST) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (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-canonical-1.canonical.com (Postfix) with ESMTPS id 054953F338 for ; Tue, 10 Aug 2021 15:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628610085; bh=0x+mURI6RCV0NnjMBWa6MTNb6URhCyxxcrHRUmmOjXM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VzFAQZraP8H9Yc4zd0EdQCj96rsyV9Pmrvjdrl3HQ3wz9XZx8NfavhVbGED5Oi0rr a3hzL61pzrt2E0VqXfgrCGSbZjIclQxOORgbBgQJ1xN355uIGY+kZil/qBCJerMHog QscaqGyJbPzWI2btAx45Sp1BoNudCRc2nKv7c8bH+UAsUyYxG4fa0MQthmyGWE95Ls pIKQKXlpVH24tIQOrtWXbnC/cBOKT43g8q7CiyLRdohFCn0v6dn3cuYe/RJw6Hc6OD VUNg0K6/d9rYMf79rm8sRDM1cG+MtUdjA9qG4NnTF3jCyghPKD7L5c2CW8Lyd3scU0 qfagbloeBFuXw== Received: by mail-ed1-f69.google.com with SMTP id l3-20020aa7c3030000b02903bccf1897f9so10929959edq.19 for ; Tue, 10 Aug 2021 08:41:25 -0700 (PDT) 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=0x+mURI6RCV0NnjMBWa6MTNb6URhCyxxcrHRUmmOjXM=; b=lsDXMDFXEsuDSXWqlL0NAtJkU3Oxvw+suBnevKupbKU8n65Dozzi9R3VszYmc0sZ8D hFR8lCQ0VhlKMr6iQP6eMN09EbsasTJQGe0ADWMQfvGSFb5SG+bt/r3MFLgVVD2hofxM j3ydzIHKeugb3iNJJ1hfwF3YdM7rHV4fdFkz2D+7A6vlIiDvnh9fy96f99jJgBUIhcEU 0P1BIKHTgcIZfbhCx/AVHRZspYMEugcF8fiGReqyLQ1uLEGr3zvhpKa2ue/+1QDXGLln 46fRAshdr0afhuGak+8QqtmZboOrOhQ80qeZpPRUjhKtGCTRVeo2AOknRlI+vqpNYntd 1oCQ== X-Gm-Message-State: AOAM530d4tj04kCE+lT358/+X6gsbKmqkTBHb6YBQfWIsF89vRMZWy7S X7U3jA9KVvk23E1Us2BZ4Gd77At7wX5079myfkf6fRM1kpsjsIiq63WyV0eoplHtGHT2xSGMTeJ NUZmeA/MDMmxwPpw0O0CmhvMv X-Received: by 2002:a17:906:1784:: with SMTP id t4mr20594725eje.445.1628610084743; Tue, 10 Aug 2021 08:41:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYUiQ83wdxubEBV+T3uFw+FYjBv+L5932AmGconlJMAaifhtROoYrlbFRwQyDTlgv24rTY3w== X-Received: by 2002:a17:906:1784:: with SMTP id t4mr20594711eje.445.1628610084575; Tue, 10 Aug 2021 08:41:24 -0700 (PDT) Received: from Keschdeichel.fritz.box ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id dt2sm2452535ejc.51.2021.08.10.08.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 08:41:24 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Viacheslav Ovsiienko Cc: Matan Azrad , dpdk stable Date: Tue, 10 Aug 2021 17:39:00 +0200 Message-Id: <20210810154022.749358-20-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810154022.749358-1-christian.ehrhardt@canonical.com> References: <20210810154022.749358-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'common/mlx5: fix Netlink port name padding in probing' has been queued to stable release 19.11.10 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 19.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/12/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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/479de253642b9ffc6592cf71efb7bb835a1c646c Thanks. Christian Ehrhardt --- >From 479de253642b9ffc6592cf71efb7bb835a1c646c Mon Sep 17 00:00:00 2001 From: Viacheslav Ovsiienko Date: Sat, 19 Jun 2021 16:56:28 +0300 Subject: [PATCH] common/mlx5: fix Netlink port name padding in probing [ upstream commit 568d97c09ca00e52fd7805ef0cab522250dac18b ] On some kernels the string attributes within Netlink reply messages might be not padded with zeroes (in cases when string length is aligned with 4-byte boundary). While device probing, the physical port name was wrongly recognized, causing a probing failure. Fixes: 30a86157f6d5 ("net/mlx5: support PF representor") Signed-off-by: Viacheslav Ovsiienko Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_nl.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index 64580b9e6a..668affb0b1 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -30,6 +30,8 @@ #define MLX5_SEND_BUF_SIZE 32768 /* Receive buffer size for the Netlink socket */ #define MLX5_RECV_BUF_SIZE 32768 +/* Maximal physical port name length. */ +#define MLX5_PHYS_PORT_NAME_MAX 128 /** Parameters of VLAN devices created by driver. */ #define MLX5_VMWA_VLAN_DEVICE_PFX "evmlx" @@ -1029,6 +1031,7 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void *arg) size_t off = NLMSG_LENGTH(sizeof(struct ifinfomsg)); bool switch_id_set = false; bool num_vf_set = false; + int len; if (nh->nlmsg_type != RTM_NEWLINK) goto error; @@ -1044,7 +1047,24 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void *arg) num_vf_set = true; break; case IFLA_PHYS_PORT_NAME: - mlx5_translate_port_name((char *)payload, &info); + len = RTA_PAYLOAD(ra); + /* Some kernels do not pad attributes with zero. */ + if (len > 0 && len < MLX5_PHYS_PORT_NAME_MAX) { + char name[MLX5_PHYS_PORT_NAME_MAX]; + + /* + * We can't just patch the message with padding + * zero - it might corrupt the following items + * in the message, we have to copy the string + * by attribute length and pad the copied one. + */ + memcpy(name, payload, len); + name[len] = 0; + mlx5_translate_port_name(name, &info); + } else { + info.name_type = + MLX5_PHYS_PORT_NAME_TYPE_UNKNOWN; + } break; case IFLA_PHYS_SWITCH_ID: info.switch_id = 0; -- 2.32.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-08-10 15:11:13.853478648 +0200 +++ 0020-common-mlx5-fix-Netlink-port-name-padding-in-probing.patch 2021-08-10 15:11:12.922637408 +0200 @@ -1 +1 @@ -From 568d97c09ca00e52fd7805ef0cab522250dac18b Mon Sep 17 00:00:00 2001 +From 479de253642b9ffc6592cf71efb7bb835a1c646c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 568d97c09ca00e52fd7805ef0cab522250dac18b ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -18 +19 @@ - drivers/common/mlx5/linux/mlx5_nl.c | 22 +++++++++++++++++++++- + drivers/net/mlx5/mlx5_nl.c | 22 +++++++++++++++++++++- @@ -21,5 +22,5 @@ -diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c -index f0d04f9473..3f1912d078 100644 ---- a/drivers/common/mlx5/linux/mlx5_nl.c -+++ b/drivers/common/mlx5/linux/mlx5_nl.c -@@ -33,6 +33,8 @@ +diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c +index 64580b9e6a..668affb0b1 100644 +--- a/drivers/net/mlx5/mlx5_nl.c ++++ b/drivers/net/mlx5/mlx5_nl.c +@@ -30,6 +30,8 @@ @@ -34 +35 @@ -@@ -1191,6 +1193,7 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void *arg) +@@ -1029,6 +1031,7 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void *arg) @@ -42 +43 @@ -@@ -1206,7 +1209,24 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void *arg) +@@ -1044,7 +1047,24 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void *arg)