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 DF488A0C4C for ; Mon, 12 Jul 2021 15:12:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9C9C4069D; Mon, 12 Jul 2021 15:12:08 +0200 (CEST) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mails.dpdk.org (Postfix) with ESMTP id 8AB9D4119C for ; Mon, 12 Jul 2021 15:12:07 +0200 (CEST) Received: by mail-wr1-f51.google.com with SMTP id d12so24923303wre.13 for ; Mon, 12 Jul 2021 06:12: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=W3SeXIKToDeSVqHWDXWEQBXGf7jrWbdNmKh2z6tsW8I=; b=AZ1KV5KY/8pxLKqwGrFsm43QwZc7L0TiTQjnbRj50ENdOZApxDfBnauwqDnWrZAtld z0dWRsIivIGfEbeOtGw14ceDaW1H02WT4fwxrJ24EyTV3AoGJajjHHLAHpvaenJDyCoP qclO3vppKGxCfDLrecmcYWsKK0aceqIfntiRIOkhln0deUpXccSuhgoYz4p/WZUoUml1 ZCS1Tec5I+o1aVF3C/1DIJF3GTCnKpch8OPH0lJNDuLW48c1ewSHFHfro+uHduBgSsZS EXWor4Y2ifeESnqq+eCYP9U123xceNRKyGVPuDaOnUZEYvMXm1apc0W/zT1cFGGsEhec Jpiw== 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=W3SeXIKToDeSVqHWDXWEQBXGf7jrWbdNmKh2z6tsW8I=; b=KwY+K3OPK6/oKvU5M3cuxo1qllp9I1D1URutpbsJrY5D2qP303uKbpKkJMSvv/XtQ4 D98PH2FdEHVhd7a1q3eCyzHUhm+km36tZAROm3l5/1Cbw3SSi4vRrJT7RHlZJP28NY+K fvepdqBKRAx2xdILGYJzJtXgnW/Y/V7qccysfGAPG6qYPeVezZ/lV807KDX/wp9Ak9Dq fwDmXdT7uplU9iA9g5VuiuUPAuvxBnn2sT1COs5Rl1BkoPkNVHWYOrMHrqSfGIEjueCe fz1l+gvDSw+0bxhNq2hrhyhgN4dCaA2elTpz+uQb8MINGly5niTPsBotPqfkkEvwLvVJ YJuA== X-Gm-Message-State: AOAM531qCyEhZZGTv8tHvWK0ERcmjz0KVYuoIpeztQbRjjm6Bo/9UJPm cHQfYxOxqNP3ObQ9LebxnWU= X-Google-Smtp-Source: ABdhPJx3cki5Vx0ksJAvgLXKoZGgZ7JLkSH3jW/fOEAQLE0YXANsUzzsYSyu/3v39esofryIfWiTGQ== X-Received: by 2002:adf:fb51:: with SMTP id c17mr60214801wrs.106.1626095527400; Mon, 12 Jul 2021 06:12:07 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id t5sm8040945wrw.38.2021.07.12.06.12.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 06:12:06 -0700 (PDT) From: luca.boccassi@gmail.com To: Viacheslav Ovsiienko Cc: Matan Azrad , dpdk stable Date: Mon, 12 Jul 2021 14:04:35 +0100 Message-Id: <20210712130551.2462159-40-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210712130551.2462159-1-luca.boccassi@gmail.com> References: <20210712130551.2462159-1-luca.boccassi@gmail.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 20.11.3 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.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 07/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/aaf50dbe5b55f16a69e79736b1631d855c827c4f Thanks. Luca Boccassi --- >From aaf50dbe5b55f16a69e79736b1631d855c827c4f 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/common/mlx5/linux/mlx5_nl.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c index ef7a521379..94afa04b85 100644 --- a/drivers/common/mlx5/linux/mlx5_nl.c +++ b/drivers/common/mlx5/linux/mlx5_nl.c @@ -33,6 +33,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" @@ -1188,6 +1190,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; @@ -1203,7 +1206,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.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-07-12 13:41:38.753925781 +0100 +++ 0040-common-mlx5-fix-Netlink-port-name-padding-in-probing.patch 2021-07-12 13:41:36.330119277 +0100 @@ -1 +1 @@ -From 568d97c09ca00e52fd7805ef0cab522250dac18b Mon Sep 17 00:00:00 2001 +From aaf50dbe5b55f16a69e79736b1631d855c827c4f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 568d97c09ca00e52fd7805ef0cab522250dac18b ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index f0d04f9473..3f1912d078 100644 +index ef7a521379..94afa04b85 100644 @@ -34 +35 @@ -@@ -1191,6 +1193,7 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void *arg) +@@ -1188,6 +1190,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) +@@ -1203,7 +1206,24 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void *arg)