From: Sasha Levin Date: Wed, 4 Oct 2023 09:28:37 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v6.5.6~37 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a946632f04213590eac427533f53589874d90143;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/net-fix-unwanted-sign-extension-in-netdev_stats_to_s.patch b/queue-4.19/net-fix-unwanted-sign-extension-in-netdev_stats_to_s.patch new file mode 100644 index 00000000000..1d73ab921e1 --- /dev/null +++ b/queue-4.19/net-fix-unwanted-sign-extension-in-netdev_stats_to_s.patch @@ -0,0 +1,43 @@ +From adc3a55bb14544428f4a5eedcedb39d200f58685 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Feb 2023 13:36:44 +0100 +Subject: net: Fix unwanted sign extension in netdev_stats_to_stats64() + +From: Felix Riemann + +[ Upstream commit 9b55d3f0a69af649c62cbc2633e6d695bb3cc583 ] + +When converting net_device_stats to rtnl_link_stats64 sign extension +is triggered on ILP32 machines as 6c1c509778 changed the previous +"ulong -> u64" conversion to "long -> u64" by accessing the +net_device_stats fields through a (signed) atomic_long_t. + +This causes for example the received bytes counter to jump to 16EiB after +having received 2^31 bytes. Casting the atomic value to "unsigned long" +beforehand converting it into u64 avoids this. + +Fixes: 6c1c5097781f ("net: add atomic_long_t to net_device_stats fields") +Signed-off-by: Felix Riemann +Reviewed-by: Eric Dumazet +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/core/dev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/core/dev.c b/net/core/dev.c +index 3bf40c288c032..0f9214fb36e01 100644 +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -9041,7 +9041,7 @@ void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, + + BUILD_BUG_ON(n > sizeof(*stats64) / sizeof(u64)); + for (i = 0; i < n; i++) +- dst[i] = atomic_long_read(&src[i]); ++ dst[i] = (unsigned long)atomic_long_read(&src[i]); + /* zero out counters that only exist in rtnl_link_stats64 */ + memset((char *)stats64 + n * sizeof(u64), 0, + sizeof(*stats64) - n * sizeof(u64)); +-- +2.40.1 + diff --git a/queue-4.19/scsi-megaraid_sas-enable-msix_load_balance-for-invad.patch b/queue-4.19/scsi-megaraid_sas-enable-msix_load_balance-for-invad.patch new file mode 100644 index 00000000000..4637f62b39c --- /dev/null +++ b/queue-4.19/scsi-megaraid_sas-enable-msix_load_balance-for-invad.patch @@ -0,0 +1,40 @@ +From 962c0057ed825197461b1da5a257299061c1f748 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Jun 2019 02:50:39 -0700 +Subject: scsi: megaraid_sas: Enable msix_load_balance for Invader and later + controllers + +From: Shivasharan S + +[ Upstream commit 1175b88452cad208894412b955ee698934968aed ] + +Load balancing IO completions across all available MSI-X vectors should be +enabled for Invader and later generation controllers only. This needs to +be disabled for older controllers. Add an adapter type check before +setting msix_load_balance flag. + +Fixes: 1d15d9098ad1 ("scsi: megaraid_sas: Load balance completions across all MSI-X") +Signed-off-by: Shivasharan S +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c +index bdfa36712fcc4..ac4800fb1a7fb 100644 +--- a/drivers/scsi/megaraid/megaraid_sas_base.c ++++ b/drivers/scsi/megaraid/megaraid_sas_base.c +@@ -5364,7 +5364,8 @@ static int megasas_init_fw(struct megasas_instance *instance) + instance->is_rdpq = (scratch_pad_2 & MR_RDPQ_MODE_OFFSET) ? + 1 : 0; + +- if (!instance->msix_combined) { ++ if (instance->adapter_type >= INVADER_SERIES && ++ !instance->msix_combined) { + instance->msix_load_balance = true; + instance->smp_affinity_enable = false; + } +-- +2.40.1 + diff --git a/queue-4.19/series b/queue-4.19/series index 3f4b2af8094..ec4ea684891 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -45,3 +45,7 @@ fbdev-sh7760fb-depend-on-fb-y.patch nvme-pci-do-not-set-the-numa-node-of-device-if-it-ha.patch watchdog-itco_wdt-no-need-to-stop-the-timer-in-probe.patch watchdog-itco_wdt-set-no_reboot-if-the-watchdog-is-n.patch +net-fix-unwanted-sign-extension-in-netdev_stats_to_s.patch +usb-typec-wcove-use-le-to-cpu-conversion-when-access.patch +usb-typec-tcpm-usb-typec-tcpm-fix-a-signedness-bug-i.patch +scsi-megaraid_sas-enable-msix_load_balance-for-invad.patch diff --git a/queue-4.19/usb-typec-tcpm-usb-typec-tcpm-fix-a-signedness-bug-i.patch b/queue-4.19/usb-typec-tcpm-usb-typec-tcpm-fix-a-signedness-bug-i.patch new file mode 100644 index 00000000000..3a631f7975c --- /dev/null +++ b/queue-4.19/usb-typec-tcpm-usb-typec-tcpm-fix-a-signedness-bug-i.patch @@ -0,0 +1,60 @@ +From bf9bcf6220a783be2c3ae2547e99749f91e9ee6d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Oct 2019 15:01:17 +0300 +Subject: usb: typec: tcpm: usb: typec: tcpm: Fix a signedness bug in + tcpm_fw_get_caps() + +From: Dan Carpenter + +[ Upstream commit 7101949f36fc77b530b73e4c6bd0066a2740d75b ] + +The "port->typec_caps.data" and "port->typec_caps.type" variables are +enums and in this context GCC will treat them as an unsigned int so they +can never be less than zero. + +Fixes: ae8a2ca8a221 ("usb: typec: Group all TCPCI/TCPM code together") +Signed-off-by: Dan Carpenter +Cc: stable +Reviewed-by: Guenter Roeck +Reviewed-by: Heikki Krogerus +Link: https://lore.kernel.org/r/20191001120117.GA23528@mwanda +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/typec/tcpm/tcpm.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c +index c5132f2942f71..6b0ecaae2cdba 100644 +--- a/drivers/usb/typec/tcpm/tcpm.c ++++ b/drivers/usb/typec/tcpm/tcpm.c +@@ -4440,18 +4440,20 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, + /* USB data support is optional */ + ret = fwnode_property_read_string(fwnode, "data-role", &cap_str); + if (ret == 0) { +- port->typec_caps.data = typec_find_port_data_role(cap_str); +- if (port->typec_caps.data < 0) +- return -EINVAL; ++ ret = typec_find_port_data_role(cap_str); ++ if (ret < 0) ++ return ret; ++ port->typec_caps.data = ret; + } + + ret = fwnode_property_read_string(fwnode, "power-role", &cap_str); + if (ret < 0) + return ret; + +- port->typec_caps.type = typec_find_port_power_role(cap_str); +- if (port->typec_caps.type < 0) +- return -EINVAL; ++ ret = typec_find_port_power_role(cap_str); ++ if (ret < 0) ++ return ret; ++ port->typec_caps.type = ret; + port->port_type = port->typec_caps.type; + + if (port->port_type == TYPEC_PORT_SNK) +-- +2.40.1 + diff --git a/queue-4.19/usb-typec-wcove-use-le-to-cpu-conversion-when-access.patch b/queue-4.19/usb-typec-wcove-use-le-to-cpu-conversion-when-access.patch new file mode 100644 index 00000000000..9258d198c50 --- /dev/null +++ b/queue-4.19/usb-typec-wcove-use-le-to-cpu-conversion-when-access.patch @@ -0,0 +1,47 @@ +From 5656139ec7aada056ef23e31066525cf48879043 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Jun 2021 20:22:02 +0300 +Subject: usb: typec: wcove: Use LE to CPU conversion when accessing + msg->header + +From: Andy Shevchenko + +[ Upstream commit d5ab95da2a41567440097c277c5771ad13928dad ] + +As LKP noticed the Sparse is not happy about strict type handling: + .../typec/tcpm/wcove.c:380:50: sparse: expected unsigned short [usertype] header + .../typec/tcpm/wcove.c:380:50: sparse: got restricted __le16 const [usertype] header + +Fix this by switching to use pd_header_cnt_le() instead of pd_header_cnt() +in the affected code. + +Fixes: ae8a2ca8a221 ("usb: typec: Group all TCPCI/TCPM code together") +Fixes: 3c4fb9f16921 ("usb: typec: wcove: start using tcpm for USB PD support") +Reported-by: kernel test robot +Reviewed-by: Heikki Krogerus +Reviewed-by: Guenter Roeck +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20210609172202.83377-1-andriy.shevchenko@linux.intel.com +Cc: stable +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/typec/tcpm/wcove.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/usb/typec/tcpm/wcove.c b/drivers/usb/typec/tcpm/wcove.c +index f1f8f45e2f3dc..ca3af15a1f9e8 100644 +--- a/drivers/usb/typec/tcpm/wcove.c ++++ b/drivers/usb/typec/tcpm/wcove.c +@@ -377,7 +377,7 @@ static int wcove_pd_transmit(struct tcpc_dev *tcpc, + const u8 *data = (void *)msg; + int i; + +- for (i = 0; i < pd_header_cnt(msg->header) * 4 + 2; i++) { ++ for (i = 0; i < pd_header_cnt_le(msg->header) * 4 + 2; i++) { + ret = regmap_write(wcove->regmap, USBC_TX_DATA + i, + data[i]); + if (ret) +-- +2.40.1 +