From: Greg Kroah-Hartman Date: Sun, 29 Oct 2023 12:25:17 +0000 (+0100) Subject: 4.19-stable patches X-Git-Tag: v6.1.61~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=389afb557a30c67a4e3b6c551222fdd6132784ff;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: i2c-muxes-i2c-demux-pinctrl-use-of_get_i2c_adapter_by_node.patch i2c-muxes-i2c-mux-gpmux-use-of_get_i2c_adapter_by_node.patch i2c-muxes-i2c-mux-pinctrl-use-of_get_i2c_adapter_by_node.patch i2c-stm32f7-fix-pec-handling-in-case-of-smbus-transfers.patch nvmem-imx-correct-nregs-for-i.mx6sll.patch nvmem-imx-correct-nregs-for-i.mx6ul.patch perf-core-fix-potential-null-deref.patch --- diff --git a/queue-4.19/i2c-muxes-i2c-demux-pinctrl-use-of_get_i2c_adapter_by_node.patch b/queue-4.19/i2c-muxes-i2c-demux-pinctrl-use-of_get_i2c_adapter_by_node.patch new file mode 100644 index 00000000000..28e96442c07 --- /dev/null +++ b/queue-4.19/i2c-muxes-i2c-demux-pinctrl-use-of_get_i2c_adapter_by_node.patch @@ -0,0 +1,42 @@ +From 0fb118de5003028ad092a4e66fc6d07b86c3bc94 Mon Sep 17 00:00:00 2001 +From: Herve Codina +Date: Fri, 20 Oct 2023 17:30:12 +0200 +Subject: i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node() + +From: Herve Codina + +commit 0fb118de5003028ad092a4e66fc6d07b86c3bc94 upstream. + +i2c-demux-pinctrl uses the pair of_find_i2c_adapter_by_node() / +i2c_put_adapter(). These pair alone is not correct to properly lock the +I2C parent adapter. + +Indeed, i2c_put_adapter() decrements the module refcount while +of_find_i2c_adapter_by_node() does not increment it. This leads to an +underflow of the parent module refcount. + +Use the dedicated function, of_get_i2c_adapter_by_node(), to handle +correctly the module refcount. + +Fixes: 50a5ba876908 ("i2c: mux: demux-pinctrl: add driver") +Signed-off-by: Herve Codina +Cc: stable@vger.kernel.org +Acked-by: Peter Rosin +Reviewed-by: Jonathan Cameron +Signed-off-by: Wolfram Sang +Signed-off-by: Greg Kroah-Hartman +--- + drivers/i2c/muxes/i2c-demux-pinctrl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c ++++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c +@@ -64,7 +64,7 @@ static int i2c_demux_activate_master(str + if (ret) + goto err; + +- adap = of_find_i2c_adapter_by_node(priv->chan[new_chan].parent_np); ++ adap = of_get_i2c_adapter_by_node(priv->chan[new_chan].parent_np); + if (!adap) { + ret = -ENODEV; + goto err_with_revert; diff --git a/queue-4.19/i2c-muxes-i2c-mux-gpmux-use-of_get_i2c_adapter_by_node.patch b/queue-4.19/i2c-muxes-i2c-mux-gpmux-use-of_get_i2c_adapter_by_node.patch new file mode 100644 index 00000000000..1d337d0ff06 --- /dev/null +++ b/queue-4.19/i2c-muxes-i2c-mux-gpmux-use-of_get_i2c_adapter_by_node.patch @@ -0,0 +1,42 @@ +From 3dc0ec46f6e7511fc4fdf6b6cda439382bc957f1 Mon Sep 17 00:00:00 2001 +From: Herve Codina +Date: Fri, 20 Oct 2023 17:30:13 +0200 +Subject: i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node() + +From: Herve Codina + +commit 3dc0ec46f6e7511fc4fdf6b6cda439382bc957f1 upstream. + +i2c-mux-gpmux uses the pair of_find_i2c_adapter_by_node() / +i2c_put_adapter(). These pair alone is not correct to properly lock the +I2C parent adapter. + +Indeed, i2c_put_adapter() decrements the module refcount while +of_find_i2c_adapter_by_node() does not increment it. This leads to an +underflow of the parent module refcount. + +Use the dedicated function, of_get_i2c_adapter_by_node(), to handle +correctly the module refcount. + +Fixes: ac8498f0ce53 ("i2c: i2c-mux-gpmux: new driver") +Signed-off-by: Herve Codina +Cc: stable@vger.kernel.org +Acked-by: Peter Rosin +Reviewed-by: Jonathan Cameron +Signed-off-by: Wolfram Sang +Signed-off-by: Greg Kroah-Hartman +--- + drivers/i2c/muxes/i2c-mux-gpmux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/i2c/muxes/i2c-mux-gpmux.c ++++ b/drivers/i2c/muxes/i2c-mux-gpmux.c +@@ -55,7 +55,7 @@ static struct i2c_adapter *mux_parent_ad + dev_err(dev, "Cannot parse i2c-parent\n"); + return ERR_PTR(-ENODEV); + } +- parent = of_find_i2c_adapter_by_node(parent_np); ++ parent = of_get_i2c_adapter_by_node(parent_np); + of_node_put(parent_np); + if (!parent) + return ERR_PTR(-EPROBE_DEFER); diff --git a/queue-4.19/i2c-muxes-i2c-mux-pinctrl-use-of_get_i2c_adapter_by_node.patch b/queue-4.19/i2c-muxes-i2c-mux-pinctrl-use-of_get_i2c_adapter_by_node.patch new file mode 100644 index 00000000000..b2fd5a550a2 --- /dev/null +++ b/queue-4.19/i2c-muxes-i2c-mux-pinctrl-use-of_get_i2c_adapter_by_node.patch @@ -0,0 +1,42 @@ +From 3171d37b58a76e1febbf3f4af2d06234a98cf88b Mon Sep 17 00:00:00 2001 +From: Herve Codina +Date: Fri, 20 Oct 2023 17:30:11 +0200 +Subject: i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node() + +From: Herve Codina + +commit 3171d37b58a76e1febbf3f4af2d06234a98cf88b upstream. + +i2c-mux-pinctrl uses the pair of_find_i2c_adapter_by_node() / +i2c_put_adapter(). These pair alone is not correct to properly lock the +I2C parent adapter. + +Indeed, i2c_put_adapter() decrements the module refcount while +of_find_i2c_adapter_by_node() does not increment it. This leads to an +underflow of the parent module refcount. + +Use the dedicated function, of_get_i2c_adapter_by_node(), to handle +correctly the module refcount. + +Fixes: c4aee3e1b0de ("i2c: mux: pinctrl: remove platform_data") +Signed-off-by: Herve Codina +Cc: stable@vger.kernel.org +Acked-by: Peter Rosin +Reviewed-by: Jonathan Cameron +Signed-off-by: Wolfram Sang +Signed-off-by: Greg Kroah-Hartman +--- + drivers/i2c/muxes/i2c-mux-pinctrl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/i2c/muxes/i2c-mux-pinctrl.c ++++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c +@@ -73,7 +73,7 @@ static struct i2c_adapter *i2c_mux_pinct + dev_err(dev, "Cannot parse i2c-parent\n"); + return ERR_PTR(-ENODEV); + } +- parent = of_find_i2c_adapter_by_node(parent_np); ++ parent = of_get_i2c_adapter_by_node(parent_np); + of_node_put(parent_np); + if (!parent) + return ERR_PTR(-EPROBE_DEFER); diff --git a/queue-4.19/i2c-stm32f7-fix-pec-handling-in-case-of-smbus-transfers.patch b/queue-4.19/i2c-stm32f7-fix-pec-handling-in-case-of-smbus-transfers.patch new file mode 100644 index 00000000000..fb120648f58 --- /dev/null +++ b/queue-4.19/i2c-stm32f7-fix-pec-handling-in-case-of-smbus-transfers.patch @@ -0,0 +1,64 @@ +From c896ff2dd8f30a6b0a922c83a96f6d43f05f0e92 Mon Sep 17 00:00:00 2001 +From: Alain Volmat +Date: Tue, 10 Oct 2023 10:44:54 +0200 +Subject: i2c: stm32f7: Fix PEC handling in case of SMBUS transfers + +From: Alain Volmat + +commit c896ff2dd8f30a6b0a922c83a96f6d43f05f0e92 upstream. + +In case of SMBUS byte read with PEC enabled, the whole transfer +is split into two commands. A first write command, followed by +a read command. The write command does not have any PEC byte +and a PEC byte is appended at the end of the read command. +(cf Read byte protocol with PEC in SMBUS specification) + +Within the STM32 I2C controller, handling (either sending +or receiving) of the PEC byte is done via the PECBYTE bit in +register CR2. + +Currently, the PECBYTE is set at the beginning of a transfer, +which lead to sending a PEC byte at the end of the write command +(hence losing the real last byte), and also does not check the +PEC byte received during the read command. + +This patch corrects the function stm32f7_i2c_smbus_xfer_msg +in order to only set the PECBYTE during the read command. + +Fixes: 9e48155f6bfe ("i2c: i2c-stm32f7: Add initial SMBus protocols support") +Signed-off-by: Alain Volmat +Reviewed-by: Pierre-Yves MORDRET +Acked-by: Andi Shyti +Signed-off-by: Wolfram Sang +Signed-off-by: Greg Kroah-Hartman +--- + drivers/i2c/busses/i2c-stm32f7.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/i2c/busses/i2c-stm32f7.c ++++ b/drivers/i2c/busses/i2c-stm32f7.c +@@ -959,9 +959,10 @@ static int stm32f7_i2c_smbus_xfer_msg(st + /* Configure PEC */ + if ((flags & I2C_CLIENT_PEC) && f7_msg->size != I2C_SMBUS_QUICK) { + cr1 |= STM32F7_I2C_CR1_PECEN; +- cr2 |= STM32F7_I2C_CR2_PECBYTE; +- if (!f7_msg->read_write) ++ if (!f7_msg->read_write) { ++ cr2 |= STM32F7_I2C_CR2_PECBYTE; + f7_msg->count++; ++ } + } else { + cr1 &= ~STM32F7_I2C_CR1_PECEN; + cr2 &= ~STM32F7_I2C_CR2_PECBYTE; +@@ -1049,8 +1050,10 @@ static void stm32f7_i2c_smbus_rep_start( + f7_msg->stop = true; + + /* Add one byte for PEC if needed */ +- if (cr1 & STM32F7_I2C_CR1_PECEN) ++ if (cr1 & STM32F7_I2C_CR1_PECEN) { ++ cr2 |= STM32F7_I2C_CR2_PECBYTE; + f7_msg->count++; ++ } + + /* Set number of bytes to be transferred */ + cr2 &= ~(STM32F7_I2C_CR2_NBYTES_MASK); diff --git a/queue-4.19/nvmem-imx-correct-nregs-for-i.mx6sll.patch b/queue-4.19/nvmem-imx-correct-nregs-for-i.mx6sll.patch new file mode 100644 index 00000000000..7bbfc774254 --- /dev/null +++ b/queue-4.19/nvmem-imx-correct-nregs-for-i.mx6sll.patch @@ -0,0 +1,32 @@ +From 414a98abbefd82d591f4e2d1efd2917bcd3b6f6d Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Fri, 13 Oct 2023 13:49:02 +0100 +Subject: nvmem: imx: correct nregs for i.MX6SLL + +From: Peng Fan + +commit 414a98abbefd82d591f4e2d1efd2917bcd3b6f6d upstream. + +The nregs for i.MX6SLL should be 80 per fuse map, correct it. + +Fixes: 6da27821a6f5 ("nvmem: imx-ocotp: add support for imx6sll") +Cc: Stable@vger.kernel.org +Signed-off-by: Peng Fan +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20231013124904.175782-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -439,7 +439,7 @@ static const struct ocotp_params imx6sl_ + }; + + static const struct ocotp_params imx6sll_params = { +- .nregs = 128, ++ .nregs = 80, + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + }; diff --git a/queue-4.19/nvmem-imx-correct-nregs-for-i.mx6ul.patch b/queue-4.19/nvmem-imx-correct-nregs-for-i.mx6ul.patch new file mode 100644 index 00000000000..50289ecbfe6 --- /dev/null +++ b/queue-4.19/nvmem-imx-correct-nregs-for-i.mx6ul.patch @@ -0,0 +1,32 @@ +From 7d6e10f5d254681983b53d979422c8de3fadbefb Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Fri, 13 Oct 2023 13:49:03 +0100 +Subject: nvmem: imx: correct nregs for i.MX6UL + +From: Peng Fan + +commit 7d6e10f5d254681983b53d979422c8de3fadbefb upstream. + +The nregs for i.MX6UL should be 144 per fuse map, correct it. + +Fixes: 4aa2b4802046 ("nvmem: octop: Add support for imx6ul") +Cc: Stable@vger.kernel.org +Signed-off-by: Peng Fan +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20231013124904.175782-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -451,7 +451,7 @@ static const struct ocotp_params imx6sx_ + }; + + static const struct ocotp_params imx6ul_params = { +- .nregs = 128, ++ .nregs = 144, + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + }; diff --git a/queue-4.19/perf-core-fix-potential-null-deref.patch b/queue-4.19/perf-core-fix-potential-null-deref.patch new file mode 100644 index 00000000000..1ee3172f6c4 --- /dev/null +++ b/queue-4.19/perf-core-fix-potential-null-deref.patch @@ -0,0 +1,32 @@ +From a71ef31485bb51b846e8db8b3a35e432cc15afb5 Mon Sep 17 00:00:00 2001 +From: Peter Zijlstra +Date: Tue, 24 Oct 2023 11:42:21 +0200 +Subject: perf/core: Fix potential NULL deref + +From: Peter Zijlstra + +commit a71ef31485bb51b846e8db8b3a35e432cc15afb5 upstream. + +Smatch is awesome. + +Fixes: 32671e3799ca ("perf: Disallow mis-matched inherited group reads") +Reported-by: Dan Carpenter +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman +--- + kernel/events/core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -11629,7 +11629,8 @@ static int inherit_group(struct perf_eve + if (IS_ERR(child_ctr)) + return PTR_ERR(child_ctr); + } +- leader->group_generation = parent_event->group_generation; ++ if (leader) ++ leader->group_generation = parent_event->group_generation; + return 0; + } + diff --git a/queue-4.19/series b/queue-4.19/series index 9b5c5b1b538..52c431b06d6 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -12,3 +12,10 @@ treewide-spelling-fix-in-comment.patch igb-fix-potential-memory-leak-in-igb_add_ethtool_nfc.patch gtp-fix-fragmentation-needed-check-with-gso.patch i40e-fix-wrong-check-for-i40e_txr_flags_wb_on_itr.patch +i2c-muxes-i2c-mux-pinctrl-use-of_get_i2c_adapter_by_node.patch +i2c-muxes-i2c-mux-gpmux-use-of_get_i2c_adapter_by_node.patch +i2c-muxes-i2c-demux-pinctrl-use-of_get_i2c_adapter_by_node.patch +i2c-stm32f7-fix-pec-handling-in-case-of-smbus-transfers.patch +nvmem-imx-correct-nregs-for-i.mx6sll.patch +nvmem-imx-correct-nregs-for-i.mx6ul.patch +perf-core-fix-potential-null-deref.patch