5.15.179-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 267/620 clk: qcom: clk-alpha-pll: fix alpha mode configuration
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
commit 33f1722eb86e45320a3dd7b3d42f6593a1d595c2 upstream.
Commit c45ae598fc16 ("clk: qcom: support for alpha mode configuration") added support for configuring alpha mode, but it seems that the feature was never working in practice.
The value of the alpha_{en,mode}_mask members of the configuration gets added to the value parameter passed to the regmap_update_bits() function, however the same values are not getting applied to the bitmask. As the result, the respective bits in the USER_CTL register are never modifed which leads to improper configuration of several PLLs.
The following table shows the PLL configurations where the 'alpha_en_mask' member is set and which are passed as a parameter for the clk_alpha_pll_configure() function. In the table the 'expected rate' column shows the rate the PLL should run at with the given configuration, and the 'real rate' column shows the rate the PLL runs at actually. The real rates has been verified on hardwareOn IPQ* platforms, on other platforms, those are computed values only.
file pll expected rate real rate dispcc-qcm2290.c disp_cc_pll0 768.0 MHz 768.0 MHz dispcc-sm6115.c disp_cc_pll0 768.0 MHz 768.0 MHz gcc-ipq5018.c ubi32_pll 1000.0 MHz != 984.0 MHz gcc-ipq6018.c nss_crypto_pll 1200.0 MHz 1200.0 MHz gcc-ipq6018.c ubi32_pll 1497.6 MHz != 1488.0 MHz gcc-ipq8074.c nss_crypto_pll 1200.0 MHz != 1190.4 MHz gcc-qcm2290.c gpll11 532.0 MHz != 518.4 MHz gcc-qcm2290.c gpll8 533.2 MHz != 518.4 MHz gcc-qcs404.c gpll3 921.6 MHz 921.6 MHz gcc-sm6115.c gpll11 600.0 MHz != 595.2 MHz gcc-sm6115.c gpll8 800.0 MHz != 787.2 MHz gpucc-sdm660.c gpu_cc_pll0 800.0 MHz != 787.2 MHz gpucc-sdm660.c gpu_cc_pll1 740.0 MHz != 729.6 MHz gpucc-sm6115.c gpu_cc_pll0 1200.0 MHz != 1190.4 MHz gpucc-sm6115.c gpu_cc_pll1 640.0 MHz != 633.6 MHz gpucc-sm6125.c gpu_pll0 1020.0 MHz != 1017.6 MHz gpucc-sm6125.c gpu_pll1 930.0 MHz != 921.6 MHz mmcc-sdm660.c mmpll8 930.0 MHz != 921.6 MHz mmcc-sdm660.c mmpll5 825.0 MHz != 806.4 MHz
As it can be seen from the above, there are several PLLs which are configured incorrectly.
Change the code to apply both 'alpha_en_mask' and 'alpha_mode_mask' values to the bitmask in order to configure the alpha mode correctly.
Applying the 'alpha_en_mask' fixes the initial rate of the PLLs showed in the table above. Since the 'alpha_mode_mask' is not used by any driver currently, that part of the change causes no functional changes.
--- drivers/clk/qcom/clk-alpha-pll.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/qcom/clk-alpha-pll.c +2 -0
@@ -284,6 +284,8 @@ void clk_alpha_pll_configure(struct clk_ mask |= config->pre_div_mask; mask |= config->post_div_mask; mask |= config->vco_mask; + mask |= config->alpha_en_mask; + mask |= config->alpha_mode_mask;regmap_update_bits (regmap,PLL_USER_CTL (pll), mask, val);
Greg Kroah-Hartman
maintainerPATCH 268/620 clk: qcom: gcc-sm6350: Add missing parent_map for two clocks
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
commit 96fe1a7ee477d701cfc98ab9d3c730c35d966861 upstream.
If a clk_rcg2 has a parent, it should also have parent_map defined, otherwise we'll get a NULL pointer dereference when calling clk_set_rate like the following:
[ 3.388105] Call trace: [ 3.390664] qcom_find_src_index+0x3c/0x70 (P) [ 3.395301] qcom_find_src_index+0x1c/0x70 (L) [ 3.399934] _freq_tbl_determine_rate+0x48/0x100 [ 3.404753] clk_rcg2_determine_rate+0x1c/0x28 [ 3.409387] clk_core_determine_round_nolock+0x58/0xe4 [ 3.421414] clk_core_round_rate_nolock+0x48/0xfc [ 3.432974] clk_core_round_rate_nolock+0xd0/0xfc [ 3.444483] clk_core_set_rate_nolock+0x8c/0x300 [ 3.455886] clk_set_rate+0x38/0x14c
Add the parent_map property for two clocks where it's missing and also un-inline the parent_data as well to keep the matching parent_map and parent_data together.
--- drivers/clk/qcom/gcc-sm6350.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/clk/qcom/gcc-sm6350.c +14 -8
@@ -181,6 +181,14 @@ static const struct clk_parent_data gcc_ { .hw = &gpll0_out_odd.clkr.hw }, }; +static const struct parent_map gcc_parent_map_3[] = { + {P_BI_TCXO ,0 }, +}; + +static const struct clk_parent_data gcc_parent_data_3[] = { + { .fw_name ="bi_tcxo" }, +}; +static const struct parent_map gcc_parent_map_4[] = { {P_BI_TCXO ,0 }, {P_GPLL0_OUT_MAIN ,1 },
@@ -700,13 +708,12 @@ static struct clk_rcg2 gcc_ufs_phy_phy_a .cmd_rcgr = 0x3a0b0, .mnd_width = 0, .hid_width = 5, + .parent_map = gcc_parent_map_3, .freq_tbl = ftbl_gcc_ufs_phy_phy_aux_clk_src, .clkr.hw.init = &(struct clk_init_data ){ .name ="gcc_ufs_phy_phy_aux_clk_src" , - .parent_data = &(const struct clk_parent_data ){ - .fw_name ="bi_tcxo" , - }, - .num_parents =1 , + .parent_data = gcc_parent_data_3, + .num_parents =ARRAY_SIZE (gcc_parent_data_3), .ops = &clk_rcg2_ops, }, };
@@ -763,13 +770,12 @@ static struct clk_rcg2 gcc_usb30_prim_mo .cmd_rcgr = 0x1a034, .mnd_width = 0, .hid_width = 5, + .parent_map = gcc_parent_map_3, .freq_tbl = ftbl_gcc_usb30_prim_mock_utmi_clk_src, .clkr.hw.init = &(struct clk_init_data ){ .name ="gcc_usb30_prim_mock_utmi_clk_src" , - .parent_data = &(const struct clk_parent_data ){ - .fw_name ="bi_tcxo" , - }, - .num_parents =1 , + .parent_data = gcc_parent_data_3, + .num_parents =ARRAY_SIZE (gcc_parent_data_3), .ops = &clk_rcg2_ops, }, };
Greg Kroah-Hartman
maintainerPATCH 269/620 clk: qcom: gcc-mdm9607: Fix cmd_rcgr offset for blsp1_uart6 rcg
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Satya Priya Kakitapalli <[email protected]>
commit 88d9dca36aac9659446be1e569d8fbe3462b5741 upstream.
Fix cmd_rcgr offset for blsp1_uart6_apps_clk_src on mdm9607 platform.
--- drivers/clk/qcom/gcc-mdm9607.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-mdm9607.c +1 -1
@@ -536,7 +536,7 @@ static struct clk_rcg2 blsp1_uart5_apps_ };static struct clk_rcg2 blsp1_uart6_apps_clk_src = { - .cmd_rcgr =0x6044 , + .cmd_rcgr =0x7044 , .mnd_width =16 , .hid_width =5 , .parent_map = gcc_xo_gpll0_map,
Greg Kroah-Hartman
maintainerPATCH 270/620 clk: qcom: clk-rpmh: prevent integer overflow in recalc_rate
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anastasia Belova <[email protected]>
commit 89aa5925d201b90a48416784831916ca203658f9 upstream.
aggr_state and unit fields are u32. The result of their multiplication may not fit in this type.
Add explicit casting to prevent overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/clk/qcom/clk-rpmh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/clk-rpmh.c +1 -1
@@ -331,7 +331,7 @@ static unsigned long clk_rpmh_bcm_recalc {struct clk_rpmh *c =to_clk_rpmh (hw); -return c->aggr_state * c->unit; +return (unsigned long )c->aggr_state * c->unit; }static const struct clk_ops clk_rpmh_bcm_ops = {
Greg Kroah-Hartman
maintainerPATCH 271/620 blk-cgroup: Fix class @block_classs subsystem refcount leakage
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit d1248436cbef1f924c04255367ff4845ccd9025e upstream.
blkcg_fill_root_iostats() iterates over @block_class's devices by class_dev_iter_(init|next)(), but does not end iterating with class_dev_iter_exit(), so causes the class's subsystem refcount leakage.
Fix by ending the iterating with class_dev_iter_exit().
--- block/blk-cgroup.c | 1 + 1 file changed, 1 insertion(+)
block/blk-cgroup.c +1 -0
@@ -894,6 +894,7 @@ static void blkcg_fill_root_iostats(voidblkg_iostat_set (&blkg->iostat.cur, &tmp);u64_stats_update_end_irqrestore (&blkg->iostat.sync, flags); } +class_dev_iter_exit (&iter); }static void blkcg_print_one_stat (struct blkcg_gq *blkg,struct seq_file *s)
Greg Kroah-Hartman
maintainerPATCH 272/620 efi: libstub: Use -std=gnu11 to fix build with GCC 15
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 8ba14d9f490aef9fd535c04e9e62e1169eb7a055 upstream.
GCC 15 changed the default C standard version to C23, which should not have impacted the kernel because it requests the gnu11 standard via '-std=' in the main Makefile. However, the EFI libstub Makefile uses its own set of KBUILD_CFLAGS for x86 without a '-std=' value (i.e., using the default), resulting in errors from the kernel's definitions of bool, true, and false in stddef.h, which are reserved keywords under C23.
./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
11 | false = 0,
./include/linux/types.h:35:33: error: two or more data types in declaration specifiers
35 | typedef _Bool bool;
Set '-std=gnu11' in the x86 cflags to resolve the error and consistently use the same C standard version for the entire kernel. All other architectures reuse KBUILD_CFLAGS from the rest of the kernel, so this issue is not visible for them.
--- drivers/firmware/efi/libstub/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/libstub/Makefile +1 -1
@@ -7,7 +7,7 @@ # cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small -cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \ +cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -std=gnu11 \ -fPIC -fno-strict-aliasing -mno-red-zone \ -mno-mmx -mno-sse -fshort-wchar \ -Wno-pointer-sign \
Greg Kroah-Hartman
maintainerPATCH 273/620 perf bench: Fix undefined behavior in cmpworker()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
commit 62892e77b8a64b9dc0e1da75980aa145347b6820 upstream.
The comparison function cmpworker() violates the C standard's requirements for qsort() comparison functions, which mandate symmetry and transitivity:
Symmetry: If x < y, then y > x.
Transitivity: If x < y and y < z, then x < z.
In its current implementation, cmpworker() incorrectly returns 0 when w1->tid < w2->tid, which breaks both symmetry and transitivity. This violation causes undefined behavior, potentially leading to issues such as memory corruption in glibc [1].
Fix the issue by returning -1 when w1->tid < w2->tid, ensuring compliance with the C standard and preventing undefined behavior.
--- tools/perf/bench/epoll-wait.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/bench/epoll-wait.c +6 -1
@@ -406,7 +406,12 @@ static int cmpworker(const void *p1, construct worker *w1 = (struct worker *) p1;struct worker *w2 = (struct worker *) p2; -return w1->tid > w2->tid; + +if (w1->tid > w2->tid) +return 1 ; +if (w1->tid < w2->tid) +return -1 ; +return 0 ; }int bench_epoll_wait (int argc,const char **argv)
Greg Kroah-Hartman
maintainerPATCH 274/620 of: Correct child specifier used as input of the 2nd nexus node
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit e4c00c9b1f70cd11792ff5b825899a6ee0234a62 upstream.
API of_parse_phandle_with_args_map() will use wrong input for nexus node Nexus_2 as shown below:
Node_1 Nexus_1 Nexus_2
&Nexus_1,arg_1 -> arg_1,&Nexus_2,arg_2' -> &Nexus_2,arg_2 -> arg_2,...
map-pass-thru=<...>
Nexus_1's output arg_2 should be used as input of Nexus_2, but the API wrongly uses arg_2' instead which != arg_2 due to Nexus_1's map-pass-thru.
Fix by always making @match_array point to @initial_match_array into which to store nexus output.
--- drivers/of/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/base.c +1 -1
@@ -1658,7 +1658,6 @@ int of_parse_phandle_with_args_map(const* specifier into the out_args structure, keeping the * bits specified in <list>-map-pass-thru. */ - match_array = map - new_size;for (i =0 ; i < new_size; i++) {__be32 val = *(map - new_size + i);
@@ -1667,6 +1666,7 @@ int of_parse_phandle_with_args_map(const val |=cpu_to_be32 (out_args->args[i]) & pass[i]; } + initial_match_array[i] = val; out_args->args[i] =be32_to_cpu (val); } out_args->args_count = list_size = new_size;
Greg Kroah-Hartman
maintainerPATCH 275/620 of: Fix of_find_node_opts_by_path() handling of alias+path+options
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit b9e58c934c56aa35b0fb436d9afd86ef326bae0e upstream.
of_find_node_opts_by_path() fails to find OF device node when its @path parameter have pattern below:
"alias-name/node-name-1/.../node-name-N:options".
The reason is that alias name length calculated by the API is wrong, as explained by example below:
"testcase-alias/phandle-tests/consumer-a:testaliasoption".
^ ^ ^ 0 14 39
The right length of alias 'testcase-alias' is 14, but the result worked out by the API is 39 which is obvious wrong.
Fix by using index of either '/' or ':' as the length who comes earlier.
--- drivers/of/base.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/of/base.c +3 -3
@@ -925,10 +925,10 @@ struct device_node *of_find_node_opts_by/* The path could begin with an alias */ if (*path !='/' ) {int len; -const char *p = separator; +const char *p =strchrnul (path,'/' ); -if (!p) - p =strchrnul (path,'/' ); +if (separator && separator < p) + p = separator; len = p - path;/* of_aliases must not be NULL */
Greg Kroah-Hartman
maintainerPATCH 276/620 of: reserved-memory: Fix using wrong number of cells to get property alignment
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 267b21d0bef8e67dbe6c591c9991444e58237ec9 upstream.
According to DT spec, size of property 'alignment' is based on parent node’s #size-cells property.
But __reserved_mem_alloc_size() wrongly uses @dt_root_addr_cells to get the property obviously.
Fix by using @dt_root_size_cells instead of @dt_root_addr_cells.
--- drivers/of/of_reserved_mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/of/of_reserved_mem.c +2 -2
@@ -105,12 +105,12 @@ static int __init __reserved_mem_alloc_s prop =of_get_flat_dt_prop (node,"alignment" , &len);if (prop) { -if (len != dt_root_addr_cells *sizeof (__be32)) { +if (len != dt_root_size_cells *sizeof (__be32)) {pr_err ("invalid alignment property in '%s' node.\n" , uname);return -EINVAL ; } - align =dt_mem_next_cell (dt_root_addr_cells, &prop); + align =dt_mem_next_cell (dt_root_size_cells, &prop); } nomap =of_get_flat_dt_prop (node,"no-map" ,NULL ) !=NULL ;
Greg Kroah-Hartman
maintainerPATCH 277/620 HID: hid-sensor-hub: dont use stale platform-data on remove
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
commit 8a5b38c3fd709e8acd2bfdedf66c25e6af759576 upstream.
The hid-sensor-hub creates the individual device structs and transfers them to the created mfd platform-devices via the platform_data in the mfd_cell.
Before e651a1da442a ("HID: hid-sensor-hub: Allow parallel synchronous reads") the sensor-hub was managing access centrally, with one "completion" in the hub's data structure, which needed to be finished on removal at the latest.
The mentioned commit then moved this central management to each hid sensor device, resulting on a completion in each struct hid_sensor_hub_device. The remove procedure was adapted to go through all sensor devices and finish any pending "completion".
What this didn't take into account was, platform_device_add_data() that is used by mfd_add{_hotplug}_devices() does a kmemdup on the submitted platform-data. So the data the platform-device gets is a copy of the original data, meaning that the device worked on a different completion than what sensor_hub_remove() currently wants to access.
To fix that, use device_for_each_child() to go through each child-device similar to how mfd_remove_devices() unregisters the devices later and with that get the live platform_data to finalize the correct completion.
--- drivers/hid/hid-sensor-hub.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/hid/hid-sensor-hub.c +14 -7
@@ -728,23 +728,30 @@ err_stop_hw:return ret; } +static int sensor_hub_finalize_pending_fn (struct device *dev,void *data) +{ +struct hid_sensor_hub_device *hsdev = dev->platform_data; + +if (hsdev->pending.status) +complete (&hsdev->pending.ready); + +return 0 ; +} +static void sensor_hub_remove (struct hid_device *hdev) {struct sensor_hub_data *data =hid_get_drvdata (hdev);unsigned long flags; -int i;hid_dbg (hdev," hardware removed\n" );hid_hw_close (hdev);hid_hw_stop (hdev); +spin_lock_irqsave (&data->lock, flags); -for (i =0 ; i < data->hid_sensor_client_cnt; ++i) { -struct hid_sensor_hub_device *hsdev = - data->hid_sensor_hub_client_devs[i].platform_data; -if (hsdev->pending.status) -complete (&hsdev->pending.ready); - } +device_for_each_child (&hdev->dev,NULL , + sensor_hub_finalize_pending_fn);spin_unlock_irqrestore (&data->lock, flags); +mfd_remove_devices (&hdev->dev);mutex_destroy (&data->mutex); }
Greg Kroah-Hartman
maintainerPATCH 278/620 wifi: rtlwifi: rtl8821ae: Fix media status report
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
commit 66ef0289ac99e155d206ddaa0fdfad09ae3cd007 upstream.
RTL8821AE is stuck transmitting at the lowest rate allowed by the rate mask. This is because the firmware doesn't know the device is connected to a network.
Fix the macros SET_H2CCMD_MSRRPT_PARM_OPMODE and SET_H2CCMD_MSRRPT_PARM_MACID_IND to work on the first byte of __cmd, not the second. Now the firmware is correctly notified when the device is connected to a network and it activates the rate control.
Before (MCS3):
[ 5] 0.00-1.00 sec 12.5 MBytes 105 Mbits/sec 0 339 KBytes [ 5] 1.00-2.00 sec 10.6 MBytes 89.1 Mbits/sec 0 339 KBytes [ 5] 2.00-3.00 sec 10.6 MBytes 89.1 Mbits/sec 0 386 KBytes [ 5] 3.00-4.00 sec 10.6 MBytes 89.1 Mbits/sec 0 386 KBytes [ 5] 4.00-5.00 sec 10.2 MBytes 86.0 Mbits/sec 0 427 KBytes
After (MCS9):
[ 5] 0.00-1.00 sec 33.9 MBytes 284 Mbits/sec 0 771 KBytes [ 5] 1.00-2.00 sec 31.6 MBytes 265 Mbits/sec 0 865 KBytes [ 5] 2.00-3.00 sec 29.9 MBytes 251 Mbits/sec 0 963 KBytes [ 5] 3.00-4.00 sec 28.2 MBytes 237 Mbits/sec 0 963 KBytes [ 5] 4.00-5.00 sec 26.8 MBytes 224 Mbits/sec 0 963 KBytes
--- drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h +2 -2
@@ -197,9 +197,9 @@ enum rtl8821a_h2c_cmd {/* _MEDIA_STATUS_RPT_PARM_CMD1 */ #define SET_H2CCMD_MSRRPT_PARM_OPMODE (__cmd, __value) \ - u8p_replace_bits(__cmd + 1, __value, BIT(0)) + u8p_replace_bits(__cmd, __value, BIT(0))#define SET_H2CCMD_MSRRPT_PARM_MACID_IND (__cmd, __value) \ - u8p_replace_bits(__cmd + 1, __value, BIT(1)) + u8p_replace_bits(__cmd, __value, BIT(1))/* AP_OFFLOAD */ #define SET_H2CCMD_AP_OFFLOAD_ON (__cmd, __value) \
Greg Kroah-Hartman
maintainerPATCH 279/620 wifi: brcmfmac: fix NULL pointer dereference in brcmf_txfinalize()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Hamer <[email protected]>
commit 68abd0c4ebf24cd499841a488b97a6873d5efabb upstream.
On removal of the device or unloading of the kernel module a potential NULL pointer dereference occurs.
The following sequence deletes the interface:
brcmf_detach()
brcmf_remove_interface()
brcmf_del_if()Inside the brcmf_del_if() function the drvr->if2bss[ifidx] is updated to BRCMF_BSSIDX_INVALID (-1) if the bsscfgidx matches.
After brcmf_remove_interface() call the brcmf_proto_detach() function is called providing the following sequence:
brcmf_detach()
brcmf_proto_detach()
brcmf_proto_msgbuf_detach()
brcmf_flowring_detach()
brcmf_msgbuf_delete_flowring()
brcmf_msgbuf_remove_flowring()
brcmf_flowring_delete()
brcmf_get_ifp()
brcmf_txfinalize()Since brcmf_get_ip() can and actually will return NULL in this case the call to brcmf_txfinalize() will result in a NULL pointer dereference inside brcmf_txfinalize() when trying to update ifp->ndev->stats.tx_errors.
This will only happen if a flowring still has an skb.
Although the NULL pointer dereference has only been seen when trying to update the tx statistic, all other uses of the ifp pointer have been guarded as well with an early return if ifp is NULL.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +5 -0
@@ -550,6 +550,11 @@ void brcmf_txfinalize(struct brcmf_if *istruct ethhdr *eh;u16 type; +if (!ifp) { +brcmu_pkt_buf_free_skb (txp); +return ; + } + eh = (struct ethhdr *)(txp->data); type =ntohs (eh->h_proto);
Greg Kroah-Hartman
maintainerPATCH 280/620 usb: gadget: f_tcm: Translate error to sense
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 98fa00fd3ae43b857b4976984a135483d89d9281 upstream.
When respond with check_condition error status, clear from_transport input so the target layer can translate the sense reason reported by f_tcm.
--- drivers/usb/gadget/function/f_tcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_tcm.c +2 -2
@@ -1065,7 +1065,7 @@ static void usbg_cmd_work(struct work_st out:transport_send_check_condition_and_sense (se_cmd, -TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); +TCM_UNSUPPORTED_SCSI_OPCODE ,0 ); } static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu,
@@ -1193,7 +1193,7 @@ static void bot_cmd_work(struct work_str out:transport_send_check_condition_and_sense (se_cmd, -TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); +TCM_UNSUPPORTED_SCSI_OPCODE ,0 ); } static int bot_submit_command(struct f_uas *fu,
Greg Kroah-Hartman
maintainerPATCH 281/620 usb: gadget: f_tcm: Decrement command ref count on cleanup
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 3b2a52e88ab0c9469eaadd4d4c8f57d072477820 upstream.
We submitted the command with TARGET_SCF_ACK_KREF, which requires acknowledgment of command completion. If the command fails, make sure to decrement the ref count.
--- drivers/usb/gadget/function/f_tcm.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/function/f_tcm.c +1 -0
@@ -973,6 +973,7 @@ static void usbg_data_write_cmpl(structreturn ; cleanup: +target_put_sess_cmd (se_cmd);transport_generic_free_cmd (&cmd->se_cmd,0 ); }
Greg Kroah-Hartman
maintainerPATCH 282/620 usb: gadget: f_tcm: ep_autoconfig with fullspeed endpoint
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 25224c1f07d31c261d04dfbc705a7a0f314a825d upstream.
Match usb endpoint using fullspeed endpoint descriptor to make sure the wMaxPacketSize for fullspeed descriptors is automatically configured.
--- drivers/usb/gadget/function/f_tcm.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
drivers/usb/gadget/function/f_tcm.c +13 -17
@@ -2017,43 +2017,39 @@ static int tcm_bind(struct usb_configura bot_intf_desc.bInterfaceNumber = iface; uasp_intf_desc.bInterfaceNumber = iface; fu->iface = iface; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_bi_desc, - &uasp_bi_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_bi_desc);if (!ep) goto ep_fail; fu->ep_in = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_bo_desc, - &uasp_bo_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_bo_desc);if (!ep) goto ep_fail; fu->ep_out = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_status_desc, - &uasp_status_in_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_status_desc);if (!ep) goto ep_fail; fu->ep_status = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_cmd_desc, - &uasp_cmd_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_cmd_desc);if (!ep) goto ep_fail; fu->ep_cmd = ep;/* Assume endpoint addresses are the same for both speeds */ - uasp_bi_desc.bEndpointAddress = uasp_ss_bi_desc.bEndpointAddress; - uasp_bo_desc.bEndpointAddress = uasp_ss_bo_desc.bEndpointAddress; + uasp_bi_desc.bEndpointAddress = uasp_fs_bi_desc.bEndpointAddress; + uasp_bo_desc.bEndpointAddress = uasp_fs_bo_desc.bEndpointAddress; uasp_status_desc.bEndpointAddress = - uasp_ss_status_desc.bEndpointAddress; - uasp_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; + uasp_fs_status_desc.bEndpointAddress; + uasp_cmd_desc.bEndpointAddress = uasp_fs_cmd_desc.bEndpointAddress; - uasp_fs_bi_desc.bEndpointAddress = uasp_ss_bi_desc.bEndpointAddress; - uasp_fs_bo_desc.bEndpointAddress = uasp_ss_bo_desc.bEndpointAddress; - uasp_fs_status_desc.bEndpointAddress = - uasp_ss_status_desc.bEndpointAddress; - uasp_fs_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; + uasp_ss_bi_desc.bEndpointAddress = uasp_fs_bi_desc.bEndpointAddress; + uasp_ss_bo_desc.bEndpointAddress = uasp_fs_bo_desc.bEndpointAddress; + uasp_ss_status_desc.bEndpointAddress = + uasp_fs_status_desc.bEndpointAddress; + uasp_ss_cmd_desc.bEndpointAddress = uasp_fs_cmd_desc.bEndpointAddress; ret = usb_assign_descriptors(f, uasp_fs_function_desc, uasp_hs_function_desc, uasp_ss_function_desc,
Greg Kroah-Hartman
maintainerPATCH 283/620 usb: gadget: f_tcm: Dont prepare BOT write request twice
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 94d9bf671ae314cacc2d7bf96bd233b4abc7cede upstream.
The duplicate kmalloc here is causing memory leak. The request preparation in bot_send_write_request is also done in usbg_prepare_w_request. Remove the duplicate work.
--- drivers/usb/gadget/function/f_tcm.c | 17 ----------------- 1 file changed, 17 deletions(-)
drivers/usb/gadget/function/f_tcm.c +0 -17
@@ -245,7 +245,6 @@ static int bot_send_write_request(struct {struct f_uas *fu = cmd->fu;struct se_cmd *se_cmd = &cmd->se_cmd; -struct usb_gadget *gadget =fuas_to_gadget (fu);int ret;init_completion (&cmd->write_complete);
@@ -256,22 +255,6 @@ static int bot_send_write_request(structreturn -EINVAL ; } -if (!gadget->sg_supported) { - cmd->data_buf =kmalloc (se_cmd->data_length,GFP_KERNEL ); -if (!cmd->data_buf) -return -ENOMEM ; - - fu->bot_req_out->buf = cmd->data_buf; - }else { - fu->bot_req_out->buf =NULL ; - fu->bot_req_out->num_sgs = se_cmd->t_data_nents; - fu->bot_req_out->sg = se_cmd->t_data_sg; - } - - fu->bot_req_out->complete = usbg_data_write_cmpl; - fu->bot_req_out->length = se_cmd->data_length; - fu->bot_req_out->context = cmd; - ret =usbg_prepare_w_request (cmd, fu->bot_req_out);if (ret) goto cleanup;
Greg Kroah-Hartman
maintainerPATCH 284/620 soc: qcom: socinfo: Avoid out of bounds read of serial number
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 22cf4fae6660b6e1a583a41cbf84e3046ca9ccd0 upstream.
On MSM8916 devices, the serial number exposed in sysfs is constant and does not change across individual devices. It's always:
db410c:/sys/devices/soc0$ cat serial_number 2644893864
The firmware used on MSM8916 exposes SOCINFO_VERSION(0, 8), which does not have support for the serial_num field in the socinfo struct. There is an existing check to avoid exposing the serial number in that case, but it's not correct: When checking the item_size returned by SMEM, we need to make sure the *end* of the serial_num is within bounds, instead of comparing with the *start* offset. The serial_number currently exposed on MSM8916 devices is just an out of bounds read of whatever comes after the socinfo struct in SMEM.
Fix this by changing offsetof() to offsetofend(), so that the size of the field is also taken into account.
--- drivers/soc/qcom/socinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/socinfo.c +1 -1
@@ -617,7 +617,7 @@ static int qcom_socinfo_probe(struct plaif (!qs->attr.soc_id || !qs->attr.revision)return -ENOMEM ; -if (offsetof(struct socinfo , serial_num) <= item_size) { + if (offsetofend(struct socinfo, serial_num) <= item_size) { qs->attr.serial_number =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%u" ,le32_to_cpu (info->serial_num));
Greg Kroah-Hartman
maintainerPATCH 285/620 serial: sh-sci: Drop __initdata macro for port_cfg
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit eaeee4225dba30bef4d424bdf134a07b7f423e8b upstream.
The port_cfg object is used by serial_console_write(), which serves as the write function for the earlycon device. Marking port_cfg as __initdata causes it to be freed after kernel initialization, resulting in earlycon becoming unavailable thereafter. Remove the __initdata macro from port_cfg to resolve this issue.
--- drivers/tty/serial/sh-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sh-sci.c +1 -1
@@ -3431,7 +3431,7 @@ sh_early_platform_init_buffer("earlyprin early_serial_buf, ARRAY_SIZE(early_serial_buf));#endif #ifdef CONFIG_SERIAL_SH_SCI_EARLYCON -static struct plat_sci_port port_cfg__initdata ; +static struct plat_sci_port port_cfg;static int __init early_console_setup (struct earlycon_device *device,int type)
Greg Kroah-Hartman
maintainerPATCH 286/620 serial: sh-sci: Do not probe the serial port if its slot in sci_ports[] is in use
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 9f7dea875cc7f9c1a56a5c688290634a59cd1420 upstream.
In the sh-sci driver, sci_ports[0] is used by earlycon. If the earlycon is still active when sci_probe() is called and the new serial port is supposed to map to sci_ports[0], return -EBUSY to prevent breaking the earlycon.
This situation should occurs in debug scenarios, and users should be aware of the potential conflict.
--- drivers/tty/serial/sh-sci.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/tty/serial/sh-sci.c +23 -0
@@ -164,6 +164,7 @@ struct sci_port {static struct sci_port sci_ports[SCI_NPORTS ];static unsigned long sci_ports_in_use;static struct uart_driver sci_uart_driver; +static bool sci_uart_earlycon;static inline struct sci_port *to_sci_port (struct uart_port *uart)
@@ -3319,6 +3320,7 @@ static int sci_probe_single(struct platfstatic int sci_probe (struct platform_device *dev) {struct plat_sci_port *p; +struct resource *res;struct sci_port *sp;unsigned int dev_id;int ret;
@@ -3348,6 +3350,26 @@ static int sci_probe(struct platform_dev } sp = &sci_ports[dev_id]; + +/* +* In case: +* - the probed port alias is zero (as the one used by earlycon), and +* - the earlycon is still active (e.g., "earlycon keep_bootcon" in +* bootargs) +* +* defer the probe of this serial. This is a debug scenario and the user +* must be aware of it. +* +* Except when the probed port is the same as the earlycon port. +*/ + + res =platform_get_resource (dev,IORESOURCE_MEM ,0 ); +if (!res) +return -ENODEV ; + +if (sci_uart_earlycon && sp == &sci_ports[0 ] && sp->port.mapbase != res->start) +return dev_err_probe (&dev->dev, -EBUSY ,"sci_port[0] is used by earlycon!\n" ); +platform_set_drvdata (dev, sp); ret =sci_probe_single (dev, dev_id, p, sp);
@@ -3446,6 +3468,7 @@ static int __init early_console_setup(st port_cfg.type = type; sci_ports[0 ].cfg = &port_cfg; sci_ports[0 ].params =sci_probe_regmap (&port_cfg); + sci_uart_earlycon = true; port_cfg.scscr =sci_serial_in (&sci_ports[0 ].port,SCSCR );sci_serial_out (&sci_ports[0 ].port,SCSCR ,SCSCR_RE |SCSCR_TE | port_cfg.scscr);
Greg Kroah-Hartman
maintainerPATCH 287/620 MIPS: Loongson64: remove ROM Size unit in boardinfo
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kexy Biscuit <[email protected]>
commit bd2212d658d7659b9d83c7e2f3a06789d4db1e90 upstream.
Per Appendix A.7 in Q/LS 0013-2014 (龙芯CPU开发系统固件与内核接口规范 V2.2, lit. Loongson DevSys Firmware Kernel Interface Specification V2.2), interface_info.size is size of this interface, not size of the LEFI BIOS ROM.
In any case, the BIOS ROM Size just cannot be several kilobytes (KB) on Loongson64 LEFI platforms.
--- arch/mips/loongson64/boardinfo.c | 2 -- 1 file changed, 2 deletions(-)
arch/mips/loongson64/boardinfo.c +0 -2
@@ -21,13 +21,11 @@ static ssize_t boardinfo_show(struct kob"BIOS Info\n" "Vendor\t\t\t: %s\n" "Version\t\t\t: %s\n" -"ROM Size\t\t: %d KB\n" "Release Date\t\t: %s\n" ,strsep (&tmp_board_manufacturer,"-" ), eboard->name,strsep (&tmp_bios_vendor,"-" ), einter->description, - einter->size, especial->special_name); } static struct kobj_attribute boardinfo_attr = __ATTR(boardinfo, 0444,
Greg Kroah-Hartman
maintainerPATCH 288/620 powerpc/pseries/eeh: Fix get PE state translation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Narayana Murty N <[email protected]>
commit 11b93559000c686ad7e5ab0547e76f21cc143844 upstream.
The PE Reset State "0" returned by RTAS calls "ibm_read_slot_reset_[state|state2]" indicates that the reset is deactivated and the PE is in a state where MMIO and DMA are allowed. However, the current implementation of "pseries_eeh_get_state()" does not reflect this, causing drivers to incorrectly assume that MMIO and DMA operations cannot be resumed.
The userspace drivers as a part of EEH recovery using VFIO ioctls fail to detect when the recovery process is complete. The VFIO_EEH_PE_GET_STATE ioctl does not report the expected EEH_PE_STATE_NORMAL state, preventing userspace drivers from functioning properly on pseries systems.
The patch addresses this issue by updating 'pseries_eeh_get_state()' to include "EEH_STATE_MMIO_ENABLED" and "EEH_STATE_DMA_ENABLED" in the result mask for PE Reset State "0". This ensures correct state reporting to the callers, aligning the behavior with the PAPR specification and fixing the bug in EEH recovery for VFIO user workflows.
--- arch/powerpc/platforms/pseries/eeh_pseries.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/eeh_pseries.c +4 -2
@@ -578,8 +578,10 @@ static int pseries_eeh_get_state(structswitch (rets[0 ]) {case 0 : - result =EEH_STATE_MMIO_ACTIVE | -EEH_STATE_DMA_ACTIVE ; + result =EEH_STATE_MMIO_ACTIVE | +EEH_STATE_DMA_ACTIVE | +EEH_STATE_MMIO_ENABLED | +EEH_STATE_DMA_ENABLED ;break ;case 1 : result = EEH_STATE_RESET_ACTIVE |
Greg Kroah-Hartman
maintainerPATCH 289/620 dm-crypt: dont update io->sector after kcryptd_crypt_write_io_submit()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
commit 9fdbbdbbc92b1474a87b89f8b964892a63734492 upstream.
The updates of io->sector are the leftovers when dm-crypt allocated pages for partial write request. However, since commit cf2f1abfbd0db ("dm crypt: don't allocate pages for a partial request"), there is no partial request anymore.
After the introduction of write request rb-tree, the updates of io->sectors may interfere the insertion procedure, because ->sectors of these write requests which have already been added in the rb-tree may be changed during the insertion of new write request.
Fix it by removing these buggy updates of io->sectors. Considering these updates only effect the write request rb-tree, the commit which introduces the write request rb-tree is used as the fix tag.
--- drivers/md/dm-crypt.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/md/dm-crypt.c +3 -11
@@ -1993,7 +1993,6 @@ static void kcryptd_crypt_write_continuestruct crypt_config *cc = io->cc;struct convert_context *ctx = &io->ctx;int crypt_finished; -sector_t sector = io->sector;blk_status_t r;wait_for_completion (&ctx->restart);
@@ -2010,10 +2009,8 @@ static void kcryptd_crypt_write_continue }/* Encryption was already finished, submit io now */ -if (crypt_finished) { +if (crypt_finished)kcryptd_crypt_write_io_submit (io,0 ); - io->sector = sector; - }crypt_dec_pending (io); }
@@ -2024,14 +2021,13 @@ static void kcryptd_crypt_write_convert(struct convert_context *ctx = &io->ctx;struct bio *clone;int crypt_finished; -sector_t sector = io->sector;blk_status_t r;/* * Prevent io from disappearing until this function completes. */ crypt_inc_pending (io); -crypt_convert_init (cc, ctx,NULL , io->base_bio, sector); +crypt_convert_init (cc, ctx,NULL , io->base_bio, io->sector); clone =crypt_alloc_buffer (io, io->base_bio->bi_iter.bi_size);if (unlikely (!clone)) {
@@ -2048,8 +2044,6 @@ static void kcryptd_crypt_write_convert( io->ctx.iter_in = clone->bi_iter; } - sector +=bio_sectors (clone); -crypt_inc_pending (io); r =crypt_convert (cc, ctx,test_bit (DM_CRYPT_NO_WRITE_WORKQUEUE , &cc->flags), true);
@@ -2073,10 +2067,8 @@ static void kcryptd_crypt_write_convert( }/* Encryption was already finished, submit io now */ -if (crypt_finished) { +if (crypt_finished)kcryptd_crypt_write_io_submit (io,0 ); - io->sector = sector; - } dec:crypt_dec_pending (io);
Greg Kroah-Hartman
maintainerPATCH 290/620 dm-crypt: track tag_offset in convert_context
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
commit 8b8f8037765757861f899ed3a2bfb34525b5c065 upstream.
dm-crypt uses tag_offset to index the integrity metadata for each crypt sector. When the initial crypt_convert() returns BLK_STS_DEV_RESOURCE, dm-crypt will try to continue the crypt/decrypt procedure in a kworker. However, it resets tag_offset as zero instead of using the tag_offset related with current sector. It may return unexpected data when using random IV or return unexpected integrity related error.
Fix the problem by tracking tag_offset in per-IO convert_context. Therefore, when the crypt/decrypt procedure continues in a kworker, it could use the next tag_offset saved in convert_context.
--- drivers/md/dm-crypt.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/md/dm-crypt.c +7 -6
@@ -53,6 +53,7 @@ struct convert_context {struct bio *bio_out;struct bvec_iter iter_out;atomic_t cc_pending; +unsigned int tag_offset;u64 cc_sector;union {struct skcipher_request *req;
@@ -1217,6 +1218,7 @@ static void crypt_convert_init(struct crif (bio_out) ctx->iter_out = bio_out->bi_iter; ctx->cc_sector = sector + cc->iv_offset; + ctx->tag_offset =0 ;init_completion (&ctx->restart); }
@@ -1542,7 +1544,6 @@ static void crypt_free_req(struct crypt_static blk_status_t crypt_convert (struct crypt_config *cc,struct convert_context *ctx,bool atomic,bool reset_pending) { -unsigned int tag_offset =0 ;unsigned int sector_step = cc->sector_size >>SECTOR_SHIFT ;int r;
@@ -1565,9 +1566,9 @@ static blk_status_t crypt_convert(structatomic_inc (&ctx->cc_pending);if (crypt_integrity_aead (cc)) - r =crypt_convert_block_aead (cc, ctx, ctx->r.req_aead, tag_offset); + r =crypt_convert_block_aead (cc, ctx, ctx->r.req_aead, ctx->tag_offset);else - r =crypt_convert_block_skcipher (cc, ctx, ctx->r.req, tag_offset); + r =crypt_convert_block_skcipher (cc, ctx, ctx->r.req, ctx->tag_offset);switch (r) {/*
@@ -1587,8 +1588,8 @@ static blk_status_t crypt_convert(struct* exit and continue processing in a workqueue */ ctx->r.req =NULL ; + ctx->tag_offset++; ctx->cc_sector += sector_step; - tag_offset++;return BLK_STS_DEV_RESOURCE ; } }else {
@@ -1602,8 +1603,8 @@ static blk_status_t crypt_convert(struct*/ case -EINPROGRESS : ctx->r.req =NULL ; + ctx->tag_offset++; ctx->cc_sector += sector_step; - tag_offset++;continue ;/* * The request was already processed (synchronously).
@@ -1611,7 +1612,7 @@ static blk_status_t crypt_convert(structcase 0 :atomic_dec (&ctx->cc_pending); ctx->cc_sector += sector_step; - tag_offset++; + ctx->tag_offset++;if (!atomic)cond_resched ();continue ;
Greg Kroah-Hartman
maintainerPATCH 291/620 mips/math-emu: fix emulation of the prefx instruction
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mateusz Jończyk <[email protected]>
commit 42a39e4aa59a10aa4afdc14194f3ee63d2db94e1 upstream.
Currently, installation of Debian 12.8 for mipsel fails on machines without an FPU [1]. This is caused by the fact that zstd (which is used for initramfs compression) executes the prefx instruction, which is not emulated properly by the kernel.
The prefx (Prefetch Indexed) instruction fetches data from memory into the cache without any side effects. Though functionally unrelated, it requires an FPU [2].
Bytecode format of this instruction ends on "001111" binary:
(prefx instruction format) & 0x0000003f = 0x0000000f
The code in fpux_emu() runs like so:
#define MIPSInst(x) x
#define MIPSInst_FMA_FFMT(x) (MIPSInst(x) & 0x00000007)
#define MIPSInst_FUNC(x) (MIPSInst(x) & 0x0000003f)
enum cop1x_func { ..., pfetch_op = 0x0f, ... };
...
switch (MIPSInst_FMA_FFMT(ir)) {
...
case 0x3:
if (MIPSInst_FUNC(ir) != pfetch_op)
return SIGILL;
/* ignore prefx operation */
break;
default:
return SIGILL;
}That snippet above contains a logic error and the
if (MIPSInst_FUNC(ir) != pfetch_op)
comparison always fires.
When MIPSInst_FUNC(ir) is equal to pfetch_op, ir must end on 001111 binary. In this case, MIPSInst_FMA_FFMT(ir) must be equal to 0x7, which does not match that case label.
This causes emulation failure for the prefx instruction. Fix it.
This has been broken by
commit 919af8b96c89 ("MIPS: Make definitions of MIPSInst_FMA_{FUNC,FMTM} consistent with MIPS64 manual") which modified the MIPSInst_FMA_FFMT macro without updating the users.
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1091858
[2] MIPS Architecture For Programmers Volume II-A: The MIPS32 Instruction Set
--- arch/mips/math-emu/cp1emu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/math-emu/cp1emu.c +1 -1
@@ -1660,7 +1660,7 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,break ; } -case 0x3 : +case 0x7 :if (MIPSInst_FUNC (ir) != pfetch_op)return SIGILL ;
Signature · 1 line
2.48.1
Greg Kroah-Hartman
maintainerPATCH 292/620 Revert "media: uvcvideo: Require entities to have a non-zero unique ID"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit 8004d635f27bbccaa5c083c50d4d5302a6ffa00e upstream.
This reverts commit 3dd075fe8ebbc6fcbf998f81a75b8c4b159a6195.
Tomasz has reported that his device, Generalplus Technology Inc. 808 Camera, with ID 1b3f:2002, stopped being detected:
$ ls -l /dev/video* zsh: no matches found: /dev/video* [ 7.230599] usb 3-2: Found multiple Units with ID 5
This particular device is non-compliant, having both the Output Terminal and Processing Unit with ID 5. uvc_scan_fallback, though, is able to build a chain. However, when media elements are added and uvc_mc_create_links call uvc_entity_by_id, it will get the incorrect entity, media_create_pad_link will WARN, and it will fail to register the entities.
In order to reinstate support for such devices in a timely fashion, reverting the fix for these warnings is appropriate. A proper fix that considers the existence of such non-compliant devices will be submitted in a later development cycle.
--- drivers/media/usb/uvc/uvc_driver.c | 70 ++++++++++++++----------------------- 1 file changed, 27 insertions(+), 43 deletions(-)
drivers/media/usb/uvc/uvc_driver.c +27 -43
@@ -1026,27 +1026,14 @@ static const u8 uvc_media_transport_inpuUVC_GUID_UVC_MEDIA_TRANSPORT_INPUT ;static const u8 uvc_processing_guid[16 ] =UVC_GUID_UVC_PROCESSING ; -static struct uvc_entity *uvc_alloc_new_entity (struct uvc_device *dev,u16 type, -u16 id,unsigned int num_pads, -unsigned int extra_size) +static struct uvc_entity *uvc_alloc_entity (u16 type,u16 id, +unsigned int num_pads,unsigned int extra_size) {struct uvc_entity *entity;unsigned int num_inputs;unsigned int size;unsigned int i; -/* Per UVC 1.1+ spec 3.7.2, the ID should be non-zero. */ -if (id ==0 ) { -dev_err (&dev->udev->dev,"Found Unit with invalid ID 0.\n" ); -return ERR_PTR (-EINVAL ); - } - -/* Per UVC 1.1+ spec 3.7.2, the ID is unique. */ -if (uvc_entity_by_id (dev, id)) { -dev_err (&dev->udev->dev,"Found multiple Units with ID %u\n" , id); -return ERR_PTR (-EINVAL ); - } - extra_size =roundup (extra_size,sizeof (*entity->pads));if (num_pads) num_inputs = type &UVC_TERM_OUTPUT ? num_pads : num_pads -1 ;
@@ -1056,7 +1043,7 @@ static struct uvc_entity *uvc_alloc_new_ + num_inputs; entity =kzalloc (size,GFP_KERNEL );if (entity ==NULL ) -return ERR_PTR (-ENOMEM ); +return NULL ; entity->id = id; entity->type = type;
@@ -1146,10 +1133,10 @@ static int uvc_parse_vendor_control(strubreak ; } - unit =uvc_alloc_new_entity (dev,UVC_VC_EXTENSION_UNIT , - buffer[3 ], p +1 ,2 * n); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (UVC_VC_EXTENSION_UNIT , buffer[3 ], + p +1 ,2 *n); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->guid, &buffer[4 ],16 ); unit->extension.bNumControls = buffer[20 ];
@@ -1259,10 +1246,10 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - term =uvc_alloc_new_entity (dev, type |UVC_TERM_INPUT , - buffer[3 ],1 , n + p); -if (IS_ERR (term)) -return PTR_ERR (term); + term =uvc_alloc_entity (type |UVC_TERM_INPUT , buffer[3 ], +1 , n + p); +if (term ==NULL ) +return -ENOMEM ;if (UVC_ENTITY_TYPE (term) ==UVC_ITT_CAMERA ) { term->camera.bControlSize = n;
@@ -1318,10 +1305,10 @@ static int uvc_parse_standard_control(streturn 0 ; } - term =uvc_alloc_new_entity (dev, type |UVC_TERM_OUTPUT , - buffer[3 ],1 ,0 ); -if (IS_ERR (term)) -return PTR_ERR (term); + term =uvc_alloc_entity (type |UVC_TERM_OUTPUT , buffer[3 ], +1 ,0 ); +if (term ==NULL ) +return -ENOMEM ;memcpy (term->baSourceID, &buffer[7 ],1 );
@@ -1342,10 +1329,9 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ], - p +1 ,0 ); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (buffer[2 ], buffer[3 ], p +1 ,0 ); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->baSourceID, &buffer[5 ], p);
@@ -1367,9 +1353,9 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ],2 , n); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (buffer[2 ], buffer[3 ],2 , n); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->baSourceID, &buffer[4 ],1 ); unit->processing.wMaxMultiplier =
@@ -1398,10 +1384,9 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ], - p +1 , n); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (buffer[2 ], buffer[3 ], p +1 , n); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->guid, &buffer[4 ],16 ); unit->extension.bNumControls = buffer[20 ];
@@ -1543,10 +1528,9 @@ static int uvc_gpio_parse(struct uvc_devreturn irq; } - unit =uvc_alloc_new_entity (dev,UVC_EXT_GPIO_UNIT , -UVC_EXT_GPIO_UNIT_ID ,0 ,1 ); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (UVC_EXT_GPIO_UNIT ,UVC_EXT_GPIO_UNIT_ID ,0 ,1 ); +if (!unit) +return -ENOMEM ; unit->gpio.gpio_privacy = gpio_privacy; unit->gpio.irq = irq;
Greg Kroah-Hartman
maintainerPATCH 293/620 ALSA: hda/realtek: Enable headset mic on Positivo C6400
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edson Juliano Drosdeck <[email protected]>
commit 1aec3ed2e3e1512aba15e7e790196a44efd5f0a7 upstream.
Positivo C6400 is equipped with ALC269VB, and it needs ALC269VB_FIXUP_ASUS_ZENBOOK quirk to make its headset mic work. Also must to limits the microphone boost.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9517,6 +9517,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x17aa ,0x511f ,"Thinkpad" ,ALC298_FIXUP_TPT470_DOCK ),SND_PCI_QUIRK (0x17aa ,0x9e54 ,"LENOVO NB" ,ALC269_FIXUP_LENOVO_EAPD ),SND_PCI_QUIRK (0x17aa ,0x9e56 ,"Lenovo ZhaoYang CF4620Z" ,ALC286_FIXUP_SONY_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1849 ,0x0269 ,"Positivo Master C6400" ,ALC269VB_FIXUP_ASUS_ZENBOOK ),SND_PCI_QUIRK (0x1849 ,0x1233 ,"ASRock NUC Box 1100" ,ALC233_FIXUP_NO_AUDIO_JACK ),SND_PCI_QUIRK (0x1849 ,0xa233 ,"Positivo Master C6300" ,ALC269_FIXUP_HEADSET_MIC ), SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Greg Kroah-Hartman
maintainerPATCH 294/620 PCI: endpoint: Finish virtual EP removal in pci_epf_remove_vepf()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 3b9f942eb21c92041905e3943a8d5177c9a9d89d upstream.
When removing a virtual Endpoint, pci_epf_remove_vepf() failed to clear epf_vf->epf_pf, which caused a subsequent pci_epf_add_vepf() to incorrectly return -EBUSY:
pci_epf_add_vepf(epf_pf, epf_vf) // add pci_epf_remove_vepf(epf_pf, epf_vf) // remove pci_epf_add_vepf(epf_pf, epf_vf) // add again, -EBUSY error
Fix by clearing epf_vf->epf_pf in pci_epf_remove_vepf().
--- drivers/pci/endpoint/pci-epf-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/endpoint/pci-epf-core.c +1 -0
@@ -234,6 +234,7 @@ void pci_epf_remove_vepf(struct pci_epfmutex_lock (&epf_pf->lock);clear_bit (epf_vf->vfunc_no, &epf_pf->vfunction_num_map); + epf_vf->epf_pf =NULL ;list_del (&epf_vf->list);mutex_unlock (&epf_pf->lock); }
Greg Kroah-Hartman
maintainerPATCH 295/620 nvme-pci: Add TUXEDO InfinityFlex to Samsung sleep quirk
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Georg Gottleuber <[email protected]>
commit dbf2bb1a1319b7c7d8828905378a6696cca6b0f2 upstream.
On the TUXEDO InfinityFlex, a Samsung 990 Evo NVMe leads to a high power consumption in s2idle sleep (4 watts).
This patch applies 'Force No Simple Suspend' quirk to achieve a sleep with a lower power consumption, typically around 1.4 watts.
--- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +2 -1
@@ -2975,7 +2975,8 @@ static unsigned long check_vendor_combin* because of high power consumption (> 2 Watt) in s2idle * sleep. Only some boards with Intel CPU are affected. */ -if (dmi_match (DMI_BOARD_NAME ,"GMxPXxx" ) || +if (dmi_match (DMI_BOARD_NAME ,"DN50Z-140HC-YD" ) || +dmi_match (DMI_BOARD_NAME ,"GMxPXxx" ) ||dmi_match (DMI_BOARD_NAME ,"PH4PG31" ) ||dmi_match (DMI_BOARD_NAME ,"PH4PRX1_PH6PRX1" ) ||dmi_match (DMI_BOARD_NAME ,"PH6PG01_PH6PG71" ))
Greg Kroah-Hartman
maintainerPATCH 296/620 nvme-pci: Add TUXEDO IBP Gen9 to Samsung sleep quirk
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Georg Gottleuber <[email protected]>
commit 11cb3529d18514f7d28ad2190533192aedefd761 upstream.
On the TUXEDO InfinityBook Pro Gen9 Intel, a Samsung 990 Evo NVMe leads to a high power consumption in s2idle sleep (4 watts).
This patch applies 'Force No Simple Suspend' quirk to achieve a sleep with a lower power consumption, typically around 1.2 watts.
--- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/pci.c +1 -0
@@ -2977,6 +2977,7 @@ static unsigned long check_vendor_combin*/ if (dmi_match (DMI_BOARD_NAME ,"DN50Z-140HC-YD" ) ||dmi_match (DMI_BOARD_NAME ,"GMxPXxx" ) || +dmi_match (DMI_BOARD_NAME ,"GXxMRXx" ) ||dmi_match (DMI_BOARD_NAME ,"PH4PG31" ) ||dmi_match (DMI_BOARD_NAME ,"PH4PRX1_PH6PRX1" ) ||dmi_match (DMI_BOARD_NAME ,"PH6PG01_PH6PG71" ))
Greg Kroah-Hartman
maintainerPATCH 297/620 scsi: qla2xxx: Move FCE Trace buffer allocation to user control
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 841df27d619ee1f5ca6473e15227b39d6136562d upstream.
Currently FCE Tracing is enabled to log additional ELS events. Instead, user will enable or disable this feature through debugfs.
Modify existing DFS knob to allow user to enable or disable this feature.
echo [1 | 0] > /sys/kernel/debug/qla2xxx/qla2xxx_??/fce cat /sys/kernel/debug/qla2xxx/qla2xxx_??/fce
--- drivers/scsi/qla2xxx/qla_def.h | 2 drivers/scsi/qla2xxx/qla_dfs.c | 124 ++++++++++++++++++++++++++++++++-------- drivers/scsi/qla2xxx/qla_gbl.h | 3 drivers/scsi/qla2xxx/qla_init.c | 28 ++++++--- 4 files changed, 126 insertions(+), 31 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +2 -0
@@ -4029,6 +4029,8 @@ struct qla_hw_data { uint32_t npiv_supported :1; uint32_t pci_channel_io_perm_failure :1; uint32_t fce_enabled :1; + uint32_t user_enabled_fce :1; + uint32_t fce_dump_buf_alloced :1; uint32_t fac_supported :1; uint32_t chip_reset_done :1;
drivers/scsi/qla2xxx/qla_dfs.c +102 -22
155 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_gbl.h +3 -0
@@ -11,6 +11,9 @@/* * Global Function Prototypes in qla_init.c source file. */ +int qla2x00_alloc_fce_trace (scsi_qla_host_t *); +void qla2x00_free_fce_trace (struct qla_hw_data *ha); +void qla_enable_fce_trace (scsi_qla_host_t *);extern int qla2x00_initialize_adapter (scsi_qla_host_t *);extern int qla24xx_post_prli_work (struct scsi_qla_host *vha,fc_port_t *fcport);
drivers/scsi/qla2xxx/qla_init.c +19 -9
@@ -2683,7 +2683,7 @@ exit:return rval; } -static void qla_enable_fce_trace (scsi_qla_host_t *vha) +void qla_enable_fce_trace (scsi_qla_host_t *vha) {int rval;struct qla_hw_data *ha = vha->hw;
@@ -3719,25 +3719,24 @@ qla24xx_chip_diag(scsi_qla_host_t *vha)return rval; } -static void -qla2x00_alloc_fce_trace (scsi_qla_host_t *vha) +int qla2x00_alloc_fce_trace (scsi_qla_host_t *vha) {dma_addr_t tc_dma;void *tc;struct qla_hw_data *ha = vha->hw;if (!IS_FWI2_CAPABLE (ha)) -return ; +return -EINVAL ;if (!IS_QLA25XX (ha) && !IS_QLA81XX (ha) && !IS_QLA83XX (ha) && !IS_QLA27XX (ha) && !IS_QLA28XX (ha)) -return ; +return -EINVAL ;if (ha->fce) {ql_dbg (ql_dbg_init, vha,0x00bd ,"%s: FCE Mem is already allocated.\n" , __func__); -return ; +return -EIO ; }/* Allocate memory for Fibre Channel Event Buffer. */
@@ -3747,7 +3746,7 @@ qla2x00_alloc_fce_trace(scsi_qla_host_tql_log (ql_log_warn, vha,0x00be ,"Unable to allocate (%d KB) for FCE.\n" ,FCE_SIZE /1024 ); -return ; +return -ENOMEM ; } ql_dbg(ql_dbg_init, vha, 0x00c0,
@@ -3756,6 +3755,16 @@ qla2x00_alloc_fce_trace(scsi_qla_host_t ha->fce_dma = tc_dma; ha->fce = tc; ha->fce_bufs =FCE_NUM_BUFFERS ; +return 0 ; +} + +void qla2x00_free_fce_trace (struct qla_hw_data *ha) +{ +if (!ha->fce) +return ; +dma_free_coherent (&ha->pdev->dev,FCE_SIZE , ha->fce, ha->fce_dma); + ha->fce =NULL ; + ha->fce_dma =0 ; } static void
@@ -3846,9 +3855,10 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vif (ha->tgt.atio_ring) mq_size += ha->tgt.atio_q_length *sizeof (request_t); -qla2x00_alloc_fce_trace (vha); -if (ha->fce) +if (ha->fce) { fce_size =sizeof (struct qla2xxx_fce_chain ) +FCE_SIZE ; + ha->flags.fce_dump_buf_alloced =1 ; + }qla2x00_alloc_eft_trace (vha);if (ha->eft) eft_size =EFT_SIZE ;
Greg Kroah-Hartman
maintainerPATCH 298/620 scsi: storvsc: Set correct data length for sending SCSI command without payload
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
commit 87c4b5e8a6b65189abd9ea5010ab308941f964a4 upstream.
In StorVSC, payload->range.len is used to indicate if this SCSI command carries payload. This data is allocated as part of the private driver data by the upper layer and may get passed to lower driver uninitialized.
For example, the SCSI error handling mid layer may send TEST_UNIT_READY or REQUEST_SENSE while reusing the buffer from a failed command. The private data section may have stale data from the previous command.
If the SCSI command doesn't carry payload, the driver may use this value as is for communicating with host, resulting in possible corruption.
Fix this by always initializing this value.
--- drivers/scsi/storvsc_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/storvsc_drv.c +1 -0
@@ -1854,6 +1854,7 @@ static int storvsc_queuecommand(struct S length =scsi_bufflen (scmnd); payload = (struct vmbus_packet_mpb_array *)&cmd_request->mpb; + payload->range.len =0 ; payload_sz =0 ;if (sg_count) {
Greg Kroah-Hartman
maintainerPATCH 299/620 kbuild: Move -Wenum-enum-conversion to W=2
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 8f6629c004b193d23612641c3607e785819e97ab upstream.
-Wenum-enum-conversion was strengthened in clang-19 to warn for C, which caused the kernel to move it to W=1 in commit 75b5ab134bb5 ("kbuild:
Move -Wenum-{compare-conditional,enum-conversion} into W=1") because there were numerous instances that would break builds with -Werror. Unfortunately, this is not a full solution, as more and more developers, subsystems, and distributors are building with W=1 as well, so they continue to see the numerous instances of this warning.
Since the move to W=1, there have not been many new instances that have appeared through various build reports and the ones that have appeared seem to be following similar existing patterns, suggesting that most instances of this warning will not be real issues. The only alternatives for silencing this warning are adding casts (which is generally seen as an ugly practice) or refactoring the enums to macro defines or a unified enum (which may be undesirable because of type safety in other parts of the code).
Move the warning to W=2, where warnings that occur frequently but may be relevant should reside.
--- scripts/Makefile.extrawarn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/Makefile.extrawarn +4 -1
@@ -37,6 +37,10 @@ KBUILD_CFLAGS += -Wno-missing-field-init KBUILD_CFLAGS += -Wno-sign-compare KBUILD_CFLAGS += -Wno-type-limits +ifdef CONFIG_CC_IS_CLANG +KBUILD_CFLAGS += -Wno-enum-enum-conversion +endif + KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1 else
@@ -54,7 +58,6 @@ KBUILD_CFLAGS += -Wno-tautological-const KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access) KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict) KBUILD_CFLAGS += -Wno-enum-compare-conditional -KBUILD_CFLAGS += -Wno-enum-enum-conversion endif endif
Greg Kroah-Hartman
maintainerPATCH 300/620 x86/boot: Use -std=gnu11 to fix build with GCC 15
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit ee2ab467bddfb2d7f68d996dbab94d7b88f8eaf7 upstream.
GCC 15 changed the default C standard version to C23, which should not have impacted the kernel because it requests the gnu11 standard via '-std=' in the main Makefile. However, the x86 compressed boot Makefile uses its own set of KBUILD_CFLAGS without a '-std=' value (i.e., using the default), resulting in errors from the kernel's definitions of bool, true, and false in stddef.h, which are reserved keywords under C23.
./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
11 | false = 0,
./include/linux/types.h:35:33: error: two or more data types in declaration specifiers
35 | typedef _Bool bool;
Set '-std=gnu11' in the x86 compressed boot Makefile to resolve the error and consistently use the same C standard version for the entire kernel.
--- arch/x86/boot/compressed/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/x86/boot/compressed/Makefile +1 -0
@@ -33,6 +33,7 @@ targets := vmlinux vmlinux.bin vmlinux.b # avoid errors with '-march=i386', and future flags may depend on the target to # be valid. KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS) +KBUILD_CFLAGS += -std=gnu11 KBUILD_CFLAGS += -fno-strict-aliasing -fPIE KBUILD_CFLAGS += -Wundef KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
Greg Kroah-Hartman
maintainerPATCH 301/620 arm64: dts: qcom: sm8350: Fix MPSS memory length
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit da1937dec9cd986e685b6a429b528a4cbc7b1603 upstream.
The address space in MPSS/Modem PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB) which has a length of 0x10000. Value of 0x4040 was copied from older DTS, but it grew since then.
This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +1 -1
@@ -754,7 +754,7 @@ mpss: remoteproc@4080000 { compatible = "qcom,sm8350-mpss-pas"; - reg = <0x0 0x04080000 0x0 0x4040>; + reg = <0x0 0x04080000 0x0 0x10000>; interrupts-extended = <&intc GIC_SPI 264 IRQ_TYPE_LEVEL_HIGH>, <&smp2p_modem_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 302/620 crypto: qce - fix priority to be less than ARMv8 CE
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 49b9258b05b97c6464e1964b6a2fddb3ddb65d17 upstream.
As QCE is an order of magnitude slower than the ARMv8 Crypto Extensions on the CPU, and is also less well tested, give it a lower priority. Previously the QCE SHA algorithms had higher priority than the ARMv8 CE equivalents, and the ciphers such as AES-XTS had the same priority which meant the QCE versions were chosen if they happened to be loaded later.
--- drivers/crypto/qce/aead.c | 2 +- drivers/crypto/qce/sha.c | 2 +- drivers/crypto/qce/skcipher.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/qce/aead.c +1 -1
@@ -786,7 +786,7 @@ static int qce_aead_register_one(const s alg->init = qce_aead_init; alg->exit = qce_aead_exit; - alg->base.cra_priority =300 ; + alg->base.cra_priority =275 ; alg->base.cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_ALLOCATES_MEMORY | CRYPTO_ALG_KERN_DRIVER_ONLY |
drivers/crypto/qce/sha.c +1 -1
@@ -480,7 +480,7 @@ static int qce_ahash_register_one(const base = &alg->halg.base; base->cra_blocksize = def->blocksize; - base->cra_priority =300 ; + base->cra_priority =175 ; base->cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_KERN_DRIVER_ONLY ; base->cra_ctxsize =sizeof (struct qce_sha_ctx ); base->cra_alignmask =0 ;
drivers/crypto/qce/skcipher.c +1 -1
@@ -461,7 +461,7 @@ static int qce_skcipher_register_one(con alg->encrypt = qce_skcipher_encrypt; alg->decrypt = qce_skcipher_decrypt; - alg->base.cra_priority =300 ; + alg->base.cra_priority =275 ; alg->base.cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_ALLOCATES_MEMORY |CRYPTO_ALG_KERN_DRIVER_ONLY ;
Greg Kroah-Hartman
maintainerPATCH 303/620 xfs: Add error handling for xfs_reflink_cancel_cow_range
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit 26b63bee2f6e711c5a169997fd126fddcfb90848 upstream.
In xfs_inactive(), xfs_reflink_cancel_cow_range() is called without error handling, risking unnoticed failures and inconsistent behavior compared to other parts of the code.
Fix this issue by adding an error handling for the xfs_reflink_cancel_cow_range(), improving code robustness.
--- fs/xfs/xfs_inode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/xfs/xfs_inode.c +5 -2
@@ -1748,8 +1748,11 @@ xfs_inactive( goto out;/* Try to clean out the cow blocks if there are any. */ -if (xfs_inode_has_cow_data (ip)) -xfs_reflink_cancel_cow_range (ip,0 ,NULLFILEOFF , true); +if (xfs_inode_has_cow_data (ip)) { + error =xfs_reflink_cancel_cow_range (ip,0 ,NULLFILEOFF , true); +if (error) + goto out; + }if (VFS_I (ip)->i_nlink !=0 ) {/*
Greg Kroah-Hartman
maintainerPATCH 304/620 media: ccs: Clean up parsed CCS static data on parse failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit da73efa8e675a2b58f1c7ae61201acfe57714bf7 upstream.
ccs_data_parse() releases the allocated in-memory data structure when the parser fails, but it does not clean up parsed metadata that is there to help access the actual data. Do that, in order to return the data structure in a sane state.
--- drivers/media/i2c/ccs/ccs-data.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/media/i2c/ccs/ccs-data.c +7 -5
@@ -10,6 +10,7 @@#include <linux/limits.h> #include <linux/mm.h> #include <linux/slab.h> +#include <linux/string.h> #include "ccs-data-defs.h"
@@ -948,15 +949,15 @@ int ccs_data_parse(struct ccs_data_conta rval =__ccs_data_parse (&bin, ccsdata, data, len, dev, verbose);if (rval) -return rval; + goto out_cleanup; rval =bin_backing_alloc (&bin);if (rval) -return rval; + goto out_cleanup; rval =__ccs_data_parse (&bin, ccsdata, data, len, dev, false);if (rval) - goto out_free; + goto out_cleanup;if (verbose && ccsdata->version)print_ccs_data_version (dev, ccsdata->version);
@@ -965,15 +966,16 @@ int ccs_data_parse(struct ccs_data_conta rval = -EPROTO ;dev_dbg (dev,"parsing mismatch; base %p; now %p; end %p\n" , bin.base, bin.now, bin.end); - goto out_free; + goto out_cleanup; } ccsdata->backing = bin.base;return 0 ; -out_free: +out_cleanup:kvfree (bin.base); +memset (ccsdata,0 ,sizeof (*ccsdata));return rval; }
Greg Kroah-Hartman
maintainerPATCH 305/620 iio: light: as73211: fix channel handling in only-color triggered buffer
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit ab09c6cfe01b317f515bcd944668697241a54b9d upstream.
The channel index is off by one unit if AS73211_SCAN_MASK_ALL is not set (optimized path for color channel readings), and it must be shifted instead of leaving an empty channel for the temperature when it is off.
Once the channel index is fixed, the uninitialized channel must be set to zero to avoid pushing uninitialized data.
Add available_scan_masks for all channels and only-color channels to let the IIO core demux and repack the enabled channels.
--- drivers/iio/light/as73211.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
drivers/iio/light/as73211.c +20 -4
@@ -154,6 +154,12 @@ struct as73211_data { BIT(AS73211_SCAN_INDEX_TEMP) | \ AS73211_SCAN_MASK_COLOR) +static const unsigned long as73211_scan_masks[] = { +AS73211_SCAN_MASK_COLOR , +AS73211_SCAN_MASK_ALL , +0 +}; +static const struct iio_chan_spec as73211_channels[] = { { .type =IIO_TEMP ,
@@ -602,9 +608,12 @@ static irqreturn_t as73211_trigger_handl/* AS73211 starts reading at address 2 */ ret =i2c_master_recv (data->client, - (char *)&scan.chan[1 ],3 *sizeof (scan.chan[1 ])); + (char *)&scan.chan[0 ],3 *sizeof (scan.chan[0 ]));if (ret <0 ) goto done; + +/* Avoid pushing uninitialized data */ + scan.chan[3 ] =0 ; }if (data_result) {
@@ -612,9 +621,15 @@ static irqreturn_t as73211_trigger_handl* Saturate all channels (in case of overflows). Temperature channel * is not affected by overflows. */ - scan.chan[1 ] =cpu_to_le16 (U16_MAX ); - scan.chan[2 ] =cpu_to_le16 (U16_MAX ); - scan.chan[3 ] =cpu_to_le16 (U16_MAX ); +if (*indio_dev->active_scan_mask ==AS73211_SCAN_MASK_ALL ) { + scan.chan[1 ] =cpu_to_le16 (U16_MAX ); + scan.chan[2 ] =cpu_to_le16 (U16_MAX ); + scan.chan[3 ] =cpu_to_le16 (U16_MAX ); + }else { + scan.chan[0 ] =cpu_to_le16 (U16_MAX ); + scan.chan[1 ] =cpu_to_le16 (U16_MAX ); + scan.chan[2 ] =cpu_to_le16 (U16_MAX ); + } }iio_push_to_buffers_with_timestamp (indio_dev, &scan,iio_get_time_ns (indio_dev));
@@ -684,6 +699,7 @@ static int as73211_probe(struct i2c_clie indio_dev->channels = as73211_channels; indio_dev->num_channels =ARRAY_SIZE (as73211_channels); indio_dev->modes =INDIO_DIRECT_MODE ; + indio_dev->available_scan_masks = as73211_scan_masks; ret =i2c_smbus_read_byte_data (data->client,AS73211_REG_OSR );if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 306/620 soc: qcom: smem_state: fix missing of_node_put in error path
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 70096b4990848229d0784c5e51dc3c7c072f1111 upstream.
If of_parse_phandle_with_args() succeeds, the OF node reference should be dropped, regardless of number of phandle arguments.
--- drivers/soc/qcom/smem_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soc/qcom/smem_state.c +2 -1
@@ -116,7 +116,8 @@ struct qcom_smem_state *qcom_smem_state_if (args.args_count !=1 ) {dev_err (dev,"invalid #qcom,smem-state-cells\n" ); -return ERR_PTR (-EINVAL ); + state =ERR_PTR (-EINVAL ); + goto put; } state =of_node_to_state (args.np);
Greg Kroah-Hartman
maintainerPATCH 307/620 media: mc: fix endpoint iteration
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Tanislav <[email protected]>
commit fb2bd86270cd0ad004f4c614ba4f8c63a5720e25 upstream.
When creating links from a subdev to a sink, the current logic tries to iterate over the endpoints of dev's fwnode.
This might not be correct when the subdev uses a different fwnode compared to the dev's fwnode.
If, when registering, the subdev's fwnode is not set, the code inside v4l2_async_register_subdev will set it to the dev's fwnode.
To fix this, just use the subdev's fwnode.
--- drivers/media/v4l2-core/v4l2-mc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-mc.c +1 -1
@@ -321,7 +321,7 @@ int v4l2_create_fwnode_links_to_pad(stru sink_sd =media_entity_to_v4l2_subdev (sink->entity); -fwnode_graph_for_each_endpoint (dev_fwnode (src_sd->dev), endpoint) { +fwnode_graph_for_each_endpoint (src_sd->fwnode, endpoint) {struct fwnode_handle *remote_ep;int src_idx, sink_idx, ret;struct media_pad *src;
Greg Kroah-Hartman
maintainerPATCH 308/620 media: ov5640: fix get_light_freq on auto
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Bobrowicz <[email protected]>
commit 001d3753538d26ddcbef011f5643cfff58a7f672 upstream.
Light frequency was not properly returned when in auto mode and the detected frequency was 60Hz.
--- drivers/media/i2c/ov5640.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/ov5640.c +1 -0
@@ -1406,6 +1406,7 @@ static int ov5640_get_light_freq(struct light_freq =50 ; }else {/* 60Hz */ + light_freq =60 ; } }
Greg Kroah-Hartman
maintainerPATCH 309/620 media: ccs: Fix CCS static data parsing for large block sizes
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 82b696750f0b60e7513082a10ad42786854f59f8 upstream.
The length field of the CCS static data blocks was mishandled, leading to wrong interpretation of the length header for blocks that are 16 kiB in size. Such large blocks are very, very rare and so this wasn't found earlier.
As the length is used as part of input validation, the issue has no security implications.
--- drivers/media/i2c/ccs/ccs-data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ccs/ccs-data.c +1 -1
@@ -98,7 +98,7 @@ ccs_data_parse_length_specifier(const st plen = ((size_t ) (__len3->length[0 ] & ((1 <<CCS_DATA_LENGTH_SPECIFIER_SIZE_SHIFT ) -1 )) - <<16 ) + (__len3->length[0 ] <<8 ) + __len3->length[1 ]; + <<16 ) + (__len3->length[1 ] <<8 ) + __len3->length[2 ];break ; }default :
Greg Kroah-Hartman
maintainerPATCH 310/620 media: ccs: Fix cleanup order in ccs_probe()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mehdi Djait <[email protected]>
commit 6fdbff0f54786e94f0f630ff200ec1d666b1633e upstream.
ccs_limits is allocated in ccs_read_all_limits() after the allocation of mdata.backing. Ensure that resources are freed in the reverse order of their allocation by moving out_free_ccs_limits up.
--- drivers/media/i2c/ccs/ccs-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/i2c/ccs/ccs-core.c +3 -3
@@ -3652,15 +3652,15 @@ out_media_entity_cleanup: out_cleanup:ccs_cleanup (sensor); +out_free_ccs_limits: +kfree (sensor->ccs_limits); + out_release_mdata:kvfree (sensor->mdata.backing); out_release_sdata:kvfree (sensor->sdata.backing); -out_free_ccs_limits: -kfree (sensor->ccs_limits); - out_power_off:ccs_power_off (&client->dev);mutex_destroy (&sensor->mutex);
Greg Kroah-Hartman
maintainerPATCH 311/620 media: uvcvideo: Fix event flags in uvc_ctrl_send_events
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit c31cffd5ae2c3d7ef21d9008977a9d117ce7a64e upstream.
If there is an event that needs the V4L2_EVENT_CTRL_CH_FLAGS flag, all the following events will have that flag, regardless if they need it or not.
This is because we keep using the same variable all the time and we do not reset its original value.
--- drivers/media/usb/uvc/uvc_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +2 -2
@@ -1511,13 +1511,13 @@ static void uvc_ctrl_send_events(struct {struct uvc_control_mapping *mapping;struct uvc_control *ctrl; -u32 changes =V4L2_EVENT_CTRL_CH_VALUE ;unsigned int i;unsigned int j;for (i =0 ; i < xctrls_count; ++i) { - ctrl =uvc_find_control (handle->chain, xctrls[i].id, &mapping); +u32 changes =V4L2_EVENT_CTRL_CH_VALUE ; + ctrl =uvc_find_control (handle->chain, xctrls[i].id, &mapping);if (ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS )/* Notification will be sent from an Interrupt event. */ continue ;
Greg Kroah-Hartman
maintainerPATCH 312/620 media: uvcvideo: Remove redundant NULL assignment
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit 04d3398f66d2d31c4b8caea88f051a4257b7a161 upstream.
ctrl->handle will only be different than NULL for controls that have mappings. This is because that assignment is only done inside uvc_ctrl_set() for mapped controls.
--- drivers/media/usb/uvc/uvc_ctrl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +1 -3
@@ -1478,10 +1478,8 @@ bool uvc_ctrl_status_event_async(structstruct uvc_device *dev = chain->dev;struct uvc_ctrl_work *w = &dev->async_ctrl; -if (list_empty (&ctrl->info.mappings)) { - ctrl->handle =NULL ; +if (list_empty (&ctrl->info.mappings))return false; - } w->data = data; w->urb = urb;
Greg Kroah-Hartman
maintainerPATCH 313/620 crypto: qce - fix goto jump in error path
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit 5278275c1758a38199b43530adfc50098f4b41c7 upstream.
If qce_check_version() fails, we should jump to err_dma as we already called qce_dma_request() a couple lines before.
--- drivers/crypto/qce/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qce/core.c +1 -1
@@ -236,7 +236,7 @@ static int qce_crypto_probe(struct platf ret =qce_check_version (qce);if (ret) - goto err_clks; + goto err_dma;spin_lock_init (&qce->lock); tasklet_init(&qce->done_tasklet, qce_tasklet_req_done,
Greg Kroah-Hartman
maintainerPATCH 314/620 crypto: qce - unregister previously registered algos in error path
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit e80cf84b608725303113d6fe98bb727bf7b7a40d upstream.
If we encounter an error when registering alorithms with the crypto framework, we just bail out and don't unregister the ones we successfully registered in prior iterations of the loop.
Add code that goes back over the algos and unregisters them before returning an error from qce_register_algs().
--- drivers/crypto/qce/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/crypto/qce/core.c +7 -4
@@ -48,16 +48,19 @@ static void qce_unregister_algs(struct qstatic int qce_register_algs (struct qce_device *qce) {const struct qce_algo_ops *ops; -int i, ret = -ENODEV ; +int i, j, ret = -ENODEV ;for (i =0 ; i <ARRAY_SIZE (qce_ops); i++) { ops = qce_ops[i]; ret = ops->register_algs (qce); -if (ret) -break ; +if (ret) { +for (j = i -1 ; j >=0 ; j--) + ops->unregister_algs (qce); +return ret; + } } -return ret; +return 0 ; }static int qce_handle_request (struct crypto_async_request *async_req)
Greg Kroah-Hartman
maintainerPATCH 315/620 nvmem: qcom-spmi-sdam: Set size in struct nvmem_config
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
commit e88f516ea417c71bb3702603ac6af9e95338cfa6 upstream.
Let the nvmem core know what size the SDAM is, most notably this fixes the size of /sys/bus/nvmem/devices/spmi_sdam*/nvmem being '0' and makes user space work with that file.
~ # hexdump -C -s 64 /sys/bus/nvmem/devices/spmi_sdam2/nvmem
00000040 02 01 00 00 04 00 00 00 00 00 00 00 00 00 00 00 |................| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000080
--- drivers/nvmem/qcom-spmi-sdam.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvmem/qcom-spmi-sdam.c +1 -0
@@ -143,6 +143,7 @@ static int sdam_probe(struct platform_de sdam->sdam_config.id =NVMEM_DEVID_AUTO ; sdam->sdam_config.owner =THIS_MODULE ; sdam->sdam_config.stride =1 ; + sdam->sdam_config.size = sdam->size; sdam->sdam_config.word_size =1 ; sdam->sdam_config.reg_read = sdam_read; sdam->sdam_config.reg_write = sdam_write;
Greg Kroah-Hartman
maintainerPATCH 316/620 nvmem: core: improve range check for nvmem_cell_write()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jennifer Berringer <[email protected]>
commit 31507fc2ad36e0071751a710449db19c85d82a7f upstream.
When __nvmem_cell_entry_write() is called for an nvmem cell that does not need bit shifting, it requires that the len parameter exactly matches the nvmem cell size. However, when the nvmem cell has a nonzero bit_offset, it was skipping this check.
Accepting values of len larger than the cell size results in nvmem_cell_prepare_write_buffer() trying to write past the end of a heap buffer that it allocates. Add a check to avoid that problem and instead return -EINVAL when len doesn't match the number of bits expected by the nvmem cell when bit_offset is nonzero.
This check uses cell->nbits in order to allow providing the smaller size to cells that are shifted into another byte by bit_offset. For example, a cell with nbits=8 and nonzero bit_offset would have bytes=2 but should accept a 1-byte write here, although no current callers depend on this.
--- drivers/nvmem/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvmem/core.c +2 -0
@@ -1512,6 +1512,8 @@ int nvmem_cell_write(struct nvmem_cell *return -EINVAL ;if (cell->bit_offset || cell->nbits) { +if (len !=BITS_TO_BYTES (cell->nbits) && len != cell->bytes) +return -EINVAL ; buf =nvmem_cell_prepare_write_buffer (cell, buf, len);if (IS_ERR (buf))return PTR_ERR (buf);
Greg Kroah-Hartman
maintainerPATCH 317/620 vfio/platform: check the bounds of read/write syscalls
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit ce9ff21ea89d191e477a02ad7eabf4f996b80a69 upstream.
count and offset are passed from user space and not checked, only offset is capped to 40 bits, which can be used to read/write out of bounds of the device.
--- drivers/vfio/platform/vfio_platform_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/vfio/platform/vfio_platform_common.c +10 -0
@@ -393,6 +393,11 @@ static ssize_t vfio_platform_read_mmio(s count =min_t (size_t, count, reg->size - off); +if (off >= reg->size) +return -EINVAL ; + + count =min_t (size_t, count, reg->size - off); +if (!reg->ioaddr) { reg->ioaddr =ioremap (reg->addr, reg->size);
@@ -473,6 +478,11 @@ static ssize_t vfio_platform_write_mmio(if (off >= reg->size)return -EINVAL ; + + count =min_t (size_t, count, reg->size - off); + +if (off >= reg->size) +return -EINVAL ; count =min_t (size_t, count, reg->size - off);
Greg Kroah-Hartman
maintainerPATCH 318/620 pnfs/flexfiles: retry getting layout segment for reads
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit eb3fabde15bccdf34f1c9b35a83aa4c0dacbb4ca upstream.
If ff_layout_pg_get_read()'s attempt to get a layout segment results in -EAGAIN have ff_layout_pg_init_read() retry it after sleeping.
If "softerr" mount is used, use 'io_maxretrans' to limit the number of attempts to get a layout segment.
This fixes a long-standing issue of O_DIRECT reads failing with -EAGAIN (11) when using flexfiles Client Side Mirroring (CSM).
--- fs/nfs/flexfilelayout/flexfilelayout.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
fs/nfs/flexfilelayout/flexfilelayout.c +21 -6
@@ -836,6 +836,9 @@ ff_layout_pg_init_read(struct nfs_pageiostruct nfs4_pnfs_ds *ds;u32 ds_idx; +if (NFS_SERVER (pgio->pg_inode)->flags & + (NFS_MOUNT_SOFT |NFS_MOUNT_SOFTERR )) + pgio->pg_maxretrans = io_maxretrans; retry:ff_layout_pg_check_layout (pgio, req);/* Use full layout for now */
@@ -849,6 +852,8 @@ retry:if (!pgio->pg_lseg) goto out_nolseg; } +/* Reset wb_nio, since getting layout segment was successful */ + req->wb_nio =0 ; ds =ff_layout_get_ds_for_read (pgio, &ds_idx);if (!ds) {
@@ -865,14 +870,24 @@ retry: pgm->pg_bsize = mirror->mirror_ds->ds_versions[0 ].rsize; pgio->pg_mirror_idx = ds_idx; - -if (NFS_SERVER (pgio->pg_inode)->flags & - (NFS_MOUNT_SOFT |NFS_MOUNT_SOFTERR )) - pgio->pg_maxretrans = io_maxretrans;return ; out_nolseg: -if (pgio->pg_error <0 ) -return ; +if (pgio->pg_error <0 ) { +if (pgio->pg_error != -EAGAIN ) +return ; +/* Retry getting layout segment if lower layer returned -EAGAIN */ +if (pgio->pg_maxretrans && req->wb_nio++ > pgio->pg_maxretrans) { +if (NFS_SERVER (pgio->pg_inode)->flags &NFS_MOUNT_SOFTERR ) + pgio->pg_error = -ETIMEDOUT ; +else + pgio->pg_error = -EIO ; +return ; + } + pgio->pg_error =0 ; +/* Sleep for 1 second before retrying */ +ssleep (1 ); + goto retry; + } out_mds: trace_pnfs_mds_fallback_pg_init_read(pgio->pg_inode, 0, NFS4_MAX_UINT64, IOMODE_READ,
Greg Kroah-Hartman
maintainerPATCH 319/620 ocfs2: fix incorrect CPU endianness conversion causing mount failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heming Zhao <[email protected]>
commit f921da2c34692dfec5f72b5ae347b1bea22bb369 upstream.
Commit 23aab037106d ("ocfs2: fix UBSAN warning in ocfs2_verify_volume()") introduced a regression bug. The blksz_bits value is already converted to CPU endian in the previous code; therefore, the code shouldn't use le32_to_cpu() anymore.
--- fs/ocfs2/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/super.c +1 -1
@@ -2346,7 +2346,7 @@ static int ocfs2_verify_volume(struct ocmlog (ML_ERROR ,"found superblock with incorrect block " "size bits: found %u, should be 9, 10, 11, or 12\n" , blksz_bits); - }else if ((1 <<le32_to_cpu (blksz_bits)) != blksz) { + }else if ((1 << blksz_bits) != blksz) {mlog (ML_ERROR ,"found superblock with incorrect block " "size: found %u, should be %u\n" ,1 << blksz_bits, blksz); } else if (le16_to_cpu(di->id2.i_super.s_major_rev_level) !=
Greg Kroah-Hartman
maintainerPATCH 320/620 ocfs2: handle a symlink read error correctly
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
commit 2b4c2094da6d84e69b843dd3317902e977bf64bd upstream.
Patch series "Convert ocfs2 to use folios".
Mark did a conversion of ocfs2 to use folios and sent it to me as a giant patch for review ;-)
So I've redone it as individual patches, and credited Mark for the patches where his code is substantially the same. It's not a bad way to do it; his patch had some bugs and my patches had some bugs. Hopefully all our bugs were different from each other. And hopefully Mark likes all the changes I made to his code!
This patch (of 23):
If we can't read the buffer, be sure to unlock the page before returning.
--- fs/ocfs2/symlink.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ocfs2/symlink.c +3 -2
@@ -64,7 +64,7 @@ static int ocfs2_fast_symlink_readpage(sif (status <0 ) {mlog_errno (status); -return status; + goto out; } fe = (struct ocfs2_dinode *) bh->b_data;
@@ -75,9 +75,10 @@ static int ocfs2_fast_symlink_readpage(smemcpy (kaddr, link, len +1 );kunmap_atomic (kaddr);SetPageUptodate (page); +out:unlock_page (page);brelse (bh); -return 0 ; +return status; }const struct address_space_operations ocfs2_fast_symlink_aops = {
Greg Kroah-Hartman
maintainerPATCH 321/620 nilfs2: fix possible int overflows in nilfs_fiemap()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
commit 6438ef381c183444f7f9d1de18f22661cba1e946 upstream.
Since nilfs_bmap_lookup_contig() in nilfs_fiemap() calculates its result by being prepared to go through potentially maxblocks == INT_MAX blocks, the value in n may experience an overflow caused by left shift of blkbits.
While it is extremely unlikely to occur, play it safe and cast right hand expression to wider type to mitigate the issue.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- fs/nilfs2/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/nilfs2/inode.c +3 -3
@@ -1265,7 +1265,7 @@ int nilfs_fiemap(struct inode *inode, stif (size) {if (phys && blkphy << blkbits == phys + size) {/* The current extent goes on */ - size += n << blkbits; + size += (u64 )n << blkbits; }else {/* Terminate the current extent */ ret = fiemap_fill_next_extent(
@@ -1278,14 +1278,14 @@ int nilfs_fiemap(struct inode *inode, st flags =FIEMAP_EXTENT_MERGED ; logical = blkoff << blkbits; phys = blkphy << blkbits; - size = n << blkbits; + size = (u64 )n << blkbits; } }else {/* Start a new extent */ flags =FIEMAP_EXTENT_MERGED ; logical = blkoff << blkbits; phys = blkphy << blkbits; - size = n << blkbits; + size = (u64 )n << blkbits; } blkoff += n; }
Greg Kroah-Hartman
maintainerPATCH 322/620 NFC: nci: Add bounds checking in nci_hci_create_pipe()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 110b43ef05342d5a11284cc8b21582b698b4ef1c upstream.
The "pipe" variable is a u8 which comes from the network. If it's more than 127, then it results in memory corruption in the caller, nci_hci_connect_gate().
--- net/nfc/nci/hci.c | 2 ++ 1 file changed, 2 insertions(+)
net/nfc/nci/hci.c +2 -0
@@ -542,6 +542,8 @@ static u8 nci_hci_create_pipe(struct ncipr_debug ("pipe created=%d\n" , pipe); +if (pipe >=NCI_HCI_MAX_PIPES ) + pipe =NCI_HCI_INVALID_PIPE ;return pipe; }
Greg Kroah-Hartman
maintainerPATCH 323/620 mtd: onenand: Fix uninitialized retlen in do_otp_read()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Stepchenko <[email protected]>
commit 70a71f8151b9879b0950668ce3ad76263261fee0 upstream.
The function do_otp_read() does not set the output parameter *retlen, which is expected to contain the number of bytes actually read. As a result, in onenand_otp_walk(), the tmp_retlen variable remains uninitialized after calling do_otp_walk() and used to change the values of the buf, len and retlen variables.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/mtd/nand/onenand/onenand_base.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/onenand/onenand_base.c +1 -0
@@ -2911,6 +2911,7 @@ static int do_otp_read(struct mtd_info * ret =ONENAND_IS_4KB_PAGE (this) ?onenand_mlc_read_ops_nolock (mtd, from, &ops) :onenand_read_ops_nolock (mtd, from, &ops); + *retlen = ops.retlen;/* Exit OTP access mode */ this->command (mtd,ONENAND_CMD_RESET ,0 ,0 );
Greg Kroah-Hartman
maintainerPATCH 324/620 misc: fastrpc: Fix registered buffer page address
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ekansh Gupta <[email protected]>
commit 6ca4ea1f88a06a04ed7b2c9c6bf9f00833b68214 upstream.
For registered buffers, fastrpc driver sends the buffer information to remote subsystem. There is a problem with current implementation where the page address is being sent with an offset leading to improper buffer address on DSP. This is leads to functional failures as DSP expects base address in page information and extracts offset information from remote arguments. Mask the offset and pass the base page address to DSP.
This issue is observed is a corner case when some buffer which is registered with fastrpc framework is passed with some offset by user and then the DSP implementation tried to read the data. As DSP expects base address and takes care of offsetting with remote arguments, passing an offsetted address will result in some unexpected data read in DSP.
All generic usecases usually pass the buffer as it is hence is problem is not usually observed. If someone tries to pass offsetted buffer and then tries to compare data at HLOS and DSP end, then the ambiguity will be observed.
--- drivers/misc/fastrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/fastrpc.c +1 -1
@@ -828,7 +828,7 @@ static int fastrpc_get_args(u32 kernel,mmap_read_lock (current->mm); vma =find_vma (current->mm, ctx->args[i].ptr);if (vma) - pages[i].addr += ctx->args[i].ptr - + pages[i].addr += (ctx->args[i].ptr &PAGE_MASK ) - vma->vm_start;mmap_read_unlock (current->mm);
Greg Kroah-Hartman
maintainerPATCH 325/620 net/ncsi: wait for the last response to Deselect Package before configuring channel
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Fertser <[email protected]>
commit 6bb194d036c6e1b329dcdff459338cdd9a54802a upstream.
The NCSI state machine as it's currently implemented assumes that transition to the next logical state is performed either explicitly by calling schedule_work(&ndp->work) to re-queue itself or implicitly after processing the predefined (ndp->pending_req_num) number of replies. Thus to avoid the configuration FSM from advancing prematurely and getting out of sync with the process it's essential to not skip waiting for a reply.
This patch makes the code wait for reception of the Deselect Package response for the last package probed before proceeding to channel configuration.
Thanks go to Potin Lai and Cosmo Chou for the initial investigation and testing.
--- net/ncsi/ncsi-manage.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
net/ncsi/ncsi-manage.c +7 -6
@@ -1385,6 +1385,12 @@ static void ncsi_probe_channel(struct nc nd->state = ncsi_dev_state_probe_package;break ;case ncsi_dev_state_probe_package: +if (ndp->package_probe_id >=8 ) { +/* Last package probed, finishing */ + ndp->flags |=NCSI_DEV_PROBED ; +break ; + } + ndp->pending_req_num =1 ; nca.type =NCSI_PKT_CMD_SP ;
@@ -1501,13 +1507,8 @@ static void ncsi_probe_channel(struct ncif (ret) goto error; -/* Probe next package */ +/* Probe next package after receiving response */ ndp->package_probe_id++; -if (ndp->package_probe_id >=8 ) { -/* Probe finished */ - ndp->flags |=NCSI_DEV_PROBED ; -break ; - } nd->state = ncsi_dev_state_probe_package; ndp->active_package =NULL ;break ;
Greg Kroah-Hartman
maintainerPATCH 326/620 net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Milos Reljin <[email protected]>
commit bd1bbab717608757cccbbe08b0d46e6c3ed0ced5 upstream.
In application note (AN13663) for TJA1120, on page 30, there's a figure with average PHY startup timing values following software reset. The time it takes for SMI to become operational after software reset ranges roughly from 500 us to 1500 us.
This commit adds 2000 us delay after MDIO write which triggers software reset. Without this delay, soft_reset function returns an error and prevents successful PHY init.
--- drivers/net/phy/nxp-c45-tja11xx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/phy/nxp-c45-tja11xx.c +2 -0
@@ -717,6 +717,8 @@ static int nxp_c45_soft_reset(struct phyif (ret)return ret; +usleep_range (2000 ,2050 ); + return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, VEND1_DEVICE_CONTROL, ret, !(ret & DEVICE_CONTROL_RESET), 20000,
Greg Kroah-Hartman
maintainerPATCH 327/620 ptp: Ensure info->enable callback is always set
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
commit fd53aa40e65f518453115b6f56183b0c201db26b upstream.
The ioctl and sysfs handlers unconditionally call the ->enable callback. Not all drivers implement that callback, leading to NULL dereferences. Example of affected drivers: ptp_s390.c, ptp_vclock.c and ptp_mock.c.
Instead use a dummy callback if no better was specified by the driver.
--- drivers/ptp/ptp_clock.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/ptp/ptp_clock.c +8 -0
@@ -180,6 +180,11 @@ static void ptp_clock_release(struct devkfree (ptp); } +static int ptp_enable (struct ptp_clock_info *ptp,struct ptp_clock_request *request,int on) +{ +return -EOPNOTSUPP ; +} +static void ptp_aux_kworker (struct kthread_work *work) { struct ptp_clock *ptp = container_of(work, struct ptp_clock,
@@ -227,6 +232,9 @@ struct ptp_clock *ptp_clock_register(strmutex_init (&ptp->n_vclocks_mux);init_waitqueue_head (&ptp->tsev_wq); +if (!ptp->info->enable) + ptp->info->enable = ptp_enable; +if (ptp->info->do_aux_work) {kthread_init_delayed_work (&ptp->aux_work, ptp_aux_kworker); ptp->kworker =kthread_create_worker (0 ,"ptp%d" , ptp->index);
Greg Kroah-Hartman
maintainerPATCH 328/620 MIPS: ftrace: Declare ftrace_get_parent_ra_addr() as static
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
commit ddd068d81445b17ac0bed084dfeb9e58b4df3ddd upstream.
Declare ftrace_get_parent_ra_addr() as static to suppress clang compiler warning that 'no previous prototype'. This function is not intended to be called from other parts.
Fix follow error with clang-19:
arch/mips/kernel/ftrace.c:251:15: error: no previous prototype for function 'ftrace_get_parent_ra_addr' [-Werror,-Wmissing-prototypes]
251 | unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
| ^arch/mips/kernel/ftrace.c:251:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
251 | unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
| ^
| static1 error generated.
--- arch/mips/kernel/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kernel/ftrace.c +1 -1
@@ -248,7 +248,7 @@ int ftrace_disable_ftrace_graph_caller(v#define S_R_SP (0xafb0 << 16)/* s{d,w} R, offset(sp) */ #define OFFSET_MASK 0xffff/* stack offset range: 0 ~ PT_SIZE */ -unsigned long ftrace_get_parent_ra_addr (unsigned long self_ra,unsigned long +static unsigned long ftrace_get_parent_ra_addr (unsigned long self_ra,unsigned long old_parent_ra,unsigned long parent_ra_addr,unsigned long fp) {unsigned long sp, ip, tmp;
Greg Kroah-Hartman
maintainerPATCH 329/620 net/ncsi: use dev_set_mac_address() for Get MC MAC Address handling
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Fertser <[email protected]>
commit 05d91cdb1f9108426b14975ef4eeddf15875ca05 upstream.
Copy of the rationale from 790071347a0a1a89e618eedcd51c687ea783aeb3:
Change ndo_set_mac_address to dev_set_mac_address because dev_set_mac_address provides a way to notify network layer about MAC change. In other case, services may not aware about MAC change and keep using old one which set from network adapter driver.
As example, DHCP client from systemd do not update MAC address without notification from net subsystem which leads to the problem with acquiring the right address from DHCP server.
Since dev_set_mac_address requires RTNL lock the operation can not be performed directly in the response handler, see 9e2bbab94b88295dcc57c7580393c9ee08d7314d.
The way of selecting the first suitable MAC address from the list is changed, instead of having the driver check it this patch just assumes any valid MAC should be good.
--- net/ncsi/ncsi-rsp.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
net/ncsi/ncsi-rsp.c +8 -10
@@ -1089,14 +1089,12 @@ static int ncsi_rsp_handler_netlink(strustatic int ncsi_rsp_handler_gmcma (struct ncsi_request *nr) {struct ncsi_dev_priv *ndp = nr->ndp; +struct sockaddr *saddr = &ndp->pending_mac;struct net_device *ndev = ndp->ndev.dev;struct ncsi_rsp_gmcma_pkt *rsp; -struct sockaddr saddr; -int ret =-1 ;int i; rsp = (struct ncsi_rsp_gmcma_pkt *)skb_network_header (nr->rsp); - saddr.sa_family = ndev->type; ndev->priv_flags |=IFF_LIVE_ADDR_CHANGE ; netdev_info(ndev, "NCSI: Received %d provisioned MAC addresses\n",
@@ -1108,20 +1106,20 @@ static int ncsi_rsp_handler_gmcma(struct rsp->addresses[i][4], rsp->addresses[i][5]); } + saddr->sa_family = ndev->type;for (i =0 ; i < rsp->address_count; i++) { -memcpy (saddr.sa_data, &rsp->addresses[i],ETH_ALEN ); - ret = ndev->netdev_ops->ndo_set_mac_address (ndev, &saddr); -if (ret <0 ) { +if (!is_valid_ether_addr (rsp->addresses[i])) {netdev_warn (ndev,"NCSI: Unable to assign %pM to device\n" , - saddr.sa_data); + rsp->addresses[i]);continue ; } -netdev_warn (ndev,"NCSI: Set MAC address to %pM\n" , saddr.sa_data); +memcpy (saddr->sa_data, rsp->addresses[i],ETH_ALEN ); +netdev_warn (ndev,"NCSI: Will set MAC address to %pM\n" , saddr->sa_data);break ; } - ndp->gma_flag = ret ==0 ; -return ret; + ndp->gma_flag =1 ; +return 0 ; } static struct ncsi_rsp_handler {
Greg Kroah-Hartman
maintainerPATCH 330/620 gpio: xilinx: remove excess kernel doc
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit 4c7fcbf5077532b80bc233c83d56e09a6bfa16b0 upstream.
The irqchip field has been removed from struct xgpio_instance so remove the doc as well.
--- drivers/gpio/gpio-xilinx.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpio/gpio-xilinx.c +0 -1
@@ -52,7 +52,6 @@* @dir: GPIO direction shadow register * @gpio_lock: Lock used for synchronization * @irq: IRQ used by GPIO device -* @irqchip: IRQ chip * @enable: GPIO IRQ enable/disable bitfield * @rising_edge: GPIO IRQ rising edge enable/disable bitfield * @falling_edge: GPIO IRQ falling edge enable/disable bitfield
Greg Kroah-Hartman
maintainerPATCH 331/620 memory: tegra20-emc: Correct memory device mask
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Osipenko <[email protected]>
commit 9ff684342ee7d3ea2755c6e9b60bc43085baa3ad upstream.
Memory chip select is swapped when we read mode register, correct it. We didn't have devices that use a single LPDDR chip and both chips are always identical, hence this change is just a minor improvement.
--- drivers/memory/tegra/tegra20-emc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memory/tegra/tegra20-emc.c +1 -1
@@ -540,7 +540,7 @@ static int emc_read_lpddr_mode_register(unsigned int register_addr, unsigned int *register_data) { - u32 memory_dev = emem_dev + 1; + u32 memory_dev = emem_dev ? 1 : 2;u32 val, mr_mask =0xff ;int err;
Greg Kroah-Hartman
maintainerPATCH 332/620 ocfs2: check dir i_size in ocfs2_find_entry
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Yue <[email protected]>
commit b0fce54b8c0d8e5f2b4c243c803c5996e73baee8 upstream.
syz reports an out of bounds read:
==================================================================
BUG: KASAN: slab-out-of-bounds in ocfs2_match fs/ocfs2/dir.c:334 [inline] BUG: KASAN: slab-out-of-bounds in ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367 Read of size 1 at addr ffff88804d8b9982 by task syz-executor.2/14802 CPU: 0 UID: 0 PID: 14802 Comm: syz-executor.2 Not tainted 6.13.0-rc4 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Sched_ext: serialise (enabled+all), task: runnable_at=-10ms Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x229/0x350 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x164/0x530 mm/kasan/report.c:489 kasan_report+0x147/0x180 mm/kasan/report.c:602 ocfs2_match fs/ocfs2/dir.c:334 [inline] ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367 ocfs2_find_entry_id fs/ocfs2/dir.c:414 [inline] ocfs2_find_entry+0x1143/0x2db0 fs/ocfs2/dir.c:1078 ocfs2_find_files_on_disk+0x18e/0x530 fs/ocfs2/dir.c:1981 ocfs2_lookup_ino_from_name+0xb6/0x110 fs/ocfs2/dir.c:2003 ocfs2_lookup+0x30a/0xd40 fs/ocfs2/namei.c:122 lookup_open fs/namei.c:3627 [inline] open_last_lookups fs/namei.c:3748 [inline] path_openat+0x145a/0x3870 fs/namei.c:3984 do_filp_open+0xe9/0x1c0 fs/namei.c:4014 do_sys_openat2+0x135/0x1d0 fs/open.c:1402 do_sys_open fs/open.c:1417 [inline] __do_sys_openat fs/open.c:1433 [inline] __se_sys_openat fs/open.c:1428 [inline] __x64_sys_openat+0x15d/0x1c0 fs/open.c:1428 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf6/0x210 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f01076903ad Code: c3 e8 a7 2b 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89
f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f01084acfc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f01077cbf80 RCX: 00007f01076903ad
RDX: 0000000000105042 RSI: 0000000020000080 RDI: ffffffffffffff9c
RBP: 00007f01077cbf80 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000000
R13: 00007f01077cbf80 R14: 00007f010764fc90 R15: 00007f010848d000
</TASK> ==================================================================
And a general protection fault in ocfs2_prepare_dir_for_insert:
==================================================================
loop0: detected capacity change from 0 to 32768
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data mode.
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 0 UID: 0 PID: 5096 Comm: syz-executor792 Not tainted 6.11.0-rc4-syzkaller-00002-gb0da640826ba #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 RIP: 0010:ocfs2_find_dir_space_id fs/ocfs2/dir.c:3406 [inline] RIP: 0010:ocfs2_prepare_dir_for_insert+0x3309/0x5c70 fs/ocfs2/dir.c:4280 Code: 00 00 e8 2a 25 13 fe e9 ba 06 00 00 e8 20 25 13 fe e9 4f 01 00 00 e8 16 25 13 fe 49 8d 7f 08 49 8d 5f 09 48 89 f8 48 c1 e8 03 <42> 0f b6 04 20 84 c0 0f 85 bd 23 00 00 48 89 d8 48 c1 e8 03 42 0f RSP: 0018:ffffc9000af9f020 EFLAGS: 00010202 RAX: 0000000000000001 RBX: 0000000000000009 RCX: ffff88801e27a440 RDX: 0000000000000000 RSI: 0000000000000400 RDI: 0000000000000008 RBP: ffffc9000af9f830 R08: ffffffff8380395b R09: ffffffff838090a7 R10: 0000000000000002 R11: ffff88801e27a440 R12: dffffc0000000000 R13: ffff88803c660878 R14: f700000000000088 R15: 0000000000000000 FS: 000055555a677380(0000) GS:ffff888020800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000560bce569178 CR3: 000000001de5a000 CR4: 0000000000350ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ocfs2_mknod+0xcaf/0x2b40 fs/ocfs2/namei.c:292 vfs_mknod+0x36d/0x3b0 fs/namei.c:4088 do_mknodat+0x3ec/0x5b0 __do_sys_mknodat fs/namei.c:4166 [inline] __se_sys_mknodat fs/namei.c:4163 [inline] __x64_sys_mknodat+0xa7/0xc0 fs/namei.c:4163 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f2dafda3a99 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 48 89
f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe336a6658 EFLAGS: 00000246 ORIG_RAX:
0000000000000103
RAX: ffffffffffffffda RBX: 0000000000000000 RCX:00007f2dafda3a99
RDX: 00000000000021c0 RSI: 0000000020000040 RDI:00000000ffffff9c
RBP: 00007f2dafe1b5f0 R08: 0000000000004480 R09:000055555a6784c0
R10: 0000000000000103 R11: 0000000000000246 R12:00007ffe336a6680
R13: 00007ffe336a68a8 R14: 431bde82d7b634db R15:00007f2dafdec03b
</TASK> ==================================================================
The two reports are all caused invalid negative i_size of dir inode. For ocfs2, dir_inode can't be negative or zero.
Here add a check in which is called by ocfs2_check_dir_for_entry(). It fixes the second report as ocfs2_check_dir_for_entry() must be called before ocfs2_prepare_dir_for_insert(). Also set a up limit for dir with OCFS2_INLINE_DATA_FL. The i_size can't be great than blocksize.
--- fs/ocfs2/dir.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
fs/ocfs2/dir.c +21 -4
@@ -1065,26 +1065,39 @@ int ocfs2_find_entry(const char *name, i {struct buffer_head *bh;struct ocfs2_dir_entry *res_dir =NULL ; +int ret =0 ;if (ocfs2_dir_indexed (dir))return ocfs2_find_entry_dx (name, namelen, dir, lookup); +if (unlikely (i_size_read (dir) <=0 )) { + ret = -EFSCORRUPTED ; +mlog_errno (ret); + goto out; + }/* * The unindexed dir code only uses part of the lookup * structure, so there's no reason to push it down further * than this. */ -if (OCFS2_I (dir)->ip_dyn_features &OCFS2_INLINE_DATA_FL ) +if (OCFS2_I (dir)->ip_dyn_features &OCFS2_INLINE_DATA_FL ) { +if (unlikely (i_size_read (dir) > dir->i_sb->s_blocksize)) { + ret = -EFSCORRUPTED ; +mlog_errno (ret); + goto out; + } bh =ocfs2_find_entry_id (name, namelen, dir, &res_dir); -else + }else { bh =ocfs2_find_entry_el (name, namelen, dir, &res_dir); + }if (bh ==NULL )return -ENOENT ; lookup->dl_leaf_bh = bh; lookup->dl_entry = res_dir; -return 0 ; +out: +return ret; }/*
@@ -2011,6 +2024,7 @@ int ocfs2_lookup_ino_from_name(struct in* * Return 0 if the name does not exist * Return -EEXIST if the directory contains the name +* Return -EFSCORRUPTED if found corruption * * Callers should have i_mutex + a cluster lock on dir */
@@ -2024,9 +2038,12 @@ int ocfs2_check_dir_for_entry(struct inotrace_ocfs2_check_dir_for_entry ( (unsigned long long )OCFS2_I (dir)->ip_blkno, namelen, name); -if (ocfs2_find_entry (name, namelen, dir, &lookup) ==0 ) { + ret =ocfs2_find_entry (name, namelen, dir, &lookup); +if (ret ==0 ) { ret = -EEXIST ;mlog_errno (ret); + }else if (ret == -ENOENT ) { + ret =0 ; }ocfs2_free_dir_lookup_result (&lookup);
Greg Kroah-Hartman
maintainerPATCH 333/620 mptcp: prevent excessive coalescing on receive
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 56b824eb49d6258aa0bad09a406ceac3f643cdae upstream.
Currently the skb size after coalescing is only limited by the skb layout (the skb must not carry frag_list). A single coalesced skb covering several MSS can potentially fill completely the receive buffer. In such a case, the snd win will zero until the receive buffer will be empty again, affecting tput badly.
--- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
@@ -133,6 +133,7 @@ static bool mptcp_try_coalesce(struct soint delta;if (MPTCP_SKB_CB (from)->offset || + ((to->len + from->len) > (sk->sk_rcvbuf >>3 )) || !skb_try_coalesce (to, from, &fragstolen, &delta))return false;
Greg Kroah-Hartman
maintainerPATCH 334/620 tty: xilinx_uartps: split sysrq handling
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Anderson <[email protected]>
commit b06f388994500297bb91be60ffaf6825ecfd2afe upstream.
lockdep detects the following circular locking dependency:
CPU 0 CPU 1
========================== ============================cdns_uart_isr() printk()
uart_port_lock(port) console_lock()
cdns_uart_console_write()
if (!port->sysrq)
uart_port_lock(port)
uart_handle_break()
port->sysrq = ... uart_handle_sysrq_char()
printk()
console_lock()
The fixed commit attempts to avoid this situation by only taking the port lock in cdns_uart_console_write if port->sysrq unset. However, if (as shown above) cdns_uart_console_write runs before port->sysrq is set, then it will try to take the port lock anyway. This may result in a deadlock.
Fix this by splitting sysrq handling into two parts. We use the prepare helper under the port lock and defer handling until we release the lock.
--- drivers/tty/serial/xilinx_uartps.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/tty/serial/xilinx_uartps.c +4 -6
@@ -268,7 +268,7 @@ static void cdns_uart_handle_rx(void *decontinue ; } -if (uart_handle_sysrq_char (port, data)) +if (uart_prepare_sysrq_char (port, data))continue ;if (is_rxbs_support) {
@@ -385,7 +385,7 @@ static irqreturn_t cdns_uart_isr(int irq !(readl(port->membase + CDNS_UART_CR) & CDNS_UART_CR_RX_DIS))cdns_uart_handle_rx (dev_id, isrstatus); -spin_unlock (&port->lock); +uart_unlock_and_check_sysrq (port);return IRQ_HANDLED ; }
@@ -1217,10 +1217,8 @@ static void cdns_uart_console_write(struunsigned int imr, ctrl;int locked =1 ; -if (port->sysrq) - locked =0 ; -else if (oops_in_progress) - locked =spin_trylock_irqsave (&port->lock, flags); +if (oops_in_progress) + locked =uart_port_trylock_irqsave (port, &flags);else spin_lock_irqsave (&port->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 335/620 nfsd: clear acl_access/acl_default after releasing them
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Lingfeng <[email protected]>
commit 7faf14a7b0366f153284db0ad3347c457ea70136 upstream.
If getting acl_default fails, acl_access and acl_default will be released simultaneously. However, acl_access will still retain a pointer pointing to the released posix_acl, which will trigger a WARNING in nfs3svc_release_getacl like this:
------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 26 PID: 3199 at lib/refcount.c:28 refcount_warn_saturate+0xb5/0x170 Modules linked in: CPU: 26 UID: 0 PID: 3199 Comm: nfsd Not tainted 6.12.0-rc6-00079-g04ae226af01f-dirty #8 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 RIP: 0010:refcount_warn_saturate+0xb5/0x170 Code: cc cc 0f b6 1d b3 20 a5 03 80 fb 01 0f 87 65 48 d8 00 83 e3 01 75 e4 48 c7 c7 c0 3b 9b 85 c6 05 97 20 a5 03 01 e8 fb 3e 30 ff <0f> 0b eb cd 0f b6 1d 8a3 RSP: 0018:ffffc90008637cd8 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff83904fde RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffff88871ed36380 RBP: ffff888158beeb40 R08: 0000000000000001 R09: fffff520010c6f56 R10: ffffc90008637ab7 R11: 0000000000000001 R12: 0000000000000001 R13: ffff888140e77400 R14: ffff888140e77408 R15: ffffffff858b42c0 FS: 0000000000000000(0000) GS:ffff88871ed00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000562384d32158 CR3: 000000055cc6a000 CR4: 00000000000006f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ? refcount_warn_saturate+0xb5/0x170 ? __warn+0xa5/0x140 ? refcount_warn_saturate+0xb5/0x170 ? report_bug+0x1b1/0x1e0 ? handle_bug+0x53/0xa0 ? exc_invalid_op+0x17/0x40 ? asm_exc_invalid_op+0x1a/0x20 ? tick_nohz_tick_stopped+0x1e/0x40 ? refcount_warn_saturate+0xb5/0x170 ? refcount_warn_saturate+0xb5/0x170 nfs3svc_release_getacl+0xc9/0xe0 svc_process_common+0x5db/0xb60 ? __pfx_svc_process_common+0x10/0x10 ? __rcu_read_unlock+0x69/0xa0 ? __pfx_nfsd_dispatch+0x10/0x10 ? svc_xprt_received+0xa1/0x120 ? xdr_init_decode+0x11d/0x190 svc_process+0x2a7/0x330 svc_handle_xprt+0x69d/0x940 svc_recv+0x180/0x2d0 nfsd+0x168/0x200 ? __pfx_nfsd+0x10/0x10 kthread+0x1a2/0x1e0 ? kthread+0xf4/0x1e0 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x34/0x60 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> Kernel panic - not syncing: kernel: panic_on_warn set ...
Clear acl_access/acl_default after posix_acl_release is called to prevent UAF from being triggered.
--- fs/nfsd/nfs2acl.c | 2 ++ fs/nfsd/nfs3acl.c | 2 ++ 2 files changed, 4 insertions(+)
fs/nfsd/nfs2acl.c +2 -0
@@ -84,6 +84,8 @@ out: fail:posix_acl_release (resp->acl_access);posix_acl_release (resp->acl_default); + resp->acl_access =NULL ; + resp->acl_default =NULL ; goto out; }
fs/nfsd/nfs3acl.c +2 -0
@@ -76,6 +76,8 @@ out: fail:posix_acl_release (resp->acl_access);posix_acl_release (resp->acl_default); + resp->acl_access =NULL ; + resp->acl_default =NULL ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 336/620 NFSD: fix hang in nfsd4_shutdown_callback
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dai Ngo <[email protected]>
commit 036ac2778f7b28885814c6fbc07e156ad1624d03 upstream.
If nfs4_client is in courtesy state then there is no point to send the callback. This causes nfsd4_shutdown_callback to hang since cl_cb_inflight is not 0. This hang lasts about 15 minutes until TCP notifies NFSD that the connection was dropped.
This patch modifies nfsd4_run_cb_work to skip the RPC call if nfs4_client is in courtesy state.
--- fs/nfsd/nfs4callback.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/nfsd/nfs4callback.c +5 -2
@@ -1410,8 +1410,11 @@ nfsd4_run_cb_work(struct work_struct *wonfsd4_process_cb_update (cb); clnt = clp->cl_cb_client; -if (!clnt) { -/* Callback channel broken, or client killed; give up: */ +if (!clnt || clp->cl_state ==NFSD4_COURTESY ) { +/* +* Callback channel broken, client killed or +* nfs4_client in courtesy state; give up. +*/ nfsd41_destroy_cb (cb);return ; }
Greg Kroah-Hartman
maintainerPATCH 337/620 HID: multitouch: Add NULL check in mt_input_configured
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Han <[email protected]>
[ Upstream commit 9b8e2220d3a052a690b1d1b23019673e612494c5 ]
devm_kasprintf() can return a NULL pointer on failure,but this returned value in mt_input_configured() is not checked. Add NULL check in mt_input_configured(), to handle kernel NULL pointer dereference error.
--- drivers/hid/hid-multitouch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +4 -1
@@ -1671,9 +1671,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)break ; } -if (suffix) +if (suffix) { hi->input->name =devm_kasprintf (&hdev->dev,GFP_KERNEL ,"%s %s" , hdev->name, suffix); +if (!hi->input->name) +return -ENOMEM ; + }return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 338/620 ndisc: ndisc_send_redirect() must use dev_get_by_index_rcu()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 48145a57d4bbe3496e8e4880b23ea6b511e6e519 ]
ndisc_send_redirect() is called under RCU protection, not RTNL.
It must use dev_get_by_index_rcu() instead of __dev_get_by_index()
--- net/ipv6/ndisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ndisc.c +1 -1
@@ -1619,7 +1619,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)bool ret;if (netif_is_l3_master (skb->dev)) { - dev =__dev_get_by_index (dev_net (skb->dev),IPCB (skb)->iif); + dev =dev_get_by_index_rcu (dev_net (skb->dev),IPCB (skb)->iif);if (!dev)return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 339/620 vrf: use RCU protection in l3mdev_l3_out()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 6d0ce46a93135d96b7fa075a94a88fe0da8e8773 ]
l3mdev_l3_out() can be called without RCU being held:
raw_sendmsg()
ip_push_pending_frames()
ip_send_skb()
ip_local_out()
__ip_local_out()
l3mdev_ip_out()Add rcu_read_lock() / rcu_read_unlock() pair to avoid a potential UAF.
--- include/net/l3mdev.h | 2 ++ 1 file changed, 2 insertions(+)
include/net/l3mdev.h +2 -0
@@ -198,10 +198,12 @@ struct sk_buff *l3mdev_l3_out(struct sock *sk, struct sk_buff *skb, u16 proto)if (netif_is_l3_slave (dev)) {struct net_device *master; +rcu_read_lock (); master =netdev_master_upper_dev_get_rcu (dev);if (master && master->l3mdev_ops->l3mdev_l3_out) skb = master->l3mdev_ops->l3mdev_l3_out (master, sk, skb, proto); +rcu_read_unlock (); }return skb;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 340/620 team: better TEAM_OPTION_TYPE_STRING validation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5bef3ac184b5626ea62385d6b82a1992b89d7940 ]
syzbot reported following splat [1]
Make sure user-provided data contains one nul byte.
[1]
BUG: KMSAN: uninit-value in string_nocheck lib/vsprintf.c:633 [inline] BUG: KMSAN: uninit-value in string+0x3ec/0x5f0 lib/vsprintf.c:714 string_nocheck lib/vsprintf.c:633 [inline] string+0x3ec/0x5f0 lib/vsprintf.c:714 vsnprintf+0xa5d/0x1960 lib/vsprintf.c:2843 __request_module+0x252/0x9f0 kernel/module/kmod.c:149 team_mode_get drivers/net/team/team_core.c:480 [inline] team_change_mode drivers/net/team/team_core.c:607 [inline] team_mode_option_set+0x437/0x970 drivers/net/team/team_core.c:1401 team_option_set drivers/net/team/team_core.c:375 [inline] team_nl_options_set_doit+0x1339/0x1f90 drivers/net/team/team_core.c:2662 genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline] genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0x1214/0x12c0 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x375/0x650 net/netlink/af_netlink.c:2543 genl_rcv+0x40/0x60 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline] netlink_unicast+0xf52/0x1260 net/netlink/af_netlink.c:1348 netlink_sendmsg+0x10da/0x11e0 net/netlink/af_netlink.c:1892 sock_sendmsg_nosec net/socket.c:718 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:733 ____sys_sendmsg+0x877/0xb60 net/socket.c:2573 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2627 __sys_sendmsg net/socket.c:2659 [inline] __do_sys_sendmsg net/socket.c:2664 [inline] __se_sys_sendmsg net/socket.c:2662 [inline] __x64_sys_sendmsg+0x212/0x3c0 net/socket.c:2662 x64_sys_call+0x2ed6/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:47 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- drivers/net/team/team.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/team/team.c +3 -1
@@ -2665,7 +2665,9 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) ctx.data.u32_val =nla_get_u32 (attr_data);break ;case TEAM_OPTION_TYPE_STRING : -if (nla_len (attr_data) >TEAM_STRING_MAX_LEN ) { +if (nla_len (attr_data) >TEAM_STRING_MAX_LEN || + !memchr (nla_data (attr_data),'\0' , +nla_len (attr_data))) { err = -EINVAL ; goto team_put; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 341/620 arm64: cacheinfo: Avoid out-of-bounds write to cacheinfo array
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radu Rendec <[email protected]>
[ Upstream commit 875d742cf5327c93cba1f11e12b08d3cce7a88d2 ]
The loop that detects/populates cache information already has a bounds check on the array size but does not account for cache levels with separate data/instructions cache. Fix this by incrementing the index for any populated leaf (instead of any populated level).
--- arch/arm64/kernel/cacheinfo.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
arch/arm64/kernel/cacheinfo.c +7 -5
@@ -87,16 +87,18 @@ int populate_cache_leaves(unsigned int cpu)unsigned int level, idx;enum cache_type type;struct cpu_cacheinfo *this_cpu_ci =get_cpu_cacheinfo (cpu); -struct cacheinfo *this_leaf = this_cpu_ci->info_list; +struct cacheinfo *infos = this_cpu_ci->info_list;for (idx =0 , level =1 ; level <= this_cpu_ci->num_levels && - idx < this_cpu_ci->num_leaves; idx++, level++) { + idx < this_cpu_ci->num_leaves; level++) { type =get_cache_type (level);if (type ==CACHE_TYPE_SEPARATE ) { -ci_leaf_init (this_leaf++,CACHE_TYPE_DATA , level); -ci_leaf_init (this_leaf++,CACHE_TYPE_INST , level); +if (idx +1 >= this_cpu_ci->num_leaves) +break ; +ci_leaf_init (&infos[idx++],CACHE_TYPE_DATA , level); +ci_leaf_init (&infos[idx++],CACHE_TYPE_INST , level); }else { -ci_leaf_init (this_leaf++, type, level); +ci_leaf_init (&infos[idx++], type, level); } }return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 342/620 drm/i915/selftests: avoid using uninitialized context
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Karas <[email protected]>
[ Upstream commit 53139b3f9998ea07289e7b70b909fea2264a0de9 ]
There is an error path in igt_ppgtt_alloc(), which leads to ww object being passed down to i915_gem_ww_ctx_fini() without initialization. Correct that by only putting ppgtt->vm and returning early.
--- drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +2 -2
@@ -160,7 +160,7 @@ static int igt_ppgtt_alloc(void *arg)return PTR_ERR (ppgtt);if (!ppgtt->vm.allocate_va_range) - goto err_ppgtt_cleanup; + goto ppgtt_vm_put;/* * While we only allocate the page tables here and so we could
@@ -228,7 +228,7 @@ static int igt_ppgtt_alloc(void *arg) goto retry; }i915_gem_ww_ctx_fini (&ww); - +ppgtt_vm_put:i915_vm_put (&ppgtt->vm);return err; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 343/620 gpio: bcm-kona: Fix GPIO lock/unlock for banks above bank 0
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Weber <[email protected]>
[ Upstream commit de1d0d160f64ee76df1d364d521b2faf465a091c ]
The GPIO lock/unlock functions clear/write a bit to the relevant register for each bank. However, due to an oversight the bit that was being written was based on the total GPIO number, not the index of the GPIO within the relevant bank, causing it to fail for any GPIO above 32 (thus any GPIO for banks above bank 0).
Fix lock/unlock for these banks by using the correct bit.
--- drivers/gpio/gpio-bcm-kona.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpio/gpio-bcm-kona.c +4 -2
@@ -93,11 +93,12 @@ static void bcm_kona_gpio_lock_gpio(struct bcm_kona_gpio *kona_gpio,u32 val;unsigned long flags;int bank_id =GPIO_BANK (gpio); +int bit =GPIO_BIT (gpio);raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val |=BIT (gpio); + val |=BIT (bit);bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val);raw_spin_unlock_irqrestore (&kona_gpio->lock, flags);
@@ -109,11 +110,12 @@ static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,u32 val;unsigned long flags;int bank_id =GPIO_BANK (gpio); +int bit =GPIO_BIT (gpio);raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val &= ~BIT (gpio); + val &= ~BIT (bit);bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val);raw_spin_unlock_irqrestore (&kona_gpio->lock, flags);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 344/620 gpio: bcm-kona: Make sure GPIO bits are unlocked when requesting IRQ
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Weber <[email protected]>
[ Upstream commit 57f5db77a915cc29461a679a6bcae7097967be1a ]
The settings for all GPIOs are locked by default in bcm_kona_gpio_reset. The settings for a GPIO are unlocked when requesting it as a GPIO, but not when requesting it as an interrupt, causing the IRQ settings to not get applied.
Fix this by making sure to unlock the right bits when an IRQ is requested. To avoid a situation where an IRQ being released causes a lock despite the same GPIO being used by a GPIO request or vice versa, add an unlock counter and only lock if it reaches 0.
--- drivers/gpio/gpio-bcm-kona.c | 67 +++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 12 deletions(-)
drivers/gpio/gpio-bcm-kona.c +55 -12
@@ -76,6 +76,22 @@ struct bcm_kona_gpio {struct bcm_kona_gpio_bank {int id;int irq; +/* +* Used to keep track of lock/unlock operations for each GPIO in the +* bank. +* +* All GPIOs are locked by default (see bcm_kona_gpio_reset), and the +* unlock count for all GPIOs is 0 by default. Each unlock increments +* the counter, and each lock decrements the counter. +* +* The lock function only locks the GPIO once its unlock counter is +* down to 0. This is necessary because the GPIO is unlocked in two +* places in this driver: once for requested GPIOs, and once for +* requested IRQs. Since it is possible for a GPIO to be requested +* as both a GPIO and an IRQ, we need to ensure that we don't lock it +* too early. +*/ +u8 gpio_unlock_count[GPIO_PER_BANK ];/* Used in the interrupt handler */ struct bcm_kona_gpio *kona_gpio; };
@@ -94,14 +110,23 @@ static void bcm_kona_gpio_lock_gpio(struct bcm_kona_gpio *kona_gpio,unsigned long flags;int bank_id =GPIO_BANK (gpio);int bit =GPIO_BIT (gpio); +struct bcm_kona_gpio_bank *bank = &kona_gpio->banks[bank_id]; -raw_spin_lock_irqsave (&kona_gpio->lock, flags); +if (bank->gpio_unlock_count[bit] ==0 ) { +dev_err (kona_gpio->gpio_chip.parent, +"Unbalanced locks for GPIO %u\n" , gpio); +return ; + } - val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val |=BIT (bit); -bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); +if (--bank->gpio_unlock_count[bit] ==0 ) { +raw_spin_lock_irqsave (&kona_gpio->lock, flags); -raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); + val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); + val |=BIT (bit); +bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); + +raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); + } } static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,
@@ -111,14 +136,19 @@ static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,unsigned long flags;int bank_id =GPIO_BANK (gpio);int bit =GPIO_BIT (gpio); +struct bcm_kona_gpio_bank *bank = &kona_gpio->banks[bank_id]; -raw_spin_lock_irqsave (&kona_gpio->lock, flags); +if (bank->gpio_unlock_count[bit] ==0 ) { +raw_spin_lock_irqsave (&kona_gpio->lock, flags); - val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val &= ~BIT (bit); -bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); + val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); + val &= ~BIT (bit); +bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); -raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); +raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); + } + + ++bank->gpio_unlock_count[bit]; }static int bcm_kona_gpio_get_dir (struct gpio_chip *chip,unsigned gpio)
@@ -369,6 +399,7 @@ static void bcm_kona_gpio_irq_mask(struct irq_data *d) kona_gpio =irq_data_get_irq_chip_data (d); reg_base = kona_gpio->reg_base; +raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (reg_base +GPIO_INT_MASK (bank_id));
@@ -391,6 +422,7 @@ static void bcm_kona_gpio_irq_unmask(struct irq_data *d) kona_gpio =irq_data_get_irq_chip_data (d); reg_base = kona_gpio->reg_base; +raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (reg_base +GPIO_INT_MSKCLR (bank_id));
@@ -486,15 +518,26 @@ static void bcm_kona_gpio_irq_handler(struct irq_desc *desc)static int bcm_kona_gpio_irq_reqres (struct irq_data *d) {struct bcm_kona_gpio *kona_gpio =irq_data_get_irq_chip_data (d); +unsigned int gpio = d->hwirq; + +/* +* We need to unlock the GPIO before any other operations are performed +* on the relevant GPIO configuration registers +*/ +bcm_kona_gpio_unlock_gpio (kona_gpio, gpio); -return gpiochip_reqres_irq (&kona_gpio->gpio_chip, d->hwirq); +return gpiochip_reqres_irq (&kona_gpio->gpio_chip, gpio); }static void bcm_kona_gpio_irq_relres (struct irq_data *d) {struct bcm_kona_gpio *kona_gpio =irq_data_get_irq_chip_data (d); +unsigned int gpio = d->hwirq; + +/* Once we no longer use it, lock the GPIO again */ +bcm_kona_gpio_lock_gpio (kona_gpio, gpio); -gpiochip_relres_irq (&kona_gpio->gpio_chip, d->hwirq); +gpiochip_relres_irq (&kona_gpio->gpio_chip, gpio); }static struct irq_chip bcm_gpio_irq_chip = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 345/620 gpio: bcm-kona: Add missing newline to dev_err format string
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Weber <[email protected]>
[ Upstream commit 615279db222c3ac56d5c93716efd72b843295c1f ]
Add a missing newline to the format string of the "Couldn't get IRQ for bank..." error message.
--- drivers/gpio/gpio-bcm-kona.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-bcm-kona.c +1 -1
@@ -675,7 +675,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev) bank->irq =platform_get_irq (pdev, i); bank->kona_gpio = kona_gpio;if (bank->irq <0 ) { -dev_err (dev,"Couldn't get IRQ for bank %d" , i); +dev_err (dev,"Couldn't get IRQ for bank %d\n" , i); ret = -ENOENT ; goto err_irq_domain; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 346/620 xen: remove a confusing comment on auto-translated guest I/O
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Tesarik <[email protected]>
[ Upstream commit d826c9e61c99120f8996f8fed6417167e32eb922 ]
After removing the conditional return from xen_create_contiguous_region(), the accompanying comment was left in place, but it now precedes an unrelated conditional and confuses readers.
Stable-dep-of: e93ec87286bd ("x86/xen: allow larger contiguous memory regions in PV guests")
--- arch/x86/xen/mmu_pv.c | 6 ------ 1 file changed, 6 deletions(-)
arch/x86/xen/mmu_pv.c +0 -6
@@ -2276,12 +2276,6 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,int success;unsigned long vstart = (unsigned long )phys_to_virt (pstart); -/* -* Currently an auto-translated guest will not perform I/O, nor will -* it require PAE page directories below 4GB. Therefore any calls to -* this function are redundant and can be ignored. -*/ -if (unlikely (order >MAX_CONTIG_ORDER ))return -ENOMEM ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 347/620 x86/xen: allow larger contiguous memory regions in PV guests
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit e93ec87286bd1fd30b7389e7a387cfb259f297e3 ]
Today a PV guest (including dom0) can create 2MB contiguous memory regions for DMA buffers at max. This has led to problems at least with the megaraid_sas driver, which wants to allocate a 2.3MB DMA buffer.
The limiting factor is the frame array used to do the hypercall for making the memory contiguous, which has 512 entries and is just a static array in mmu_pv.c.
In order to not waste memory for non-PV guests, put the initial frame array into .init.data section and dynamically allocate an array from the .init_after_bootmem hook of PV guests.
In case a contiguous memory area larger than the initially supported 2MB is requested, allocate a larger buffer for the frame list. Note that such an allocation is tried only after memory management has been initialized properly, which is tested via a flag being set in the .init_after_bootmem hook.
--- arch/x86/xen/mmu_pv.c | 71 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 62 insertions(+), 9 deletions(-)
arch/x86/xen/mmu_pv.c +62 -9
@@ -95,6 +95,51 @@ static pud_t level3_user_vsyscall[PTRS_PER_PUD] __page_aligned_bss;*/ static DEFINE_SPINLOCK (xen_reservation_lock); +/* Protected by xen_reservation_lock. */ +#define MIN_CONTIG_ORDER 9/* 2MB */ +static unsigned int discontig_frames_order =MIN_CONTIG_ORDER ; +static unsigned long discontig_frames_early[1UL <<MIN_CONTIG_ORDER ]__initdata ; +static unsigned long *discontig_frames__refdata = discontig_frames_early; +static bool discontig_frames_dyn; + +static int alloc_discontig_frames (unsigned int order) +{ +unsigned long *new_array, *old_array; +unsigned int old_order; +unsigned long flags; + +BUG_ON (order <MIN_CONTIG_ORDER ); +BUILD_BUG_ON (sizeof (discontig_frames_early) !=PAGE_SIZE ); + + new_array = (unsigned long *)__get_free_pages (GFP_KERNEL , + order -MIN_CONTIG_ORDER ); +if (!new_array) +return -ENOMEM ; + +spin_lock_irqsave (&xen_reservation_lock, flags); + + old_order = discontig_frames_order; + +if (order > discontig_frames_order || !discontig_frames_dyn) { +if (!discontig_frames_dyn) + old_array =NULL ; +else + old_array = discontig_frames; + + discontig_frames = new_array; + discontig_frames_order = order; + discontig_frames_dyn = true; + }else { + old_array = new_array; + } + +spin_unlock_irqrestore (&xen_reservation_lock, flags); + +free_pages ((unsigned long )old_array, old_order -MIN_CONTIG_ORDER ); + +return 0 ; +} +/* * Note about cr3 (pagetable base) values: *
@@ -791,6 +836,9 @@ static void __init xen_after_bootmem(void)static_branch_enable (&xen_struct_pages_ready);SetPagePinned (virt_to_page (level3_user_vsyscall));xen_pgd_walk (&init_mm, xen_mark_pinned,FIXADDR_TOP ); + +if (alloc_discontig_frames (MIN_CONTIG_ORDER )) +BUG (); } static void xen_unpin_page(struct mm_struct *mm, struct page *page,
@@ -2151,10 +2199,6 @@ void __init xen_init_mmu_ops(void)memset (dummy_mapping,0xff ,PAGE_SIZE ); } -/* Protected by xen_reservation_lock. */ -#define MAX_CONTIG_ORDER 9/* 2MB */ -static unsigned long discontig_frames[1 <<MAX_CONTIG_ORDER ]; -#define VOID_PTE (mfn_pte(0, __pgprot(0))) static void xen_zap_pfn_range(unsigned long vaddr, unsigned int order, unsigned long *in_frames,
@@ -2271,18 +2315,25 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,unsigned int address_bits, dma_addr_t *dma_handle) { - unsigned long *in_frames = discontig_frames, out_frame; + unsigned long *in_frames, out_frame;unsigned long flags;int success;unsigned long vstart = (unsigned long )phys_to_virt (pstart); -if (unlikely (order >MAX_CONTIG_ORDER )) -return -ENOMEM ; +if (unlikely (order > discontig_frames_order)) { +if (!discontig_frames_dyn) +return -ENOMEM ; + +if (alloc_discontig_frames (order)) +return -ENOMEM ; + }memset ((void *) vstart,0 ,PAGE_SIZE << order);spin_lock_irqsave (&xen_reservation_lock, flags); + in_frames = discontig_frames; +/* 1. Zap current PTEs, remembering MFNs. */ xen_zap_pfn_range (vstart, order, in_frames,NULL );
@@ -2306,12 +2357,12 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,void xen_destroy_contiguous_region (phys_addr_t pstart,unsigned int order) { -unsigned long *out_frames = discontig_frames, in_frame; +unsigned long *out_frames, in_frame;unsigned long flags;int success;unsigned long vstart; -if (unlikely (order >MAX_CONTIG_ORDER )) +if (unlikely (order > discontig_frames_order))return ; vstart = (unsigned long )phys_to_virt (pstart);
@@ -2319,6 +2370,8 @@ void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)spin_lock_irqsave (&xen_reservation_lock, flags); + out_frames = discontig_frames; +/* 1. Find start MFN of contiguous extent. */ in_frame =virt_to_mfn (vstart);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 348/620 media: cxd2841er: fix 64-bit division on gcc-9
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 8d46603eeeb4c6abff1d2e49f2a6ae289dac765e ]
It appears that do_div() once more gets confused by a complex expression that ends up not quite being constant despite __builtin_constant_p() thinking it is:
ERROR: modpost: "__aeabi_uldivmod" [drivers/media/dvb-frontends/cxd2841er.ko] undefined!
Use div_u64() instead, forcing the expression to be evaluated first, and making it a bit more readable.
--- drivers/media/dvb-frontends/cxd2841er.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/media/dvb-frontends/cxd2841er.c +2 -6
@@ -311,12 +311,8 @@ static int cxd2841er_set_reg_bits(struct cxd2841er_priv *priv,static u32 cxd2841er_calc_iffreq_xtal (enum cxd2841er_xtal xtal,u32 ifhz) { -u64 tmp; - - tmp = (u64 ) ifhz *16777216 ; -do_div (tmp, ((xtal ==SONY_XTAL_24000 ) ?48000000 :41000000 )); - -return (u32 ) tmp; +return div_u64 (ifhz *16777216ull , + (xtal ==SONY_XTAL_24000 ) ?48000000 :41000000 ); }static u32 cxd2841er_calc_iffreq (u32 ifhz)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 349/620 media: vidtv: Fix a null-ptr-deref in vidtv_mux_stop_thread
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit 1221989555db711578a327a9367f1be46500cb48 ]
syzbot report a null-ptr-deref in vidtv_mux_stop_thread. [1]
If dvb->mux is not initialized successfully by vidtv_mux_init() in the vidtv_start_streaming(), it will trigger null pointer dereference about mux in vidtv_mux_stop_thread().
Adjust the timing of streaming initialization and check it before stopping it.
[1]
KASAN: null-ptr-deref in range [0x0000000000000128-0x000000000000012f] CPU: 0 UID: 0 PID: 5842 Comm: syz-executor248 Not tainted 6.13.0-rc4-syzkaller-00012-g9b2ffa6148b1 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 RIP: 0010:vidtv_mux_stop_thread+0x26/0x80 drivers/media/test-drivers/vidtv/vidtv_mux.c:471 Code: 90 90 90 90 66 0f 1f 00 55 53 48 89 fb e8 82 2e c8 f9 48 8d bb 28 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 02 7e 3b 0f b6 ab 28 01 00 00 31 ff 89 ee e8 RSP: 0018:ffffc90003f2faa8 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff87cfb125 RDX: 0000000000000025 RSI: ffffffff87d120ce RDI: 0000000000000128 RBP: ffff888029b8d220 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000003 R12: ffff888029b8d188 R13: ffffffff8f590aa0 R14: ffffc9000581c5c8 R15: ffff888029a17710 FS: 00007f7eef5156c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f7eef5e635c CR3: 0000000076ca6000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> vidtv_stop_streaming drivers/media/test-drivers/vidtv/vidtv_bridge.c:209 [inline] vidtv_stop_feed+0x151/0x250 drivers/media/test-drivers/vidtv/vidtv_bridge.c:252 dmx_section_feed_stop_filtering+0x90/0x160 drivers/media/dvb-core/dvb_demux.c:1000 dvb_dmxdev_feed_stop.isra.0+0x1ee/0x270 drivers/media/dvb-core/dmxdev.c:486 dvb_dmxdev_filter_stop+0x22a/0x3a0 drivers/media/dvb-core/dmxdev.c:559 dvb_dmxdev_filter_free drivers/media/dvb-core/dmxdev.c:840 [inline] dvb_demux_release+0x92/0x550 drivers/media/dvb-core/dmxdev.c:1246 __fput+0x3f8/0xb60 fs/file_table.c:450 task_work_run+0x14e/0x250 kernel/task_work.c:239 get_signal+0x1d3/0x2610 kernel/signal.c:2790 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x150/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- drivers/media/test-drivers/vidtv/vidtv_bridge.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/test-drivers/vidtv/vidtv_bridge.c +7 -1
@@ -191,10 +191,11 @@ static int vidtv_start_streaming(struct vidtv_dvb *dvb) mux_args.mux_buf_sz = mux_buf_sz; - dvb->streaming = true; dvb->mux =vidtv_mux_init (dvb->fe[0 ], dev, &mux_args);if (!dvb->mux)return -ENOMEM ; + + dvb->streaming = true;vidtv_mux_start_thread (dvb->mux);dev_dbg_ratelimited (dev,"Started streaming\n" );
@@ -205,6 +206,11 @@ static int vidtv_stop_streaming(struct vidtv_dvb *dvb) {struct device *dev = &dvb->pdev->dev; +if (!dvb->streaming) { +dev_warn_ratelimited (dev,"No streaming. Skipping.\n" ); +return 0 ; + } + dvb->streaming = false;vidtv_mux_stop_thread (dvb->mux);vidtv_mux_destroy (dvb->mux);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 350/620 PCI/DPC: Quirk PIO log size for Intel Raptor Lake-P
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit b198499c7d2508a76243b98e7cca992f6fd2b7f7 ]
Apparently the Raptor Lake-P reference firmware configures the PIO log size correctly, but some vendor BIOSes, including at least ASUSTeK COMPUTER INC. Zenbook UX3402VA_UX3402VA, do not.
Apply the quirk for Raptor Lake-P. This prevents kernel complaints like:
DPC: RP PIO log size 0 is invalid
and also enables the DPC driver to dump the RP PIO Log registers when DPC is triggered.
Note that the bug report also mentions 8086:a76e, which has been already added by 627c6db20703 ("PCI/DPC: Quirk PIO log size for Intel Raptor Lake Root Ports").
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -6005,6 +6005,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a2b, dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x9a2d , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x9a2f , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x9a31 , dpc_log_size); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0xa72f , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0xa73f , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0xa76e , dpc_log_size);#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 351/620 vfio/pci: Enable iowrite64 and ioread64 for vfio pci
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ramesh Thomas <[email protected]>
[ Upstream commit 2b938e3db335e3670475e31a722c2bee34748c5a ]
Definitions of ioread64 and iowrite64 macros in asm/io.h called by vfio pci implementations are enclosed inside check for CONFIG_GENERIC_IOMAP. They don't get defined if CONFIG_GENERIC_IOMAP is defined. Include linux/io-64-nonatomic-lo-hi.h to define iowrite64 and ioread64 macros when they are not defined. io-64-nonatomic-lo-hi.h maps the macros to generic implementation in lib/iomap.c. The generic implementation does 64 bit rw if readq/writeq is defined for the architecture, otherwise it would do 32 bit back to back rw.
Note that there are two versions of the generic implementation that differs in the order the 32 bit words are written if 64 bit support is not present. This is not the little/big endian ordering, which is handled separately. This patch uses the lo followed by hi word ordering which is consistent with current back to back implementation in the vfio/pci code.
--- drivers/vfio/pci/vfio_pci_rdwr.c | 1 + 1 file changed, 1 insertion(+)
drivers/vfio/pci/vfio_pci_rdwr.c +1 -0
@@ -16,6 +16,7 @@#include <linux/io.h> #include <linux/vfio.h> #include <linux/vgaarb.h> +#include <linux/io-64-nonatomic-lo-hi.h> #include <linux/vfio_pci_core.h>
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 352/620 Grab mm lock before grabbing pt lock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maksym Planeta <[email protected]>
[ Upstream commit 6d002348789bc16e9203e9818b7a3688787e3b29 ]
Function xen_pin_page calls xen_pte_lock, which in turn grab page table lock (ptlock). When locking, xen_pte_lock expect mm->page_table_lock to be held before grabbing ptlock, but this does not happen when pinning is caused by xen_mm_pin_all.
This commit addresses lockdep warning below, which shows up when suspending a Xen VM.
[ 3680.658422] Freezing user space processes
[ 3680.660156] Freezing user space processes completed (elapsed 0.001 seconds)
[ 3680.660182] OOM killer disabled.
[ 3680.660192] Freezing remaining freezable tasks
[ 3680.661485] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[ 3680.685254]
[ 3680.685265] ==================================
[ 3680.685269] WARNING: Nested lock was not taken
[ 3680.685274] 6.12.0+ #16 Tainted: G W
[ 3680.685279] ----------------------------------
[ 3680.685283] migration/0/19 is trying to lock:
[ 3680.685288] ffff88800bac33c0 (ptlock_ptr(ptdesc)#2){+.+.}-{3:3}, at: xen_pin_page+0x175/0x1d0
[ 3680.685303]
[ 3680.685303] but this task is not holding:
[ 3680.685308] init_mm.page_table_lock
[ 3680.685311]
[ 3680.685311] stack backtrace:
[ 3680.685316] CPU: 0 UID: 0 PID: 19 Comm: migration/0 Tainted: G W 6.12.0+ #16
[ 3680.685324] Tainted: [W]=WARN
[ 3680.685328] Stopper: multi_cpu_stop+0x0/0x120 <- __stop_cpus.constprop.0+0x8c/0xd0
[ 3680.685339] Call Trace:
[ 3680.685344] <TASK>
[ 3680.685347] dump_stack_lvl+0x77/0xb0
[ 3680.685356] __lock_acquire+0x917/0x2310
[ 3680.685364] lock_acquire+0xce/0x2c0
[ 3680.685369] ? xen_pin_page+0x175/0x1d0
[ 3680.685373] _raw_spin_lock_nest_lock+0x2f/0x70
[ 3680.685381] ? xen_pin_page+0x175/0x1d0
[ 3680.685386] xen_pin_page+0x175/0x1d0
[ 3680.685390] ? __pfx_xen_pin_page+0x10/0x10
[ 3680.685394] __xen_pgd_walk+0x233/0x2c0
[ 3680.685401] ? stop_one_cpu+0x91/0x100
[ 3680.685405] __xen_pgd_pin+0x5d/0x250
[ 3680.685410] xen_mm_pin_all+0x70/0xa0
[ 3680.685415] xen_pv_pre_suspend+0xf/0x280
[ 3680.685420] xen_suspend+0x57/0x1a0
[ 3680.685428] multi_cpu_stop+0x6b/0x120
[ 3680.685432] ? update_cpumasks_hier+0x7c/0xa60
[ 3680.685439] ? __pfx_multi_cpu_stop+0x10/0x10
[ 3680.685443] cpu_stopper_thread+0x8c/0x140
[ 3680.685448] ? smpboot_thread_fn+0x20/0x1f0
[ 3680.685454] ? __pfx_smpboot_thread_fn+0x10/0x10
[ 3680.685458] smpboot_thread_fn+0xed/0x1f0
[ 3680.685462] kthread+0xde/0x110
[ 3680.685467] ? __pfx_kthread+0x10/0x10
[ 3680.685471] ret_from_fork+0x2f/0x50
[ 3680.685478] ? __pfx_kthread+0x10/0x10
[ 3680.685482] ret_from_fork_asm+0x1a/0x30
[ 3680.685489] </TASK>
[ 3680.685491]
[ 3680.685491] other info that might help us debug this:
[ 3680.685497] 1 lock held by migration/0/19:
[ 3680.685500] #0: ffffffff8284df38 (pgd_lock){+.+.}-{3:3}, at: xen_mm_pin_all+0x14/0xa0
[ 3680.685512]
[ 3680.685512] stack backtrace:
[ 3680.685518] CPU: 0 UID: 0 PID: 19 Comm: migration/0 Tainted: G W 6.12.0+ #16
[ 3680.685528] Tainted: [W]=WARN
[ 3680.685531] Stopper: multi_cpu_stop+0x0/0x120 <- __stop_cpus.constprop.0+0x8c/0xd0
[ 3680.685538] Call Trace:
[ 3680.685541] <TASK>
[ 3680.685544] dump_stack_lvl+0x77/0xb0
[ 3680.685549] __lock_acquire+0x93c/0x2310
[ 3680.685554] lock_acquire+0xce/0x2c0
[ 3680.685558] ? xen_pin_page+0x175/0x1d0
[ 3680.685562] _raw_spin_lock_nest_lock+0x2f/0x70
[ 3680.685568] ? xen_pin_page+0x175/0x1d0
[ 3680.685572] xen_pin_page+0x175/0x1d0
[ 3680.685578] ? __pfx_xen_pin_page+0x10/0x10
[ 3680.685582] __xen_pgd_walk+0x233/0x2c0
[ 3680.685588] ? stop_one_cpu+0x91/0x100
[ 3680.685592] __xen_pgd_pin+0x5d/0x250
[ 3680.685596] xen_mm_pin_all+0x70/0xa0
[ 3680.685600] xen_pv_pre_suspend+0xf/0x280
[ 3680.685607] xen_suspend+0x57/0x1a0
[ 3680.685611] multi_cpu_stop+0x6b/0x120
[ 3680.685615] ? update_cpumasks_hier+0x7c/0xa60
[ 3680.685620] ? __pfx_multi_cpu_stop+0x10/0x10
[ 3680.685625] cpu_stopper_thread+0x8c/0x140
[ 3680.685629] ? smpboot_thread_fn+0x20/0x1f0
[ 3680.685634] ? __pfx_smpboot_thread_fn+0x10/0x10
[ 3680.685638] smpboot_thread_fn+0xed/0x1f0
[ 3680.685642] kthread+0xde/0x110
[ 3680.685645] ? __pfx_kthread+0x10/0x10
[ 3680.685649] ret_from_fork+0x2f/0x50
[ 3680.685654] ? __pfx_kthread+0x10/0x10
[ 3680.685657] ret_from_fork_asm+0x1a/0x30
[ 3680.685662] </TASK>
[ 3680.685267] xen:grant_table: Grant tables using version 1 layout
[ 3680.685921] OOM killer enabled.
[ 3680.685934] Restarting tasks ... done.Message-ID: <[email protected]>
--- arch/x86/xen/mmu_pv.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/xen/mmu_pv.c +4 -0
@@ -807,6 +807,7 @@ void xen_mm_pin_all(void) {struct page *page; +spin_lock (&init_mm.page_table_lock);spin_lock (&pgd_lock);list_for_each_entry (page, &pgd_list, lru) {
@@ -817,6 +818,7 @@ void xen_mm_pin_all(void) }spin_unlock (&pgd_lock); +spin_unlock (&init_mm.page_table_lock); } static void __init xen_mark_pinned(struct mm_struct *mm, struct page *page,
@@ -914,6 +916,7 @@ void xen_mm_unpin_all(void) {struct page *page; +spin_lock (&init_mm.page_table_lock);spin_lock (&pgd_lock);list_for_each_entry (page, &pgd_list, lru) {
@@ -925,6 +928,7 @@ void xen_mm_unpin_all(void) }spin_unlock (&pgd_lock); +spin_unlock (&init_mm.page_table_lock); }static void xen_activate_mm (struct mm_struct *prev,struct mm_struct *next)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 353/620 x86/mm/tlb: Only trim the mm_cpumask once a second
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rik van Riel <[email protected]>
[ Upstream commit 6db2526c1d694c91c6e05e2f186c085e9460f202 ]
Setting and clearing CPU bits in the mm_cpumask is only ever done by the CPU itself, from the context switch code or the TLB flush code.
Synchronization is handled by switch_mm_irqs_off() blocking interrupts.
Sending TLB flush IPIs to CPUs that are in the mm_cpumask, but no longer running the program causes a regression in the will-it-scale tlbflush2 test. This test is contrived, but a large regression here might cause a small regression in some real world workload.
Instead of always sending IPIs to CPUs that are in the mm_cpumask, but no longer running the program, send these IPIs only once a second.
The rest of the time we can skip over CPUs where the loaded_mm is different from the target mm.
--- arch/x86/include/asm/mmu.h | 2 ++ arch/x86/include/asm/mmu_context.h | 1 + arch/x86/include/asm/tlbflush.h | 1 + arch/x86/mm/tlb.c | 35 +++++++++++++++++++++++++++--- 4 files changed, 36 insertions(+), 3 deletions(-)
arch/x86/include/asm/mmu.h +2 -0
@@ -33,6 +33,8 @@ typedef struct {*/ atomic64_t tlb_gen; +unsigned long next_trim_cpumask; +#ifdef CONFIG_MODIFY_LDT_SYSCALL struct rw_semaphore ldt_usr_sem;struct ldt_struct *ldt;
arch/x86/include/asm/mmu_context.h +1 -0
@@ -106,6 +106,7 @@ static inline int init_new_context(struct task_struct *tsk, mm->context.ctx_id =atomic64_inc_return (&last_mm_ctx_id);atomic64_set (&mm->context.tlb_gen,0 ); + mm->context.next_trim_cpumask = jiffies +HZ ;#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS if (cpu_feature_enabled (X86_FEATURE_OSPKE )) {
arch/x86/include/asm/tlbflush.h +1 -0
@@ -207,6 +207,7 @@ struct flush_tlb_info {unsigned int initiating_cpu;u8 stride_shift;u8 freed_tables; +u8 trim_cpumask; };void flush_tlb_local (void );
arch/x86/mm/tlb.c +32 -3
@@ -854,9 +854,36 @@ static void flush_tlb_func(void *info) nr_invalidate); } -static bool tlb_is_not_lazy (int cpu,void *data) +static bool should_flush_tlb (int cpu,void *data) { -return !per_cpu (cpu_tlbstate_shared.is_lazy, cpu); +struct flush_tlb_info *info = data; + +/* Lazy TLB will get flushed at the next context switch. */ +if (per_cpu (cpu_tlbstate_shared.is_lazy, cpu)) +return false; + +/* No mm means kernel memory flush. */ +if (!info->mm) +return true; + +/* The target mm is loaded, and the CPU is not lazy. */ +if (per_cpu (cpu_tlbstate.loaded_mm, cpu) == info->mm) +return true; + +/* In cpumask, but not the loaded mm? Periodically remove by flushing. */ +if (info->trim_cpumask) +return true; + +return false; +} + +static bool should_trim_cpumask (struct mm_struct *mm) +{ +if (time_after (jiffies,READ_ONCE (mm->context.next_trim_cpumask))) { +WRITE_ONCE (mm->context.next_trim_cpumask, jiffies +HZ ); +return true; + } +return false; } DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state_shared, cpu_tlbstate_shared);
@@ -890,7 +917,7 @@ STATIC_NOPV void native_flush_tlb_multi(const struct cpumask *cpumask,if (info->freed_tables)on_each_cpu_mask (cpumask, flush_tlb_func, (void *)info, true);else -on_each_cpu_cond_mask (tlb_is_not_lazy, flush_tlb_func, +on_each_cpu_cond_mask (should_flush_tlb, flush_tlb_func, (void *)info,1 , cpumask); }
@@ -941,6 +968,7 @@ static struct flush_tlb_info *get_flush_tlb_info(struct mm_struct *mm, info->freed_tables = freed_tables; info->new_tlb_gen = new_tlb_gen; info->initiating_cpu =smp_processor_id (); + info->trim_cpumask =0 ;return info; }
@@ -983,6 +1011,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,* flush_tlb_func_local() directly in this case. */ if (cpumask_any_but (mm_cpumask (mm), cpu) < nr_cpu_ids) { + info->trim_cpumask =should_trim_cpumask (mm);flush_tlb_multi (mm_cpumask (mm), info); }else if (mm ==this_cpu_read (cpu_tlbstate.loaded_mm)) {lockdep_assert_irqs_enabled ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 354/620 orangefs: fix a oob in orangefs_debug_write
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Marshall <[email protected]>
[ Upstream commit f7c848431632598ff9bce57a659db6af60d75b39 ]
I got a syzbot report: slab-out-of-bounds Read in orangefs_debug_write... several people suggested fixes, I tested Al Viro's suggestion and made this patch.
--- fs/orangefs/orangefs-debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/orangefs/orangefs-debugfs.c +2 -2
@@ -393,9 +393,9 @@ static ssize_t orangefs_debug_write(struct file *file,* Thwart users who try to jamb a ridiculous number * of bytes into the debug file... */ -if (count >ORANGEFS_MAX_DEBUG_STRING_LEN +1 ) { +if (count >ORANGEFS_MAX_DEBUG_STRING_LEN ) { silly = count; - count =ORANGEFS_MAX_DEBUG_STRING_LEN +1 ; + count =ORANGEFS_MAX_DEBUG_STRING_LEN ; } buf =kzalloc (ORANGEFS_MAX_DEBUG_STRING_LEN ,GFP_KERNEL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 355/620 ASoC: Intel: bytcr_rt5640: Add DMI quirk for Vexia Edu Atla 10 tablet 5V
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 6917192378c1ce17ba31df51c4e0d8b1c97a453b ]
The Vexia EDU ATLA 10 tablet comes in 2 different versions with significantly different mainboards. The only outward difference is that the charging barrel on one is marked 5V and the other is marked 9V.
The 5V version mostly works with the BYTCR defaults, except that it is missing a CHAN package in its ACPI tables and the default of using SSP0-AIF2 is wrong, instead SSP0-AIF1 must be used. That and its jack detect signal is not inverted as it usually is.
Add a DMI quirk for the 5V version to fix sound not working.
--- sound/soc/intel/boards/bytcr_rt5640.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
sound/soc/intel/boards/bytcr_rt5640.c +16 -1
@@ -1102,7 +1102,22 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {BYT_RT5640_SSP0_AIF2 | BYT_RT5640_MCLK_EN), }, - { /* Vexia Edu Atla 10 tablet */ + { +/* Vexia Edu Atla 10 tablet 5V version */ + .matches = { +/* Having all 3 of these not set is somewhat unique */ +DMI_MATCH (DMI_SYS_VENDOR ,"To be filled by O.E.M." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"To be filled by O.E.M." ), +DMI_MATCH (DMI_BOARD_NAME ,"To be filled by O.E.M." ), +/* Above strings are too generic, also match on BIOS date */ + DMI_MATCH(DMI_BIOS_DATE, "05/14/2015"), + }, + .driver_data = (void *)(BYTCR_INPUT_DEFAULTS | +BYT_RT5640_JD_NOT_INV | +BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, + { /* Vexia Edu Atla 10 tablet 9V version */ .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"AMI Corporation" ), DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 356/620 batman-adv: fix panic during interface removal
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Strohman <[email protected]>
commit ccb7276a6d26d6f8416e315b43b45e15ee7f29e2 upstream.
Reference counting is used to ensure that batadv_hardif_neigh_node and batadv_hard_iface are not freed before/during batadv_v_elp_throughput_metric_update work is finished.
But there isn't a guarantee that the hard if will remain associated with a soft interface up until the work is finished.
This fixes a crash triggered by reboot that looks like this:
Call trace: batadv_v_mesh_free+0xd0/0x4dc [batman_adv] batadv_v_elp_throughput_metric_update+0x1c/0xa4 process_one_work+0x178/0x398 worker_thread+0x2e8/0x4d0 kthread+0xd8/0xdc ret_from_fork+0x10/0x20
(the batadv_v_mesh_free call is misleading,
and does not actually happen)
I was able to make the issue happen more reliably by changing hardif_neigh->bat_v.metric_work work to be delayed work. This allowed me to track down and confirm the fix.
[[email protected]: prevent entering batadv_v_elp_get_throughput without
soft_iface]
--- net/batman-adv/bat_v_elp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/batman-adv/bat_v_elp.c +8 -1
@@ -67,12 +67,19 @@ static void batadv_v_elp_start_timer(strstatic u32 batadv_v_elp_get_throughput (struct batadv_hardif_neigh_node *neigh) {struct batadv_hard_iface *hard_iface = neigh->if_incoming; +struct net_device *soft_iface = hard_iface->soft_iface;struct ethtool_link_ksettings link_settings;struct net_device *real_netdev;struct station_info sinfo;u32 throughput;int ret; +/* don't query throughput when no longer associated with any +* batman-adv interface +*/ +if (!soft_iface) +return BATADV_THROUGHPUT_DEFAULT_VALUE ; +/* if the user specified a customised value for this interface, then * return it directly */
@@ -143,7 +150,7 @@ static u32 batadv_v_elp_get_throughput(s default_throughput:if (!(hard_iface->bat_v.flags &BATADV_WARNING_DEFAULT )) { - batadv_info(hard_iface->soft_iface, + batadv_info(soft_iface, "WiFi driver or ethtool info does not provide information about link speeds on interface %s, therefore defaulting to hardcoded throughput values of %u.%1u Mbps. Consider overriding the throughput manually or checking your driver.\n", hard_iface->net_dev->name, BATADV_THROUGHPUT_DEFAULT_VALUE / 10,
Greg Kroah-Hartman
maintainerPATCH 357/620 batman-adv: Ignore neighbor throughput metrics in error case
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit e7e34ffc976aaae4f465b7898303241b81ceefc3 upstream.
If a temporary error happened in the evaluation of the neighbor throughput information, then the invalid throughput result should not be stored in the throughtput EWMA.
--- net/batman-adv/bat_v_elp.c | 50 ++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 16 deletions(-)
net/batman-adv/bat_v_elp.c +34 -16
@@ -60,11 +60,13 @@ static void batadv_v_elp_start_timer(str/** * batadv_v_elp_get_throughput() - get the throughput towards a neighbour * @neigh: the neighbour for which the throughput has to be obtained +* @pthroughput: calculated throughput towards the given neighbour in multiples +* of 100kpbs (a value of '1' equals 0.1Mbps, '10' equals 1Mbps, etc). * -* Return: The throughput towards the given neighbour in multiples of 100kpbs -* (a value of '1' equals 0.1Mbps, '10' equals 1Mbps, etc). +* Return: true when value behind @pthroughput was set */ -static u32 batadv_v_elp_get_throughput (struct batadv_hardif_neigh_node *neigh) +static bool batadv_v_elp_get_throughput (struct batadv_hardif_neigh_node *neigh, +u32 *pthroughput) {struct batadv_hard_iface *hard_iface = neigh->if_incoming;struct net_device *soft_iface = hard_iface->soft_iface;
@@ -78,14 +80,16 @@ static u32 batadv_v_elp_get_throughput(s* batman-adv interface */ if (!soft_iface) -return BATADV_THROUGHPUT_DEFAULT_VALUE ; +return false;/* if the user specified a customised value for this interface, then * return it directly */ throughput =atomic_read (&hard_iface->bat_v.throughput_override); -if (throughput !=0 ) -return throughput; +if (throughput !=0 ) { + *pthroughput = throughput; +return true; + }/* if this is a wireless device, then ask its throughput through * cfg80211 API
@@ -112,19 +116,24 @@ static u32 batadv_v_elp_get_throughput(s* possible to delete this neighbor. For now set * the throughput metric to 0. */ -return 0 ; + *pthroughput =0 ; +return true; }if (ret) goto default_throughput; -if (sinfo.filled &BIT (NL80211_STA_INFO_EXPECTED_THROUGHPUT )) -return sinfo.expected_throughput /100 ; +if (sinfo.filled &BIT (NL80211_STA_INFO_EXPECTED_THROUGHPUT )) { + *pthroughput = sinfo.expected_throughput /100 ; +return true; + }/* try to estimate the expected throughput based on reported tx * rates */ -if (sinfo.filled &BIT (NL80211_STA_INFO_TX_BITRATE )) -return cfg80211_calculate_bitrate (&sinfo.txrate) /3 ; +if (sinfo.filled &BIT (NL80211_STA_INFO_TX_BITRATE )) { + *pthroughput =cfg80211_calculate_bitrate (&sinfo.txrate) /3 ; +return true; + } goto default_throughput; }
@@ -144,8 +153,10 @@ static u32 batadv_v_elp_get_throughput(s hard_iface->bat_v.flags &= ~BATADV_FULL_DUPLEX ; throughput = link_settings.base.speed; -if (throughput && throughput !=SPEED_UNKNOWN ) -return throughput *10 ; +if (throughput && throughput !=SPEED_UNKNOWN ) { + *pthroughput = throughput *10 ; +return true; + } } default_throughput:
@@ -159,7 +170,8 @@ default_throughput: }/* if none of the above cases apply, return the base_throughput */ -return BATADV_THROUGHPUT_DEFAULT_VALUE ; + *pthroughput =BATADV_THROUGHPUT_DEFAULT_VALUE ; +return true; }/**
@@ -171,15 +183,21 @@ void batadv_v_elp_throughput_metric_upda {struct batadv_hardif_neigh_node_bat_v *neigh_bat_v;struct batadv_hardif_neigh_node *neigh; +u32 throughput; +bool valid; neigh_bat_v = container_of(work, struct batadv_hardif_neigh_node_bat_v, metric_work); neigh = container_of(neigh_bat_v, struct batadv_hardif_neigh_node, bat_v); -ewma_throughput_add (&neigh->bat_v.throughput, -batadv_v_elp_get_throughput (neigh)); + valid =batadv_v_elp_get_throughput (neigh, &throughput); +if (!valid) + goto put_neigh; + +ewma_throughput_add (&neigh->bat_v.throughput, throughput); +put_neigh:/* decrement refcounter to balance increment performed before scheduling * this task */
Greg Kroah-Hartman
maintainerPATCH 358/620 KVM: x86: Reject Hyper-Vs SEND_IPI hypercalls if local APIC isnt in-kernel
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit a8de7f100bb5989d9c3627d3a223ee1c863f3b69 upstream.
Advertise support for Hyper-V's SEND_IPI and SEND_IPI_EX hypercalls if and only if the local API is emulated/virtualized by KVM, and explicitly reject said hypercalls if the local APIC is emulated in userspace, i.e. don't rely on userspace to opt-in to KVM_CAP_HYPERV_ENFORCE_CPUID.
Rejecting SEND_IPI and SEND_IPI_EX fixes a NULL-pointer dereference if Hyper-V enlightenments are exposed to the guest without an in-kernel local APIC:
dump_stack+0xbe/0xfd __kasan_report.cold+0x34/0x84 kasan_report+0x3a/0x50 __apic_accept_irq+0x3a/0x5c0 kvm_hv_send_ipi.isra.0+0x34e/0x820 kvm_hv_hypercall+0x8d9/0x9d0 kvm_emulate_hypercall+0x506/0x7e0 __vmx_handle_exit+0x283/0xb60 vmx_handle_exit+0x1d/0xd0 vcpu_enter_guest+0x16b0/0x24c0 vcpu_run+0xc0/0x550 kvm_arch_vcpu_ioctl_run+0x170/0x6d0 kvm_vcpu_ioctl+0x413/0xb20 __se_sys_ioctl+0x111/0x160 do_syscal1_64+0x30/0x40 entry_SYSCALL_64_after_hwframe+0x67/0xd1
Note, checking the sending vCPU is sufficient, as the per-VM irqchip_mode can't be modified after vCPUs are created, i.e. if one vCPU has an in-kernel local APIC, then all vCPUs have an in-kernel local APIC.
--- arch/x86/kvm/hyperv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/kvm/hyperv.c +5 -1
@@ -1902,6 +1902,9 @@ static u64 kvm_hv_send_ipi(struct kvm_vcbool all_cpus;int i; +if (!lapic_in_kernel (vcpu)) +return HV_STATUS_INVALID_HYPERCALL_INPUT ; +if (hc->code ==HVCALL_SEND_IPI ) {if (!hc->fast) { if (unlikely(kvm_read_guest(kvm, hc->ingpa, &send_ipi,
@@ -2507,7 +2510,8 @@ int kvm_get_hv_cpuid(struct kvm_vcpu *vc ent->eax |=HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED ; ent->eax |=HV_X64_APIC_ACCESS_RECOMMENDED ; ent->eax |=HV_X64_RELAXED_TIMING_RECOMMENDED ; - ent->eax |=HV_X64_CLUSTER_IPI_RECOMMENDED ; +if (!vcpu ||lapic_in_kernel (vcpu)) + ent->eax |=HV_X64_CLUSTER_IPI_RECOMMENDED ; ent->eax |=HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED ;if (evmcs_ver) ent->eax |=HV_X64_ENLIGHTENED_VMCS_RECOMMENDED ;
Greg Kroah-Hartman
maintainerPATCH 359/620 perf/x86/intel: Ensure LBRs are disabled when a CPU is starting
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit c631a2de7ae48d50434bdc205d901423f8577c65 upstream.
Explicitly clear DEBUGCTL.LBR when a CPU is starting, prior to purging the LBR MSRs themselves, as at least one system has been found to transfer control to the kernel with LBRs enabled (it's unclear whether it's a BIOS flaw or a CPU goof). Because the kernel preserves the original DEBUGCTL, even when toggling LBRs, leaving DEBUGCTL.LBR as is results in running with LBRs enabled at all times.
--- arch/x86/events/intel/core.c | 5 ++++- arch/x86/include/asm/msr-index.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)
arch/x86/events/intel/core.c +4 -1
@@ -4364,8 +4364,11 @@ static void intel_pmu_cpu_starting(int cinit_debug_store_on_cpu (cpu);/* -* Deal with CPUs that don't clear their LBRs on power-up. +* Deal with CPUs that don't clear their LBRs on power-up, and that may +* even boot with LBRs enabled. */ +if (!static_cpu_has (X86_FEATURE_ARCH_LBR ) && x86_pmu.lbr_nr) +msr_clear_bit (MSR_IA32_DEBUGCTLMSR ,DEBUGCTLMSR_LBR_BIT );intel_pmu_lbr_reset (); cpuc->lbr_sel =NULL ;
arch/x86/include/asm/msr-index.h +2 -1
@@ -337,7 +337,8 @@#define MSR_IA32_PASID_VALID BIT_ULL(31)/* DEBUGCTLMSR bits (others vary by model): */ -#define DEBUGCTLMSR_LBR (1UL << 0)/* last branch recording */ +#define DEBUGCTLMSR_LBR_BIT 0/* last branch recording */ +#define DEBUGCTLMSR_LBR (1UL << DEBUGCTLMSR_LBR_BIT)#define DEBUGCTLMSR_BTF_SHIFT 1#define DEBUGCTLMSR_BTF (1UL << 1)/* single-step on branches */ #define DEBUGCTLMSR_BUS_LOCK_DETECT (1UL << 2)
Greg Kroah-Hartman
maintainerPATCH 360/620 usb: roles: set switch registered flag early on
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Elson Roy Serrao <[email protected]>
commit 634775a752a86784511018a108f3b530cc3399a7 upstream.
The role switch registration and set_role() can happen in parallel as they are invoked independent of each other. There is a possibility that a driver might spend significant amount of time in usb_role_switch_register() API due to the presence of time intensive operations like component_add() which operate under common mutex. This leads to a time window after allocating the switch and before setting the registered flag where the set role notifications are dropped. Below timeline summarizes this behavior
Thread1 | Thread2usb_role_switch_register() |
| | ---> allocate switch | | | ---> component_add() | usb_role_switch_set_role() | | | | | --> Drop role notifications | | since sw->registered | | flag is not set. | | --->Set registered flag.|
To avoid this, set the registered flag early on in the switch register API.
--- drivers/usb/roles/class.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/roles/class.c +3 -2
@@ -354,14 +354,15 @@ usb_role_switch_register(struct device *dev_set_name (&sw->dev,"%s-role-switch" , desc->name ? desc->name :dev_name (parent)); + sw->registered = true; + ret =device_register (&sw->dev);if (ret) { + sw->registered = false;put_device (&sw->dev);return ERR_PTR (ret); } - sw->registered = true; -/* TODO: Symlinks for the host port and the device controller. */ return sw;
Greg Kroah-Hartman
maintainerPATCH 361/620 usb: gadget: udc: renesas_usb3: Fix compiler warning
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guo Ren <[email protected]>
commit 335a1fc1193481f8027f176649c72868172f6f8b upstream.
drivers/usb/gadget/udc/renesas_usb3.c: In function 'renesas_usb3_probe':drivers/usb/gadget/udc/renesas_usb3.c:2638:73: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 6 [-Wformat-truncation=]
2638 | snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
^~~~~~~~~~~~~~~~~~~~~~~~ ^~ ^--- drivers/usb/gadget/udc/renesas_usb3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/renesas_usb3.c +1 -1
@@ -306,7 +306,7 @@ struct renesas_usb3_request {struct list_head queue; }; -#define USB3_EP_NAME_SIZE 8 +#define USB3_EP_NAME_SIZE 16struct renesas_usb3_ep {struct usb_ep ep;struct renesas_usb3 *usb3;
Greg Kroah-Hartman
maintainerPATCH 362/620 usb: dwc2: gadget: remove of_node reference upon udc_stop
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabrice Gasnier <[email protected]>
commit 58cd423820d5b5610977e55e4acdd06628829ede upstream.
In dwc2_hsotg_udc_start(), e.g. when binding composite driver, "of_node" is set to hsotg->dev->of_node.
It causes errors when binding the gadget driver several times, on stm32mp157c-ev1 board. Below error is seen:
"pin PA10 already requested by 49000000.usb-otg; cannot claim for gadget.0"
The first time, no issue is seen as when registering the driver, of_node isn't NULL:
-> gadget_dev_desc_UDC_store
-> usb_gadget_register_driver_owner
-> driver_register
...
-> really_probe -> pinctrl_bind_pins (no effect)Then dwc2_hsotg_udc_start() sets of_node.
The second time (stop the gadget, reconfigure it, then start it again), of_node has been set, so the probing code tries to acquire pins for the gadget. These pins are hold by the controller, hence the error.
So clear gadget.dev.of_node in udc_stop() routine to avoid the issue.
--- drivers/usb/dwc2/gadget.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc2/gadget.c +1 -0
@@ -4613,6 +4613,7 @@ static int dwc2_hsotg_udc_stop(struct usspin_lock_irqsave (&hsotg->lock, flags); hsotg->driver =NULL ; + hsotg->gadget.dev.of_node =NULL ; hsotg->gadget.speed =USB_SPEED_UNKNOWN ; hsotg->enabled =0 ;
Greg Kroah-Hartman
maintainerPATCH 363/620 USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit e71f7f42e3c874ac3314b8f250e8416a706165af upstream.
LS7A EHCI controller doesn't have extended capabilities, so the EECP (EHCI Extended Capabilities Pointer) field of HCCPARAMS register should be 0x0, but it reads as 0xa0 now. This is a hardware flaw and will be fixed in future, now just clear the EECP field to avoid error messages on boot:
......
[ 0.581675] pci 0000:00:04.1: EHCI: unrecognized capability ff [ 0.581699] pci 0000:00:04.1: EHCI: unrecognized capability ff [ 0.581716] pci 0000:00:04.1: EHCI: unrecognized capability ff [ 0.581851] pci 0000:00:04.1: EHCI: unrecognized capability ff ...... [ 0.581916] pci 0000:00:05.1: EHCI: unrecognized capability ff [ 0.581951] pci 0000:00:05.1: EHCI: unrecognized capability ff [ 0.582704] pci 0000:00:05.1: EHCI: unrecognized capability ff [ 0.582799] pci 0000:00:05.1: EHCI: unrecognized capability ff
......
--- drivers/usb/host/pci-quirks.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/host/pci-quirks.c +9 -0
@@ -948,6 +948,15 @@ static void quirk_usb_disable_ehci(struc* booting from USB disk or using a usb keyboard */ hcc_params =readl (base +EHCI_HCC_PARAMS ); + +/* LS7A EHCI controller doesn't have extended capabilities, the +* EECP (EHCI Extended Capabilities Pointer) field of HCCPARAMS +* register should be 0x0 but it reads as 0xa0. So clear it to +* avoid error messages on boot. +*/ +if (pdev->vendor ==PCI_VENDOR_ID_LOONGSON && pdev->device ==0x7a14 ) + hcc_params &= ~(0xffL <<8 ); + offset = (hcc_params >>8 ) &0xff ;while (offset && --count) {pci_read_config_dword (pdev, offset, &cap);
Greg Kroah-Hartman
maintainerPATCH 364/620 usb: core: fix pipe creation for get_bMaxPacketSize0
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Eichenberger <[email protected]>
commit 4aac0db5a0ebc599d4ad9bf5ebab78afa1f33e10 upstream.
When usb_control_msg is used in the get_bMaxPacketSize0 function, the USB pipe does not include the endpoint device number. This can cause failures when a usb hub port is reinitialized after encountering a bad cable connection. As a result, the system logs the following error messages:
usb usb2-port1: cannot reset (err = -32)
usb usb2-port1: Cannot enable. Maybe the USB cable is bad? usb usb2-port1: attempt power cycle
usb 2-1: new high-speed USB device number 5 using ci_hdrc usb 2-1: device descriptor read/8, error -71
The problem began after commit 85d07c556216 ("USB: core: Unite old scheme and new scheme descriptor reads"). There usb_get_device_descriptor was replaced with get_bMaxPacketSize0. Unlike usb_get_device_descriptor, the get_bMaxPacketSize0 function uses the macro usb_rcvaddr0pipe, which does not include the endpoint device number. usb_get_device_descriptor, on the other hand, used the macro usb_rcvctrlpipe, which includes the endpoint device number.
By modifying the get_bMaxPacketSize0 function to use usb_rcvctrlpipe instead of usb_rcvaddr0pipe, the issue can be resolved. This change will ensure that the endpoint device number is included in the USB pipe, preventing reinitialization failures. If the endpoint has not set the device number yet, it will still work because the device number is 0 in udev.
--- drivers/usb/core/hub.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/core/hub.c +1 -2
@@ -4636,7 +4636,6 @@ void usb_ep0_reinit(struct usb_device *uEXPORT_SYMBOL_GPL (usb_ep0_reinit);#define usb_sndaddr0pipe () (PIPE_CONTROL << 30) -#define usb_rcvaddr0pipe () ((PIPE_CONTROL << 30) | USB_DIR_IN)static int hub_set_address (struct usb_device *udev,int devnum) {
@@ -4737,7 +4736,7 @@ static int get_bMaxPacketSize0(struct usfor (i =0 ; i <GET_MAXPACKET0_TRIES ; ++i) {/* Start with invalid values in case the transfer fails */ buf->bDescriptorType = buf->bMaxPacketSize0 =0 ; - rc = usb_control_msg(udev, usb_rcvaddr0pipe(), + rc = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, USB_DT_DEVICE << 8, 0, buf, size,
Greg Kroah-Hartman
maintainerPATCH 365/620 USB: quirks: add USB_QUIRK_NO_LPM quirk for Teclast dist
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lei Huang <[email protected]>
commit e169d96eecd447ff7fd7542ca5fa0911f5622054 upstream.
Teclast disk used on Huawei hisi platforms doesn't work well, losing connectivity intermittently if LPM is enabled. Add quirk disable LPM to resolve the issue.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -519,6 +519,9 @@ static const struct usb_device_id usb_qu/* Blackmagic Design UltraStudio SDI */ { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM }, + /* Teclast disk */ + { USB_DEVICE(0x1f75, 0x0917), .driver_info = USB_QUIRK_NO_LPM }, + /* Hauppauge HVR-950q */ { USB_DEVICE(0x2040, 0x7200), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
Greg Kroah-Hartman
maintainerPATCH 366/620 USB: Add USB_QUIRK_NO_LPM quirk for sony xperia xz1 smartphone
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit 159daf1258227f44b26b5d38f4aa8f37b8cca663 upstream.
The fastboot tool for communicating with Android bootloaders does not work reliably with this device if USB 2 Link Power Management (LPM) is enabled.
Various fastboot commands are affected, including the following, which usually reproduces the problem within two tries:
fastboot getvar kernel
getvar:kernel FAILED (remote: 'GetVar Variable Not found')
This issue was hidden on many systems up until commit 63a1f8454962 ("xhci: stored cached port capability values in one place") as the xhci driver failed to detect USB 2 LPM support if USB 3 ports were listed before USB 2 ports in the "supported protocol capabilities".
Adding the quirk resolves the issue. No drawbacks are expected since the device uses different USB product IDs outside of fastboot mode, and since fastboot commands worked before, until LPM was enabled on the tested system by the aforementioned commit.
Based on a patch from Forest <[email protected]> from which most of the code and commit message is taken.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -429,6 +429,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x0c45, 0x7056), .driver_info = USB_QUIRK_IGNORE_REMOTE_WAKEUP }, + /* Sony Xperia XZ1 Compact (lilac) smartphone in fastboot mode */ + { USB_DEVICE(0x0fce, 0x0dde), .driver_info = USB_QUIRK_NO_LPM }, + /* Action Semiconductor flash disk */ { USB_DEVICE(0x10d6, 0x2200), .driver_info = USB_QUIRK_STRING_FETCH_255 },
Greg Kroah-Hartman
maintainerPATCH 367/620 usb: gadget: f_midi: fix MIDI Streaming descriptor lengths
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Keeping <[email protected]>
commit da1668997052ed1cb00322e1f3b63702615c9429 upstream.
While the MIDI jacks are configured correctly, and the MIDIStreaming endpoint descriptors are filled with the correct information, bNumEmbMIDIJack and bLength are set incorrectly in these descriptors.
This does not matter when the numbers of in and out ports are equal, but when they differ the host will receive broken descriptors with uninitialized stack memory leaking into the descriptor for whichever value is smaller.
The precise meaning of "in" and "out" in the port counts is not clearly defined and can be confusing. But elsewhere the driver consistently uses this to match the USB meaning of IN and OUT viewed from the host, so that "in" ports send data to the host and "out" ports receive data from it.
--- drivers/usb/gadget/function/f_midi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/function/f_midi.c +4 -4
@@ -999,11 +999,11 @@ static int f_midi_bind(struct usb_config }/* configure the endpoint descriptors ... */ - ms_out_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->in_ports); - ms_out_desc.bNumEmbMIDIJack = midi->in_ports; + ms_out_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->out_ports); + ms_out_desc.bNumEmbMIDIJack = midi->out_ports; - ms_in_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->out_ports); - ms_in_desc.bNumEmbMIDIJack = midi->out_ports; + ms_in_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->in_ports); + ms_in_desc.bNumEmbMIDIJack = midi->in_ports;/* ... and add them to the list */ endpoint_descriptor_index = i;
Greg Kroah-Hartman
maintainerPATCH 368/620 USB: hub: Ignore non-compliant devices with too many configs or interfaces
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 2240fed37afbcdb5e8b627bc7ad986891100e05d upstream.
Robert Morris created a test program which can cause usb_hub_to_struct_hub() to dereference a NULL or inappropriate pointer:
Oops: general protection fault, probably for non-canonical address 0xcccccccccccccccc: 0000 [#1] SMP DEBUG_PAGEALLOC PTI CPU: 7 UID: 0 PID: 117 Comm: kworker/7:1 Not tainted 6.13.0-rc3-00017-gf44d154d6e3d #14 Hardware name: FreeBSD BHYVE/BHYVE, BIOS 14.0 10/17/2021 Workqueue: usb_hub_wq hub_event RIP: 0010:usb_hub_adjust_deviceremovable+0x78/0x110 ... Call Trace: <TASK> ? die_addr+0x31/0x80 ? exc_general_protection+0x1b4/0x3c0 ? asm_exc_general_protection+0x26/0x30 ? usb_hub_adjust_deviceremovable+0x78/0x110 hub_probe+0x7c7/0xab0 usb_probe_interface+0x14b/0x350 really_probe+0xd0/0x2d0 ? __pfx___device_attach_driver+0x10/0x10 __driver_probe_device+0x6e/0x110 driver_probe_device+0x1a/0x90 __device_attach_driver+0x7e/0xc0 bus_for_each_drv+0x7f/0xd0 __device_attach+0xaa/0x1a0 bus_probe_device+0x8b/0xa0 device_add+0x62e/0x810 usb_set_configuration+0x65d/0x990 usb_generic_driver_probe+0x4b/0x70 usb_probe_device+0x36/0xd0
The cause of this error is that the device has two interfaces, and the hub driver binds to interface 1 instead of interface 0, which is where usb_hub_to_struct_hub() looks.
We can prevent the problem from occurring by refusing to accept hub devices that violate the USB spec by having more than one configuration or interface.
--- drivers/usb/core/hub.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/core/hub.c +11 -0
@@ -1804,6 +1804,17 @@ static int hub_probe(struct usb_interfac hdev =interface_to_usbdev (intf);/* +* The USB 2.0 spec prohibits hubs from having more than one +* configuration or interface, and we rely on this prohibition. +* Refuse to accept a device that violates it. +*/ +if (hdev->descriptor.bNumConfigurations >1 || + hdev->actconfig->desc.bNumInterfaces >1 ) { +dev_err (&intf->dev,"Invalid hub with more than one config or interface\n" ); +return -EINVAL ; + } + +/* * Set default autosuspend delay as 0 to speedup bus suspend, * based on the below considerations: *
Greg Kroah-Hartman
maintainerPATCH 369/620 USB: cdc-acm: Fill in Renesas R-Car D3 USB Download mode quirk
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 7284922f3e4fa285dff1b8bb593aa9a0b8458f30 upstream.
Add Renesas R-Car D3 USB Download mode quirk and update comments on all the other Renesas R-Car USB Download mode quirks to discern them from each other. This follows R-Car Series, 3rd Generation reference manual Rev.2.00 chapter 19.2.8 USB download mode .
--- drivers/usb/class/cdc-acm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/usb/class/cdc-acm.c +6 -3
@@ -1707,13 +1707,16 @@ static const struct usb_device_id acm_id { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ .driver_info =NO_UNION_NORMAL ,/* has no union descriptor */ }, - { USB_DEVICE(0x045b, 0x023c), /* Renesas USB Download mode */ + { USB_DEVICE(0x045b, 0x023c), /* Renesas R-Car H3 USB Download mode */ .driver_info = DISABLE_ECHO, /* Don't echo banner */ }, - { USB_DEVICE(0x045b, 0x0248), /* Renesas USB Download mode */ + { USB_DEVICE(0x045b, 0x0247), /* Renesas R-Car D3 USB Download mode */ .driver_info = DISABLE_ECHO, /* Don't echo banner */ }, - { USB_DEVICE(0x045b, 0x024D), /* Renesas USB Download mode */ + { USB_DEVICE(0x045b, 0x0248), /* Renesas R-Car M3-N USB Download mode */ + .driver_info = DISABLE_ECHO, /* Don't echo banner */ + }, + { USB_DEVICE(0x045b, 0x024D), /* Renesas R-Car E3 USB Download mode */ .driver_info = DISABLE_ECHO, /* Don't echo banner */ }, { USB_DEVICE(0x0e8d, 0x0003), /* FIREFLY, MediaTek Inc; [email protected] */
Greg Kroah-Hartman
maintainerPATCH 370/620 usb: cdc-acm: Check control transfer buffer size before access
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit e563b01208f4d1f609bcab13333b6c0e24ce6a01 upstream.
If the first fragment is shorter than struct usb_cdc_notification, we can't calculate an expected_size. Log an error and discard the notification instead of reading lengths from memory outside the received data, which can lead to memory corruption when the expected_size decreases between fragments, causing expected_size - acm->nb_index to wrap.
This issue has been present since the beginning of git history; however, it only leads to memory corruption since commit ea2583529cd1 ("cdc-acm: reassemble fragmented notifications").
A mitigating factor is that acm_ctrl_irq() can only execute after userspace has opened /dev/ttyACM*; but if ModemManager is running, ModemManager will do that automatically depending on the USB device's vendor/product IDs and its other interfaces.
--- drivers/usb/class/cdc-acm.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/usb/class/cdc-acm.c +14 -3
@@ -360,7 +360,7 @@ static void acm_process_notification(strstatic void acm_ctrl_irq (struct urb *urb) {struct acm *acm = urb->context; -struct usb_cdc_notification *dr = urb->transfer_buffer; +struct usb_cdc_notification *dr;unsigned int current_size = urb->actual_length;unsigned int expected_size, copy_size, alloc_size;int retval;
@@ -387,9 +387,20 @@ static void acm_ctrl_irq(struct urb *urbusb_mark_last_busy (acm->dev); -if (acm->nb_index) +if (acm->nb_index ==0 ) { +/* +* The first chunk of a message must contain at least the +* notification header with the length field, otherwise we +* can't get an expected_size. +*/ +if (current_size <sizeof (struct usb_cdc_notification )) { +dev_dbg (&acm->control->dev,"urb too short\n" ); + goto exit; + } + dr = urb->transfer_buffer; + }else { dr = (struct usb_cdc_notification *)acm->notification_buffer; - + }/* size = notification-header + (optional) data */ expected_size =sizeof (struct usb_cdc_notification ) +le16_to_cpu (dr->wLength);
Greg Kroah-Hartman
maintainerPATCH 371/620 usb: cdc-acm: Fix handling of oversized fragments
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 12e712964f41d05ae034989892de445781c46730 upstream.
If we receive an initial fragment of size 8 bytes which specifies a wLength of 1 byte (so the reassembled message is supposed to be 9 bytes long), and we then receive a second fragment of size 9 bytes (which is not supposed to happen), we currently wrongly bypass the fragment reassembly code but still pass the pointer to the acm->notification_buffer to acm_process_notification().
Make this less wrong by always going through fragment reassembly when we expect more fragments.
Before this patch, receiving an overlong fragment could lead to newctrl in acm_process_notification() being uninitialized data (instead of data coming from the device).
--- drivers/usb/class/cdc-acm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +1 -1
@@ -405,7 +405,7 @@ static void acm_ctrl_irq(struct urb *urb expected_size =sizeof (struct usb_cdc_notification ) +le16_to_cpu (dr->wLength); -if (current_size < expected_size) { +if (acm->nb_index !=0 || current_size < expected_size) {/* notification is transmitted fragmented, reassemble */ if (acm->nb_size < expected_size) {u8 *new_buffer;
Greg Kroah-Hartman
maintainerPATCH 372/620 USB: serial: option: add MeiG Smart SLM828
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chester A. Unal <[email protected]>
commit db79e75460fc59b19f9c89d4b068e61cee59f37d upstream.
MeiG Smart SLM828 is an LTE-A CAT6 modem with the mPCIe form factor. The "Cls=ff(vend.) Sub=10 Prot=02" and "Cls=ff(vend.) Sub=10 Prot=03" interfaces respond to AT commands. Add these interfaces.
The product ID the modem uses is shared across multiple modems. Therefore, add comments to describe which interface is used for which modem.
T: Bus=01 Lev=01 Prnt=05 Port=01 Cnt=01 Dev#= 6 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=2dee ProdID=4d22 Rev=05.04 S: Manufacturer=MEIG S: Product=LTE-A Module S: SerialNumber=4da7ec42 C: #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=10 Prot=01 Driver=(none) E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=02 Driver=(none) E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=03 Driver=(none) E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=04 Driver=(none) E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=88(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=05 Driver=qmi_wwan E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/usb/serial/option.c +10 -5
@@ -621,7 +621,10 @@ static void option_instat_callback(struc/* MeiG Smart Technology products */ #define MEIGSMART_VENDOR_ID 0x2dee -/* MeiG Smart SRM815/SRM825L based on Qualcomm 315 */ +/* +* MeiG Smart SLM828, SRM815, and SRM825L use the same product ID. SLM828 is +* based on Qualcomm SDX12. SRM815 and SRM825L are based on Qualcomm 315. +*/ #define MEIGSMART_PRODUCT_SRM825L 0x4d22/* MeiG Smart SLM320 based on UNISOC UIS8910 */ #define MEIGSMART_PRODUCT_SLM320 0x4d41
@@ -2405,10 +2408,12 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM320, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM770A, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0, 0) }, /* MeiG Smart SRM815 */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x02) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x03) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, /* MeiG Smart SRM815 and SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, /* MeiG Smart SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, /* MeiG Smart SRM825L */ { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0530, 0xff), /* TCL IK512 MBIM */ .driver_info = NCTRL(1) }, { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0640, 0xff), /* TCL IK512 ECM */
Greg Kroah-Hartman
maintainerPATCH 373/620 USB: serial: option: add Telit Cinterion FN990B compositions
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Porcedda <[email protected]>
commit c979fb5ece2dc11cc9cc3d5c66f750e210bfdee2 upstream.
Add the following Telit Cinterion FN990B40 compositions:
0x10d0: rmnet + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 17 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d0 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs= 9 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10d1: MBIM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 16 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d1 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10d2: RNDIS + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 18 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d2 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10d3: ECM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 20 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d3 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether E: Ad=82(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/usb/serial/option.c +16 -0
@@ -1406,6 +1406,22 @@ static const struct usb_device_id option .driver_info = RSVD(0) | NCTRL(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10c8, 0xff), /* Telit FE910C04 (rmnet) */ .driver_info = RSVD(0) | NCTRL(2) | RSVD(3) | RSVD(4) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x60) }, /* Telit FN990B (rmnet) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x30), + .driver_info = NCTRL(5) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x60) }, /* Telit FN990B (MBIM) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x30), + .driver_info = NCTRL(6) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x60) }, /* Telit FN990B (RNDIS) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x30), + .driver_info = NCTRL(6) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x60) }, /* Telit FN990B (ECM) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x30), + .driver_info = NCTRL(6) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
Greg Kroah-Hartman
maintainerPATCH 374/620 USB: serial: option: fix Telit Cinterion FN990A name
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Porcedda <[email protected]>
commit 12606fe73f33647c5e79bf666833bf0b225e649d upstream.
The correct name for FN990 is FN990A so use it in order to avoid confusion with FN990B.
--- drivers/usb/serial/option.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/serial/option.c +5 -5
@@ -1370,15 +1370,15 @@ static const struct usb_device_id option .driver_info = NCTRL(2) | RSVD(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1063, 0xff), /* Telit LN920 (ECM) */ .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1070, 0xff), /* Telit FN990 (rmnet) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1070, 0xff), /* Telit FN990A (rmnet) */ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1071, 0xff), /* Telit FN990 (MBIM) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1071, 0xff), /* Telit FN990A (MBIM) */ .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1072, 0xff), /* Telit FN990 (RNDIS) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1072, 0xff), /* Telit FN990A (RNDIS) */ .driver_info = NCTRL(2) | RSVD(3) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990 (ECM) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990A (ECM) */ .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990 (PCIe) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990A (PCIe) */ .driver_info = RSVD(0) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1080, 0xff), /* Telit FE990 (rmnet) */ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
Greg Kroah-Hartman
maintainerPATCH 375/620 USB: serial: option: drop MeiG Smart defines
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 6aa8a63c471eb6756aabd03f880feffe6a7af6c9 upstream.
Several MeiG Smart modems apparently use the same product id, making the defines even less useful.
Drop them in favour of using comments consistently to make the id table slightly less unwieldy.
--- drivers/usb/serial/option.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
drivers/usb/serial/option.c +8 -20
@@ -619,18 +619,6 @@ static void option_instat_callback(struc/* Luat Air72*U series based on UNISOC UIS8910 uses UNISOC's vendor ID */ #define LUAT_PRODUCT_AIR720U 0x4e00 -/* MeiG Smart Technology products */ -#define MEIGSMART_VENDOR_ID 0x2dee -/* -* MeiG Smart SLM828, SRM815, and SRM825L use the same product ID. SLM828 is -* based on Qualcomm SDX12. SRM815 and SRM825L are based on Qualcomm 315. -*/ -#define MEIGSMART_PRODUCT_SRM825L 0x4d22 -/* MeiG Smart SLM320 based on UNISOC UIS8910 */ -#define MEIGSMART_PRODUCT_SLM320 0x4d41 -/* MeiG Smart SLM770A based on ASR1803 */ -#define MEIGSMART_PRODUCT_SLM770A 0x4d57 -/* Device flags */ /* Highest interface number which can be used with NCTRL() and RSVD() */
@@ -2366,6 +2354,14 @@ static const struct usb_device_id option { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a05, 0xff) }, /* Fibocom FM650-CN (NCM mode) */ { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a06, 0xff) }, /* Fibocom FM650-CN (RNDIS mode) */ { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a07, 0xff) }, /* Fibocom FM650-CN (MBIM mode) */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d41, 0xff, 0, 0) }, /* MeiG Smart SLM320 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d57, 0xff, 0, 0) }, /* MeiG Smart SLM770A */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0, 0) }, /* MeiG Smart SRM815 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0x10, 0x02) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0x10, 0x03) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x30) }, /* MeiG Smart SRM815 and SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x40) }, /* MeiG Smart SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x60) }, /* MeiG Smart SRM825L */ { USB_DEVICE_INTERFACE_CLASS(0x2df3, 0x9d03, 0xff) }, /* LongSung M5710 */ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */
@@ -2422,14 +2418,6 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM320, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM770A, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0, 0) }, /* MeiG Smart SRM815 */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x02) }, /* MeiG Smart SLM828 */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x03) }, /* MeiG Smart SLM828 */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, /* MeiG Smart SRM815 and SRM825L */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, /* MeiG Smart SRM825L */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, /* MeiG Smart SRM825L */ { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0530, 0xff), /* TCL IK512 MBIM */ .driver_info = NCTRL(1) }, { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0640, 0xff), /* TCL IK512 ECM */
Greg Kroah-Hartman
maintainerPATCH 376/620 can: c_can: fix unbalanced runtime PM disable in error path
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 257a2cd3eb578ee63d6bf90475dc4f4b16984139 upstream.
Runtime PM is enabled as one of the last steps of probe(), so all earlier gotos to "exit_free_device" label were not correct and were leading to unbalanced runtime PM disable depth.
--- drivers/net/can/c_can/c_can_platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/c_can/c_can_platform.c +3 -2
@@ -395,15 +395,16 @@ static int c_can_plat_probe(struct platfif (ret) {dev_err (&pdev->dev,"registering %s failed (err=%d)\n" ,KBUILD_MODNAME , ret); - goto exit_free_device; + goto exit_pm_runtime; }dev_info (&pdev->dev,"%s device registered (regs=%p, irq=%d)\n" ,KBUILD_MODNAME , priv->base, dev->irq);return 0 ; -exit_free_device: +exit_pm_runtime:pm_runtime_disable (priv->device); +exit_free_device:free_c_can_dev (dev); exit:dev_err (&pdev->dev,"probe failed\n" );
Greg Kroah-Hartman
maintainerPATCH 377/620 can: j1939: j1939_sk_send_loop(): fix unable to send messages with data length zero
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Hölzl <[email protected]>
commit 44de577e61ed239db09f0da9d436866bef9b77dd upstream.
The J1939 standard requires the transmission of messages of length 0.
For example proprietary messages are specified with a data length of 0 to 1785. The transmission of such messages is not possible. Sending results in no error being returned but no corresponding can frame being generated.
Enable the transmission of zero length J1939 messages. In order to facilitate this two changes are necessary:
1) If the transmission of a new message is requested from user space the message is segmented in j1939_sk_send_loop(). Let the segmentation take into account zero length messages, do not terminate immediately, queue the corresponding skb.
2) j1939_session_skb_get_by_offset() selects the next skb to transmit for a session. Take into account that there might be zero length skbs in the queue.
--- net/can/j1939/socket.c | 4 ++-- net/can/j1939/transport.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
net/can/j1939/socket.c +2 -2
@@ -1130,7 +1130,7 @@ static int j1939_sk_send_loop(struct j19 todo_size = size; -while (todo_size) { + do { struct j1939_sk_buff_cb *skcb; segment_size = min_t(size_t, J1939_MAX_TP_PACKET_SIZE,
@@ -1175,7 +1175,7 @@ static int j1939_sk_send_loop(struct j19 todo_size -= segment_size; session->total_queued_size += segment_size; - } + }while (todo_size);switch (ret) {case 0 :/* OK */
net/can/j1939/transport.c +3 -2
@@ -382,8 +382,9 @@ sk_buff *j1939_session_skb_get_by_offset skb_queue_walk(&session->skb_queue, do_skb) { do_skcb =j1939_skb_to_cb (do_skb); -if (offset_start >= do_skcb->offset && - offset_start < (do_skcb->offset + do_skb->len)) { +if ((offset_start >= do_skcb->offset && + offset_start < (do_skcb->offset + do_skb->len)) || + (offset_start ==0 && do_skcb->offset ==0 && do_skb->len ==0 )) { skb = do_skb; } }
Greg Kroah-Hartman
maintainerPATCH 378/620 alpha: make stack 16-byte aligned (most cases)
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Kokshaysky <[email protected]>
commit 0a0f7362b0367634a2d5cb7c96226afc116f19c9 upstream.
The problem is that GCC expects 16-byte alignment of the incoming stack since early 2004, as Maciej found out [1]:
Having actually dug speculatively I can see that the psABI was changed in
GCC 3.5 with commit e5e10fb4a350 ("re PR target/14539 (128-bit long double improperly aligned)") back in Mar 2004, when the stack pointer alignment was increased from 8 bytes to 16 bytes, and arch/alpha/kernel/entry.S has various suspicious stack pointer adjustments, starting with SP_OFF which is not a whole multiple of 16.
Also, as Magnus noted, "ALPHA Calling Standard" [2] required the same:
D.3.1 Stack Alignment
This standard requires that stacks be octaword aligned at the time a new procedure is invoked.
However:
- the "normal" kernel stack is always misaligned by 8 bytes, thanks to the odd number of 64-bit words in 'struct pt_regs', which is the very first thing pushed onto the kernel thread stack;
- syscall, fault, interrupt etc. handlers may, or may not, receive aligned stack depending on numerous factors.
Somehow we got away with it until recently, when we ended up with a stack corruption in kernel/smp.c:smp_call_function_single() due to its use of 32-byte aligned local data and the compiler doing clever things allocating it on the stack.
This adds padding between the PAL-saved and kernel-saved registers so that 'struct pt_regs' have an even number of 64-bit words. This makes the stack properly aligned for most of the kernel code, except two handlers which need special threatment.
Note: struct pt_regs doesn't belong in uapi/asm; this should be fixed, but let's put this off until later.
--- arch/alpha/include/uapi/asm/ptrace.h | 2 ++ 1 file changed, 2 insertions(+)
arch/alpha/include/uapi/asm/ptrace.h +2 -0
@@ -42,6 +42,8 @@ struct pt_regs {unsigned long trap_a0;unsigned long trap_a1;unsigned long trap_a2; +/* This makes the stack 16-byte aligned as GCC expects */ +unsigned long __pad0;/* These are saved by PAL-code: */ unsigned long ps;unsigned long pc;
Greg Kroah-Hartman
maintainerPATCH 379/620 efi: Avoid cold plugged memory for placing the kernel
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit ba69e0750b0362870294adab09339a0c39c3beaf upstream.
UEFI 2.11 introduced EFI_MEMORY_HOT_PLUGGABLE to annotate system memory regions that are 'cold plugged' at boot, i.e., hot pluggable memory that is available from early boot, and described as system RAM by the firmware.
Existing loaders and EFI applications running in the boot context will happily use this memory for allocating data structures that cannot be freed or moved at runtime, and this prevents the memory from being unplugged. Going forward, the new EFI_MEMORY_HOT_PLUGGABLE attribute should be tested, and memory annotated as such should be avoided for such allocations.
In the EFI stub, there are a couple of occurrences where, instead of the high-level AllocatePages() UEFI boot service, a low-level code sequence is used that traverses the EFI memory map and carves out the requested number of pages from a free region. This is needed, e.g., for allocating as low as possible, or for allocating pages at random.
While AllocatePages() should presumably avoid special purpose memory and cold plugged regions, this manual approach needs to incorporate this logic itself, in order to prevent the kernel itself from ending up in a hot unpluggable region, preventing it from being unplugged.
So add the EFI_MEMORY_HOTPLUGGABLE macro definition, and check for it where appropriate.
--- drivers/firmware/efi/efi.c | 6 ++++-- drivers/firmware/efi/libstub/randomalloc.c | 3 +++ drivers/firmware/efi/libstub/relocate.c | 3 +++ include/linux/efi.h | 1 + 4 files changed, 11 insertions(+), 2 deletions(-)
drivers/firmware/efi/efi.c +4 -2
@@ -774,13 +774,15 @@ char * __init efi_md_typeattr_format(chaEFI_MEMORY_WB |EFI_MEMORY_UCE |EFI_MEMORY_RO |EFI_MEMORY_WP |EFI_MEMORY_RP |EFI_MEMORY_XP |EFI_MEMORY_NV |EFI_MEMORY_SP |EFI_MEMORY_CPU_CRYPTO | - EFI_MEMORY_RUNTIME | EFI_MEMORY_MORE_RELIABLE)) +EFI_MEMORY_MORE_RELIABLE |EFI_MEMORY_HOT_PLUGGABLE | + EFI_MEMORY_RUNTIME)) snprintf(pos, size, "|attr=0x%016llx]", (unsigned long long)attr); else snprintf(pos, size, -"|%3s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]" , +"|%3s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]" , attr &EFI_MEMORY_RUNTIME ?"RUN" :"" , + attr &EFI_MEMORY_HOT_PLUGGABLE ?"HP" :"" , attr &EFI_MEMORY_MORE_RELIABLE ?"MR" :"" , attr &EFI_MEMORY_CPU_CRYPTO ?"CC" :"" , attr & EFI_MEMORY_SP ? "SP" : "",
drivers/firmware/efi/libstub/randomalloc.c +3 -0
@@ -24,6 +24,9 @@ static unsigned long get_entry_num_slotsif (md->type !=EFI_CONVENTIONAL_MEMORY )return 0 ; +if (md->attribute &EFI_MEMORY_HOT_PLUGGABLE ) +return 0 ; +if (efi_soft_reserve_enabled () && (md->attribute &EFI_MEMORY_SP ))return 0 ;
drivers/firmware/efi/libstub/relocate.c +3 -0
@@ -62,6 +62,9 @@ efi_status_t efi_low_alloc_above(unsigneif (desc->type !=EFI_CONVENTIONAL_MEMORY )continue ; +if (desc->attribute &EFI_MEMORY_HOT_PLUGGABLE ) +continue ; +if (efi_soft_reserve_enabled () && (desc->attribute &EFI_MEMORY_SP ))continue ;
include/linux/efi.h +1 -0
@@ -125,6 +125,7 @@ typedef struct {#define EFI_MEMORY_RO ((u64)0x0000000000020000ULL)/* read-only */ #define EFI_MEMORY_SP ((u64)0x0000000000040000ULL)/* soft reserved */ #define EFI_MEMORY_CPU_CRYPTO ((u64)0x0000000000080000ULL)/* supports encryption */ +#define EFI_MEMORY_HOT_PLUGGABLE BIT_ULL(20)/* supports unplugging at runtime */ #define EFI_MEMORY_RUNTIME ((u64)0x8000000000000000ULL)/* range requires runtime mapping */ #define EFI_MEMORY_DESCRIPTOR_VERSION 1
Greg Kroah-Hartman
maintainerPATCH 380/620 cgroup: fix race between fork and cgroup.kill
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shakeel Butt <[email protected]>
commit b69bb476dee99d564d65d418e9a20acca6f32c3f upstream.
Tejun reported the following race between fork() and cgroup.kill at [1].
Tejun:
I was looking at cgroup.kill implementation and wondering whether there could be a race window. So, __cgroup_kill() does the following:
k1. Set CGRP_KILL.
k2. Iterate tasks and deliver SIGKILL.
k3. Clear CGRP_KILL.
The copy_process() does the following:
c1. Copy a bunch of stuff.
c2. Grab siglock.
c3. Check fatal_signal_pending().
c4. Commit to forking.
c5. Release siglock.
c6. Call cgroup_post_fork() which puts the task on the css_set and tests
CGRP_KILL.
The intention seems to be that either a forking task gets SIGKILL and terminates on c3 or it sees CGRP_KILL on c6 and kills the child. However, I don't see what guarantees that k3 can't happen before c6. ie. After a forking task passes c5, k2 can take place and then before the forking task reaches c6, k3 can happen. Then, nobody would send SIGKILL to the child. What am I missing?
This is indeed a race. One way to fix this race is by taking cgroup_threadgroup_rwsem in write mode in __cgroup_kill() as the fork() side takes cgroup_threadgroup_rwsem in read mode from cgroup_can_fork() to cgroup_post_fork(). However that would be heavy handed as this adds one more potential stall scenario for cgroup.kill which is usually called under extreme situation like memory pressure.
To fix this race, let's maintain a sequence number per cgroup which gets incremented on __cgroup_kill() call. On the fork() side, the cgroup_can_fork() will cache the sequence number locally and recheck it against the cgroup's sequence number at cgroup_post_fork() site. If the sequence numbers mismatch, it means __cgroup_kill() can been called and we should send SIGKILL to the newly created task.
--- include/linux/cgroup-defs.h | 6 +++--- include/linux/sched/task.h | 1 + kernel/cgroup/cgroup.c | 20 ++++++++++++-------- 3 files changed, 16 insertions(+), 11 deletions(-)
include/linux/cgroup-defs.h +3 -3
@@ -71,9 +71,6 @@ enum {/* Cgroup is frozen. */ CGRP_FROZEN, - -/* Control group has to be killed. */ - CGRP_KILL, };/* cgroup_root->flags */
@@ -407,6 +404,9 @@ struct cgroup {int nr_threaded_children;/* # of live threaded child cgroups */ +/* sequence number for cgroup.kill, serialized by css_set_lock. */ +unsigned int kill_seq; +struct kernfs_node *kn;/* cgroup kernfs entry */ struct cgroup_file procs_file;/* handle for "cgroup.procs" */ struct cgroup_file events_file;/* handle for "cgroup.events" */
include/linux/sched/task.h +1 -0
@@ -34,6 +34,7 @@ struct kernel_clone_args {int io_thread;struct cgroup *cgrp;struct css_set *cset; +unsigned int kill_seq; };/*
kernel/cgroup/cgroup.c +12 -8
@@ -3818,7 +3818,7 @@ static void __cgroup_kill(struct cgrouplockdep_assert_held (&cgroup_mutex);spin_lock_irq (&css_set_lock); -set_bit (CGRP_KILL , &cgrp->flags); + cgrp->kill_seq++;spin_unlock_irq (&css_set_lock);css_task_iter_start (&cgrp->self,CSS_TASK_ITER_PROCS |CSS_TASK_ITER_THREADED , &it);
@@ -3834,10 +3834,6 @@ static void __cgroup_kill(struct cgroupsend_sig (SIGKILL , task,0 ); }css_task_iter_end (&it); - -spin_lock_irq (&css_set_lock); -clear_bit (CGRP_KILL , &cgrp->flags); -spin_unlock_irq (&css_set_lock); }static void cgroup_kill (struct cgroup *cgrp)
@@ -6202,6 +6198,10 @@ static int cgroup_css_set_fork(struct kespin_lock_irq (&css_set_lock); cset =task_css_set (current);get_css_set (cset); +if (kargs->cgrp) + kargs->kill_seq = kargs->cgrp->kill_seq; +else + kargs->kill_seq = cset->dfl_cgrp->kill_seq;spin_unlock_irq (&css_set_lock);if (!(kargs->flags &CLONE_INTO_CGROUP )) {
@@ -6369,6 +6369,7 @@ void cgroup_post_fork(struct task_struct struct kernel_clone_args *kargs) __releases(&cgroup_threadgroup_rwsem) __releases(&cgroup_mutex) { + unsigned int cgrp_kill_seq = 0; unsigned long cgrp_flags = 0; bool kill = false; struct cgroup_subsys *ss;
@@ -6382,10 +6383,13 @@ void cgroup_post_fork(struct task_struct/* init tasks are special, only link regular threads */ if (likely (child->pid)) { -if (kargs->cgrp) +if (kargs->cgrp) { cgrp_flags = kargs->cgrp->flags; -else + cgrp_kill_seq = kargs->cgrp->kill_seq; + }else { cgrp_flags = cset->dfl_cgrp->flags; + cgrp_kill_seq = cset->dfl_cgrp->kill_seq; + }WARN_ON_ONCE (!list_empty (&child->cg_list)); cset->nr_tasks++;
@@ -6420,7 +6424,7 @@ void cgroup_post_fork(struct task_struct* child down right after we finished preparing it for * userspace. */ - kill =test_bit (CGRP_KILL , &cgrp_flags); + kill = kargs->kill_seq != cgrp_kill_seq; }spin_unlock_irq (&css_set_lock);
Greg Kroah-Hartman
maintainerPATCH 381/620 serial: 8250: Fix fifo underflow on flush
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Keeping <[email protected]>
commit 9e512eaaf8f4008c44ede3dfc0fbc9d9c5118583 upstream.
When flushing the serial port's buffer, uart_flush_buffer() calls kfifo_reset() but if there is an outstanding DMA transfer then the completion function will consume data from the kfifo via uart_xmit_advance(), underflowing and leading to ongoing DMA as the driver tries to transmit another 2^32 bytes.
This is readily reproduced with serial-generic and amidi sending even short messages as closing the device on exit will wait for the fifo to drain and in the underflow case amidi hangs for 30 seconds on exit in tty_wait_until_sent(). A trace of that gives:
kworker/1:1-84 [001] 51.769423: bprint: serial8250_tx_dma: tx_size=3 fifo_len=3
amidi-763 [001] 51.769460: bprint: uart_flush_buffer: resetting fifo
irq/21-fe530000-76 [000] 51.769474: bprint: __dma_tx_complete: tx_size=3
irq/21-fe530000-76 [000] 51.769479: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294967293
irq/21-fe530000-76 [000] 51.781295: bprint: __dma_tx_complete: tx_size=4096
irq/21-fe530000-76 [000] 51.781301: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294963197
irq/21-fe530000-76 [000] 51.793131: bprint: __dma_tx_complete: tx_size=4096
irq/21-fe530000-76 [000] 51.793135: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294959101
irq/21-fe530000-76 [000] 51.804949: bprint: __dma_tx_complete: tx_size=4096Since the port lock is held in when the kfifo is reset in uart_flush_buffer() and in __dma_tx_complete(), adding a flush_buffer hook to adjust the outstanding DMA byte count is sufficient to avoid the kfifo underflow.
--- drivers/tty/serial/8250/8250.h | 2 ++ drivers/tty/serial/8250/8250_dma.c | 16 ++++++++++++++++ drivers/tty/serial/8250/8250_port.c | 9 +++++++++ 3 files changed, 27 insertions(+)
drivers/tty/serial/8250/8250.h +2 -0
@@ -328,6 +328,7 @@ static inline int is_omap1510_8250(struc#ifdef CONFIG_SERIAL_8250_DMA extern int serial8250_tx_dma (struct uart_8250_port *); +extern void serial8250_tx_dma_flush (struct uart_8250_port *);extern int serial8250_rx_dma (struct uart_8250_port *);extern void serial8250_rx_dma_flush (struct uart_8250_port *);extern int serial8250_request_dma (struct uart_8250_port *);
@@ -360,6 +361,7 @@ static inline int serial8250_tx_dma(stru {return -1 ; } +static inline void serial8250_tx_dma_flush (struct uart_8250_port *p) { }static inline int serial8250_rx_dma (struct uart_8250_port *p) {return -1 ;
drivers/tty/serial/8250/8250_dma.c +16 -0
@@ -137,6 +137,22 @@ err:return ret; } +void serial8250_tx_dma_flush (struct uart_8250_port *p) +{ +struct uart_8250_dma *dma = p->dma; + +if (!dma->tx_running) +return ; + +/* +* kfifo_reset() has been called by the serial core, avoid +* advancing and underflowing in __dma_tx_complete(). +*/ + dma->tx_size =0 ; + +dmaengine_terminate_async (dma->rxchan); +} +int serial8250_rx_dma (struct uart_8250_port *p) {struct uart_8250_dma *dma = p->dma;
drivers/tty/serial/8250/8250_port.c +9 -0
@@ -2512,6 +2512,14 @@ static unsigned int npcm_get_divisor(strreturn DIV_ROUND_CLOSEST (port->uartclk,16 * baud +2 ) -2 ; } +static void serial8250_flush_buffer (struct uart_port *port) +{ +struct uart_8250_port *up =up_to_u8250p (port); + +if (up->dma) +serial8250_tx_dma_flush (up); +} +static unsigned int serial8250_do_get_divisor (struct uart_port *port,unsigned int baud,unsigned int *frac)
@@ -3238,6 +3246,7 @@ static const struct uart_ops serial8250_ .break_ctl = serial8250_break_ctl, .startup = serial8250_startup, .shutdown = serial8250_shutdown, + .flush_buffer = serial8250_flush_buffer, .set_termios = serial8250_set_termios, .set_ldisc = serial8250_set_ldisc, .pm = serial8250_pm,
Greg Kroah-Hartman
maintainerPATCH 382/620 alpha: align stack for page fault and user unaligned trap handlers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Kokshaysky <[email protected]>
commit 3b35a171060f846b08b48646b38c30b5d57d17ff upstream.
do_page_fault() and do_entUna() are special because they use non-standard stack frame layout. Fix them manually.
--- arch/alpha/kernel/entry.S | 20 ++++++++++---------- arch/alpha/kernel/traps.c | 2 +- arch/alpha/mm/fault.c | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-)
arch/alpha/kernel/entry.S +10 -10
@@ -199,8 +199,8 @@ CFI_END_OSF_FRAME entArith CFI_START_OSF_FRAME entMM SAVE_ALL /* save $9 - $15 so the inline exception code can manipulate them. */ - subq $sp, 56, $sp - .cfi_adjust_cfa_offset 56 + subq $sp, 64, $sp + .cfi_adjust_cfa_offset 64 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp)
@@ -215,7 +215,7 @@ CFI_START_OSF_FRAME entMM .cfi_rel_offset $13, 32 .cfi_rel_offset $14, 40 .cfi_rel_offset $15, 48 - addq $sp, 56, $19 + addq $sp, 64, $19 /* handle the fault */ lda $8, 0x3fff bic $sp, $8, $8
@@ -228,7 +228,7 @@ CFI_START_OSF_FRAME entMM ldq $13, 32($sp) ldq $14, 40($sp) ldq $15, 48($sp) - addq $sp, 56, $sp + addq $sp, 64, $sp .cfi_restore $9 .cfi_restore $10 .cfi_restore $11
@@ -236,7 +236,7 @@ CFI_START_OSF_FRAME entMM .cfi_restore $13 .cfi_restore $14 .cfi_restore $15 - .cfi_adjust_cfa_offset -56 + .cfi_adjust_cfa_offset -64 /* finish up the syscall as normal. */ br ret_from_sys_call CFI_END_OSF_FRAME entMM
@@ -383,8 +383,8 @@ entUnaUser: .cfi_restore $0 .cfi_adjust_cfa_offset -256 SAVE_ALL /* setup normal kernel stack */ - lda $sp, -56($sp) - .cfi_adjust_cfa_offset 56 + lda $sp, -64($sp) + .cfi_adjust_cfa_offset 64 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp)
@@ -400,7 +400,7 @@ entUnaUser: .cfi_rel_offset $14, 40 .cfi_rel_offset $15, 48 lda $8, 0x3fff - addq $sp, 56, $19 + addq $sp, 64, $19 bic $sp, $8, $8 jsr $26, do_entUnaUser ldq $9, 0($sp)
@@ -410,7 +410,7 @@ entUnaUser: ldq $13, 32($sp) ldq $14, 40($sp) ldq $15, 48($sp) - lda $sp, 56($sp) + lda $sp, 64($sp) .cfi_restore $9 .cfi_restore $10 .cfi_restore $11
@@ -418,7 +418,7 @@ entUnaUser: .cfi_restore $13 .cfi_restore $14 .cfi_restore $15 - .cfi_adjust_cfa_offset -56 + .cfi_adjust_cfa_offset -64 br ret_from_sys_call CFI_END_OSF_FRAME entUna
arch/alpha/kernel/traps.c +1 -1
@@ -709,7 +709,7 @@ s_reg_to_mem (unsigned long s_reg)static int unauser_reg_offsets[32 ] = {R (r0),R (r1),R (r2),R (r3),R (r4),R (r5),R (r6),R (r7),R (r8),/* r9 ... r15 are stored in front of regs. */ --56 ,-48 ,-40 ,-32 ,-24 ,-16 ,-8 , +-64 ,-56 ,-48 ,-40 ,-32 ,-24 ,-16 ,/* padding at -8 */ R (r16),R (r17),R (r18),R (r19),R (r20),R (r21),R (r22),R (r23),R (r24),R (r25),R (r26),R (r27),R (r28),R (gp),
arch/alpha/mm/fault.c +2 -2
@@ -78,8 +78,8 @@ __load_new_mm_context(struct mm_struct */* Macro for exception fixup code to access integer registers. */ #define dpf_reg (r) \ - (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \ - (r) <= 18 ? (r)+10 : (r)-10]) + (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-17 : \ + (r) <= 18 ? (r)+11 : (r)-10]) asmlinkage void do_page_fault(unsigned long address, unsigned long mmcsr,
Greg Kroah-Hartman
maintainerPATCH 383/620 gpio: stmpe: Check return value of stmpe_reg_read in stmpe_gpio_irq_sync_unlock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit b9644fbfbcab13da7f8b37bef7c51e5b8407d031 upstream.
The stmpe_reg_read function can fail, but its return value is not checked in stmpe_gpio_irq_sync_unlock. This can lead to silent failures and incorrect behavior if the hardware access fails.
This patch adds checks for the return value of stmpe_reg_read. If the function fails, an error message is logged and the function returns early to avoid further issues.
--- drivers/gpio/gpio-stmpe.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpio/gpio-stmpe.c +12 -3
@@ -191,7 +191,7 @@ static void stmpe_gpio_irq_sync_unlock(s [REG_IE][CSB] = STMPE_IDX_IEGPIOR_CSB, [REG_IE][MSB] = STMPE_IDX_IEGPIOR_MSB, }; -int i, j; +int ret, i, j;/* * STMPE1600: to be able to get IRQ from pins,
@@ -199,8 +199,16 @@ static void stmpe_gpio_irq_sync_unlock(s* GPSR or GPCR registers */ if (stmpe->partnum ==STMPE1600 ) { -stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB ]); -stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB ]); + ret =stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB ]); +if (ret <0 ) { +dev_err (stmpe->dev,"Failed to read GPMR_LSB: %d\n" , ret); + goto err; + } + ret =stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB ]); +if (ret <0 ) { +dev_err (stmpe->dev,"Failed to read GPMR_CSB: %d\n" , ret); + goto err; + } }for (i =0 ; i <CACHE_NR_REGS ; i++) {
@@ -222,6 +230,7 @@ static void stmpe_gpio_irq_sync_unlock(s } } +err:mutex_unlock (&stmpe_gpio->irq_lock); }
Greg Kroah-Hartman
maintainerPATCH 384/620 partitions: mac: fix handling of bogus partition table
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 80e648042e512d5a767da251d44132553fe04ae0 upstream.
Fix several issues in partition probing:
- The bailout for a bad partoffset must use put_dev_sector(), since the preceding read_part_sector() succeeded.
- If the partition table claims a silly sector size like 0xfff bytes (which results in partition table entries straddling sector boundaries), bail out instead of accessing out-of-bounds memory.
- We must not assume that the partition table contains proper NUL termination - use strnlen() and strncmp() instead of strlen() and strcmp().
--- block/partitions/mac.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
block/partitions/mac.c +15 -3
@@ -51,13 +51,25 @@ int mac_partition(struct parsed_partitio } secsize =be16_to_cpu (md->block_size);put_dev_sector (sect); + +/* +* If the "block size" is not a power of 2, things get weird - we might +* end up with a partition straddling a sector boundary, so we wouldn't +* be able to read a partition entry with read_part_sector(). +* Real block sizes are probably (?) powers of two, so just require +* that. +*/ +if (!is_power_of_2 (secsize)) +return -1 ; datasize =round_down (secsize,512 ); data =read_part_sector (state, datasize /512 , §);if (!data)return -1 ; partoffset = secsize %512 ; -if (partoffset +sizeof (*part) > datasize) +if (partoffset +sizeof (*part) > datasize) { +put_dev_sector (sect);return -1 ; + } part = (struct mac_partition *) (data + partoffset);if (be16_to_cpu (part->signature) !=MAC_PARTITION_MAGIC ) {put_dev_sector (sect);
@@ -110,8 +122,8 @@ int mac_partition(struct parsed_partitioint i, l; goodness++; - l =strlen (part->name); -if (strcmp (part->name,"/" ) ==0 ) + l =strnlen (part->name,sizeof (part->name)); +if (strncmp (part->name,"/" ,sizeof (part->name)) ==0 ) goodness++;for (i =0 ; i <= l -4 ; ++i) { if (strncasecmp(part->name + i, "root",
Greg Kroah-Hartman
maintainerPATCH 385/620 regmap-irq: Add missing kfree()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit 32ffed055dcee17f6705f545b069e44a66067808 upstream.
Add kfree() for "d->main_status_buf" to the error-handling path to prevent a memory leak.
--- drivers/base/regmap/regmap-irq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/regmap/regmap-irq.c +2 -0
@@ -904,6 +904,7 @@ err_alloc:kfree (d->wake_buf);kfree (d->mask_buf_def);kfree (d->mask_buf); +kfree (d->main_status_buf);kfree (d->status_buf);kfree (d->status_reg_buf);if (d->virt_buf) {
@@ -979,6 +980,7 @@ void regmap_del_irq_chip(int irq, structkfree (d->wake_buf);kfree (d->mask_buf_def);kfree (d->mask_buf); +kfree (d->main_status_buf);kfree (d->status_reg_buf);kfree (d->status_buf);kfree (d);
Greg Kroah-Hartman
maintainerPATCH 386/620 arm64: Handle .ARM.attributes section in linker scripts
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit ca0f4fe7cf7183bfbdc67ca2de56ae1fc3a8db2b upstream.
A recent LLVM commit [1] started generating an .ARM.attributes section similar to the one that exists for 32-bit, which results in orphan section warnings (or errors if CONFIG_WERROR is enabled) from the linker because it is not handled in the arm64 linker scripts.
ld.lld: error: arch/arm64/kernel/vdso/vgettimeofday.o:(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: arch/arm64/kernel/vdso/vgetrandom.o:(.ARM.attributes) is being placed in '.ARM.attributes'
ld.lld: error: vmlinux.a(lib/vsprintf.o):(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: vmlinux.a(lib/win_minmax.o):(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: vmlinux.a(lib/xarray.o):(.ARM.attributes) is being placed in '.ARM.attributes'
Discard the new sections in the necessary linker scripts to resolve the warnings, as the kernel and vDSO do not need to retain it, similar to the .note.gnu.property section.
--- arch/arm64/kernel/vdso/vdso.lds.S | 1 + arch/arm64/kernel/vmlinux.lds.S | 1 + 2 files changed, 2 insertions(+)
arch/arm64/kernel/vdso/vdso.lds.S +1 -0
@@ -37,6 +37,7 @@ SECTIONS */ /DISCARD/ : { *(.note.GNU-stack .note.gnu.property) + *(.ARM.attributes) } .note : { *(.note.*) } :text :note
arch/arm64/kernel/vmlinux.lds.S +1 -0
@@ -139,6 +139,7 @@ SECTIONS /DISCARD/ : { *(.interp .dynamic) *(.dynsym .dynstr .hash .gnu.hash) + *(.ARM.attributes) } . = KIMAGE_VADDR;
Greg Kroah-Hartman
maintainerPATCH 387/620 mlxsw: Add return value check for mlxsw_sp_port_get_stats_raw()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit fee5d688940690cc845937459e340e4e02598e90 upstream.
Add a check for the return value of mlxsw_sp_port_get_stats_raw() in __mlxsw_sp_port_get_stats(). If mlxsw_sp_port_get_stats_raw() returns an error, exit the function to prevent further processing with potentially invalid data.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +3 -1
@@ -761,7 +761,9 @@ static void __mlxsw_sp_port_get_stats(st err =mlxsw_sp_get_hw_stats_by_group (&hw_stats, &len, grp);if (err)return ; -mlxsw_sp_port_get_stats_raw (dev, grp, prio, ppcnt_pl); + err =mlxsw_sp_port_get_stats_raw (dev, grp, prio, ppcnt_pl); +if (err) +return ;for (i =0 ; i < len; i++) { data[data_index + i] = hw_stats[i].getter (ppcnt_pl);if (!hw_stats[i].cells_bytes)
Greg Kroah-Hartman
maintainerPATCH 388/620 btrfs: fix hole expansion when writing at an offset beyond EOF
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit da2dccd7451de62b175fb8f0808d644959e964c7 upstream.
At btrfs_write_check() if our file's i_size is not sector size aligned and we have a write that starts at an offset larger than the i_size that falls within the same page of the i_size, then we end up not zeroing the file range [i_size, write_offset).
The code is this:
start_pos = round_down(pos, fs_info->sectorsize);
oldsize = i_size_read(inode);
if (start_pos > oldsize) {
/* Expand hole size to cover write data, preventing empty gap */
loff_t end_pos = round_up(pos + count, fs_info->sectorsize);
ret = btrfs_cont_expand(BTRFS_I(inode), oldsize, end_pos);
if (ret)
return ret;
}So if our file's i_size is 90269 bytes and a write at offset 90365 bytes comes in, we get 'start_pos' set to 90112 bytes, which is less than the i_size and therefore we don't zero out the range [90269, 90365) by calling btrfs_cont_expand().
This is an old bug introduced in commit 9036c10208e1 ("Btrfs: update hole handling v2"), from 2008, and the buggy code got moved around over the years.
Fix this by discarding 'start_pos' and comparing against the write offset ('pos') without any alignment.
This bug was recently exposed by test case generic/363 which tests this scenario by polluting ranges beyond EOF with an mmap write and than verify that after a file increases we get zeroes for the range which is supposed to be a hole and not what we wrote with the previous mmaped write.
We're only seeing this exposed now because generic/363 used to run only on xfs until last Sunday's fstests update.
The test was failing like this:
$ ./check generic/363 FSTYP -- btrfs PLATFORM -- Linux/x86_64 debian0 6.13.0-rc7-btrfs-next-185+ #17 SMP PREEMPT_DYNAMIC Mon Feb 3 12:28:46 WET 2025 MKFS_OPTIONS -- /dev/sdc MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1
generic/363 0s ... [failed, exit status 1]- output mismatch (see /home/fdmanana/git/hub/xfstests/results//generic/363.out.bad)
# --- tests/generic/363.out 2025-02-05 15:31:14.013646509 +0000
# +++ /home/fdmanana/git/hub/xfstests/results//generic/363.out.bad 2025-02-05 17:25:33.112630781 +0000
@@ -1 +1,46 @@
QA output created by 363
+READ BAD DATA: offset = 0xdcad, size = 0xd921, fname = /home/fdmanana/btrfs-tests/dev/junk
+OFFSET GOOD BAD RANGE
+0x1609d 0x0000 0x3104 0x0
+operation# (mod 256) for the bad data may be 4
+0x1609e 0x0000 0x0472 0x1
+operation# (mod 256) for the bad data may be 4
...
(Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/generic/363.out /home/fdmanana/git/hub/xfstests/results//generic/363.out.bad' to see the entire diff)
Ran: generic/363
Failures: generic/363
Failed 1 of 1 tests
--- fs/btrfs/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/btrfs/file.c +1 -3
@@ -1607,7 +1607,6 @@ static int btrfs_write_check(struct kiocloff_t pos = iocb->ki_pos;int ret;loff_t oldsize; -loff_t start_pos;if (iocb->ki_flags &IOCB_NOWAIT ) {size_t nocow_bytes = count;
@@ -1637,9 +1636,8 @@ static int btrfs_write_check(struct kioc*/ update_time_for_write (inode); - start_pos =round_down (pos, fs_info->sectorsize); oldsize =i_size_read (inode); -if (start_pos > oldsize) { +if (pos > oldsize) {/* Expand hole size to cover write data, preventing empty gap */ loff_t end_pos =round_up (pos + count, fs_info->sectorsize);
Greg Kroah-Hartman
maintainerPATCH 389/620 clocksource: Replace cpumask_weight() with cpumask_empty()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yury Norov <[email protected]>
[ Upstream commit 8afbcaf8690dac19ebf570a4e4fef9c59c75bf8e ]
clocksource_verify_percpu() calls cpumask_weight() to check if any bit of a given cpumask is set.
This can be done more efficiently with cpumask_empty() because cpumask_empty() stops traversing the cpumask as soon as it finds first set bit, while cpumask_weight() counts all bits unconditionally.
Stable-dep-of: 6bb05a33337b ("clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context")
--- kernel/time/clocksource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/clocksource.c +1 -1
@@ -344,7 +344,7 @@ void clocksource_verify_percpu(struct clocksource *cs)cpus_read_lock ();preempt_disable ();clocksource_verify_choose_cpus (); -if (cpumask_weight (&cpus_chosen) ==0 ) { +if (cpumask_empty (&cpus_chosen)) {preempt_enable ();cpus_read_unlock ();pr_warn ("Not enough CPUs to check clocksource '%s'.\n" , cs->name);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 390/620 clocksource: Use pr_info() for "Checking clocksource synchronization" message
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 1f566840a82982141f94086061927a90e79440e5 ]
The "Checking clocksource synchronization" message is normally printed when clocksource_verify_percpu() is called for a given clocksource if both the CLOCK_SOURCE_UNSTABLE and CLOCK_SOURCE_VERIFY_PERCPU flags are set.
It is an informational message and so pr_info() is the correct choice.
Stable-dep-of: 6bb05a33337b ("clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context")
--- kernel/time/clocksource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/time/clocksource.c +2 -1
@@ -351,7 +351,8 @@ void clocksource_verify_percpu(struct clocksource *cs)return ; } testcpu =smp_processor_id (); -pr_warn ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , cs->name, testcpu,cpumask_pr_args (&cpus_chosen)); +pr_info ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , + cs->name, testcpu,cpumask_pr_args (&cpus_chosen));for_each_cpu (cpu, &cpus_chosen) {if (cpu == testcpu)continue ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 391/620 clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 6bb05a33337b2c842373857b63de5c9bf1ae2a09 ]
The following bug report happened with a PREEMPT_RT kernel:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2012, name: kwatchdog preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 get_random_u32+0x4f/0x110 clocksource_verify_choose_cpus+0xab/0x1a0 clocksource_verify_percpu.part.0+0x6b/0x330 clocksource_watchdog_kthread+0x193/0x1a0
It is due to the fact that clocksource_verify_choose_cpus() is invoked with preemption disabled. This function invokes get_random_u32() to obtain random numbers for choosing CPUs. The batched_entropy_32 local lock and/or the base_crng.lock spinlock in driver/char/random.c will be acquired during the call. In PREEMPT_RT kernel, they are both sleeping locks and so cannot be acquired in atomic context.
Fix this problem by using migrate_disable() to allow smp_processor_id() to be reliably used without introducing atomic context. preempt_disable() is then called after clocksource_verify_choose_cpus() but before the clocksource measurement is being run to avoid introducing unexpected latency.
--- kernel/time/clocksource.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/time/clocksource.c +4 -2
@@ -342,10 +342,10 @@ void clocksource_verify_percpu(struct clocksource *cs)cpumask_clear (&cpus_ahead);cpumask_clear (&cpus_behind);cpus_read_lock (); -preempt_disable (); +migrate_disable ();clocksource_verify_choose_cpus ();if (cpumask_empty (&cpus_chosen)) { -preempt_enable (); +migrate_enable ();cpus_read_unlock ();pr_warn ("Not enough CPUs to check clocksource '%s'.\n" , cs->name);return ;
@@ -353,6 +353,7 @@ void clocksource_verify_percpu(struct clocksource *cs) testcpu =smp_processor_id ();pr_info ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , cs->name, testcpu,cpumask_pr_args (&cpus_chosen)); +preempt_disable ();for_each_cpu (cpu, &cpus_chosen) {if (cpu == testcpu)continue ;
@@ -372,6 +373,7 @@ void clocksource_verify_percpu(struct clocksource *cs) cs_nsec_min = cs_nsec; }preempt_enable (); +migrate_enable ();cpus_read_unlock ();if (!cpumask_empty (&cpus_ahead)) pr_warn(" CPUs %*pbl ahead of CPU %d for clocksource %s.\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 392/620 ipv4: add RCU protection to ip4_dst_hoplimit()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 469308552ca4560176cfc100e7ca84add1bebd7c ]
ip4_dst_hoplimit() must use RCU protection to make sure the net structure it reads does not disappear.
--- include/net/route.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
include/net/route.h +7 -2
@@ -357,10 +357,15 @@ static inline int inet_iif(const struct sk_buff *skb)static inline int ip4_dst_hoplimit (const struct dst_entry *dst) {int hoplimit =dst_metric_raw (dst,RTAX_HOPLIMIT ); -struct net *net =dev_net (dst->dev); -if (hoplimit ==0 ) +if (hoplimit ==0 ) { +const struct net *net; + +rcu_read_lock (); + net =dev_net_rcu (dst->dev); hoplimit =READ_ONCE (net->ipv4.sysctl_ip_default_ttl); +rcu_read_unlock (); + }return hoplimit; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 393/620 net: treat possible_net_t net pointer as an RCU one and add read_pnet_rcu()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit 2034d90ae41ae93e30d492ebcf1f06f97a9cfba6 ]
Make the net pointer stored in possible_net_t structure annotated as an RCU pointer. Change the access helpers to treat it as such. Introduce read_pnet_rcu() helper to allow caller to dereference the net pointer under RCU read lock.
Stable-dep-of: dd205fcc33d9 ("ipv4: use RCU protection in rt_is_expired()")
--- include/net/net_namespace.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
include/net/net_namespace.h +12 -3
@@ -316,21 +316,30 @@ static inline int check_net(const struct net *net)typedef struct {#ifdef CONFIG_NET_NS -struct net *net; +struct net __rcu *net;#endif }possible_net_t ;static inline void write_pnet (possible_net_t *pnet,struct net *net) {#ifdef CONFIG_NET_NS - pnet->net = net; +rcu_assign_pointer (pnet->net, net);#endif }static inline struct net *read_pnet (const possible_net_t *pnet) {#ifdef CONFIG_NET_NS -return pnet->net; +return rcu_dereference_protected (pnet->net, true); +#else +return &init_net; +#endif +} + +static inline struct net *read_pnet_rcu (possible_net_t *pnet) +{ +#ifdef CONFIG_NET_NS +return rcu_dereference (pnet->net);#else return &init_net;#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 394/620 net: add dev_net_rcu() helper
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 482ad2a4ace2740ca0ff1cbc8f3c7f862f3ab507 ]
dev->nd_net can change, readers should either
use rcu_read_lock() or RTNL.
We currently use a generic helper, dev_net() with no debugging support. We probably have many hidden bugs.
Add dev_net_rcu() helper for callers using rcu_read_lock() protection.
Stable-dep-of: dd205fcc33d9 ("ipv4: use RCU protection in rt_is_expired()")
--- include/linux/netdevice.h | 6 ++++++ include/net/net_namespace.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
include/linux/netdevice.h +6 -0
@@ -2454,6 +2454,12 @@ struct net *dev_net(const struct net_device *dev)return read_pnet (&dev->nd_net); } +static inline +struct net *dev_net_rcu (const struct net_device *dev) +{ +return read_pnet_rcu (&dev->nd_net); +} +static inline void dev_net_set (struct net_device *dev,struct net *net) {
include/net/net_namespace.h +1 -1
@@ -336,7 +336,7 @@ static inline struct net *read_pnet(const possible_net_t *pnet)#endif } -static inline struct net *read_pnet_rcu (possible_net_t *pnet) +static inline struct net *read_pnet_rcu (const possible_net_t *pnet) {#ifdef CONFIG_NET_NS return rcu_dereference (pnet->net);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 395/620 ipv4: use RCU protection in rt_is_expired()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit dd205fcc33d92d54eee4d7f21bb073af9bd5ce2b ]
rt_is_expired() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/route.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/ipv4/route.c +7 -1
@@ -400,7 +400,13 @@ static inline int ip_rt_proc_init(void)static inline bool rt_is_expired (const struct rtable *rth) { -return rth->rt_genid !=rt_genid_ipv4 (dev_net (rth->dst.dev)); +bool res; + +rcu_read_lock (); + res = rth->rt_genid !=rt_genid_ipv4 (dev_net_rcu (rth->dst.dev)); +rcu_read_unlock (); + +return res; }void rt_cache_flush (struct net *net)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 396/620 ipv4: use RCU protection in inet_select_addr()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 719817cd293e4fa389e1f69c396f3f816ed5aa41 ]
inet_select_addr() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/devinet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/devinet.c +2 -1
@@ -1316,10 +1316,11 @@ __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope)__be32 addr =0 ;unsigned char localnet_scope =RT_SCOPE_HOST ;struct in_device *in_dev; -struct net *net =dev_net (dev); +struct net *net;int master_idx;rcu_read_lock (); + net =dev_net_rcu (dev); in_dev =__in_dev_get_rcu (dev);if (!in_dev) goto no_in_dev;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 397/620 Namespaceify min_pmtu sysctl
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: xu xin <[email protected]>
[ Upstream commit 1de6b15a434c0068253fea5d719f71143e7e3a79 ]
This patch enables the sysctl min_pmtu to be configured per net namespace.
Stable-dep-of: 139512191bd0 ("ipv4: use RCU protection in __ip_rt_update_pmtu()")
--- include/net/netns/ipv4.h | 2 ++ net/ipv4/route.c | 53 ++++++++++++++++++++++++++++------------ 2 files changed, 39 insertions(+), 16 deletions(-)
include/net/netns/ipv4.h +2 -0
@@ -84,6 +84,8 @@ struct netns_ipv4 {int sysctl_icmp_ratelimit;int sysctl_icmp_ratemask; +u32 ip_rt_min_pmtu; +struct local_ports ip_local_ports;u8 sysctl_tcp_ecn;
net/ipv4/route.c +37 -16
127 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 398/620 Namespaceify mtu_expires sysctl
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: xu xin <[email protected]>
[ Upstream commit 1135fad204805518462c1f0caaca6bcd52ba78cf ]
This patch enables the sysctl mtu_expires to be configured per net namespace.
Stable-dep-of: 139512191bd0 ("ipv4: use RCU protection in __ip_rt_update_pmtu()")
--- include/net/netns/ipv4.h | 1 + net/ipv4/route.c | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -85,6 +85,7 @@ struct netns_ipv4 {int sysctl_icmp_ratemask;u32 ip_rt_min_pmtu; +int ip_rt_mtu_expires;struct local_ports ip_local_ports;
net/ipv4/route.c +11 -10
@@ -119,6 +119,7 @@#define RT_GC_TIMEOUT (300*HZ)#define DEFAULT_MIN_PMTU (512 + 20 + 20) +#define DEFAULT_MTU_EXPIRES (10 * 60 * HZ)static int ip_rt_max_size;static int ip_rt_redirect_number__read_mostly =9 ;
@@ -126,7 +127,6 @@ static int ip_rt_redirect_load __read_mostly = HZ / 50;static int ip_rt_redirect_silence__read_mostly = ((HZ /50 ) << (9 +1 ));static int ip_rt_error_cost__read_mostly =HZ ;static int ip_rt_error_burst__read_mostly =5 *HZ ; -static int ip_rt_mtu_expires__read_mostly =10 *60 *HZ ;static int ip_rt_min_advmss__read_mostly =256 ;static int ip_rt_gc_timeout__read_mostly =RT_GC_TIMEOUT ;
@@ -1041,7 +1041,7 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) }if (rt->rt_pmtu == mtu && !lock && -time_before (jiffies, dst->expires - ip_rt_mtu_expires /2 )) +time_before (jiffies, dst->expires - net->ipv4.ip_rt_mtu_expires /2 ))return ;rcu_read_lock ();
@@ -1051,7 +1051,7 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)fib_select_path (net, &res, fl4,NULL ); nhc =FIB_RES_NHC (res);update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, - jiffies + ip_rt_mtu_expires); + jiffies + net->ipv4.ip_rt_mtu_expires); }rcu_read_unlock (); }
@@ -3572,13 +3572,6 @@ static struct ctl_table ipv4_route_table[] = { .mode = 0644, .proc_handler = proc_dointvec, }, - { - .procname = "mtu_expires", - .data = &ip_rt_mtu_expires, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_jiffies, - }, { .procname = "min_adv_mss", .data = &ip_rt_min_advmss,
@@ -3606,6 +3599,13 @@ static struct ctl_table ipv4_route_netns_table[] = { .proc_handler = proc_dointvec_minmax, .extra1 = &ip_min_valid_pmtu, }, + { + .procname = "mtu_expires", + .data = &init_net.ipv4.ip_rt_mtu_expires, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_jiffies, + }, { }, };
@@ -3667,6 +3667,7 @@ static __net_init int netns_ip_rt_init(struct net *net) {/* Set default value for namespaceified sysctls */ net->ipv4.ip_rt_min_pmtu =DEFAULT_MIN_PMTU ; + net->ipv4.ip_rt_mtu_expires =DEFAULT_MTU_EXPIRES ;return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 399/620 selftest: net: Test IPv4 PMTU exceptions with DSCP and ECN
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
[ Upstream commit ec730c3e1f0e3a80612a9be2beb00e2b4f93fe70 ]
Add two tests to pmtu.sh, for verifying that PMTU exceptions get properly created for routes that don't belong to the main table.
A fib-rule based on the packet's DSCP field is used to jump to the correct table. ECN shouldn't interfere with this process, so each test has two components: one that only sets DSCP and one that sets both DSCP and ECN.
One of the test triggers PMTU exceptions using ICMP Echo Requests, the other using UDP packets (to test different handlers in the kernel).
A few adjustments are necessary in the rest of the script to allow policy routing scenarios:
* Add global variable rt_table that allows setup_routing_*() to add routes to a specific routing table. By default rt_table is set to "main", so existing tests don't need to be modified.
* Another global variable, policy_mark, is used to define which dsfield value is used for policy routing. This variable has no effect on tests that don't use policy routing.
* The UDP version of the test uses socat. So cleanup() now also need to kill socat PIDs.
* route_get_dst_pmtu_from_exception() and route_get_dst_exception() now take an optional third argument specifying the dsfield. If not specified, 0 is used, so existing users don't need to be modified.
Stable-dep-of: 139512191bd0 ("ipv4: use RCU protection in __ip_rt_update_pmtu()")
--- tools/testing/selftests/net/pmtu.sh | 141 +++++++++++++++++++++++++++- 1 file changed, 137 insertions(+), 4 deletions(-)
tools/testing/selftests/net/pmtu.sh +137 -4
@@ -26,6 +26,15 @@ # - pmtu_ipv6 # Same as pmtu_ipv4, except for locked PMTU tests, using IPv6 # +# - pmtu_ipv4_dscp_icmp_exception +# Set up the same network topology as pmtu_ipv4, but use non-default +# routing table in A. A fib-rule is used to jump to this routing table +# based on DSCP. Send ICMPv4 packets with the expected DSCP value and +# verify that ECN doesn't interfere with the creation of PMTU exceptions. +# +# - pmtu_ipv4_dscp_udp_exception +# Same as pmtu_ipv4_dscp_icmp_exception, but use UDP instead of ICMP. +# # - pmtu_ipv4_vxlan4_exception # Set up the same network topology as pmtu_ipv4, create a VXLAN tunnel # over IPv4 between A and B, routed via R1. On the link between R1 and B,
@@ -203,6 +212,8 @@ which ping6 > /dev/null 2>&1 && ping6=$(which ping6) || ping6=$(which ping) tests=" pmtu_ipv4_exception ipv4: PMTU exceptions 1 pmtu_ipv6_exception ipv6: PMTU exceptions 1 + pmtu_ipv4_dscp_icmp_exception ICMPv4 with DSCP and ECN: PMTU exceptions 1 + pmtu_ipv4_dscp_udp_exception UDPv4 with DSCP and ECN: PMTU exceptions 1 pmtu_ipv4_vxlan4_exception IPv4 over vxlan4: PMTU exceptions 1 pmtu_ipv6_vxlan4_exception IPv6 over vxlan4: PMTU exceptions 1 pmtu_ipv4_vxlan6_exception IPv4 over vxlan6: PMTU exceptions 1
@@ -323,6 +334,9 @@ routes_nh=" B 6 default 61 " +policy_mark=0x04 +rt_table=main + veth4_a_addr="192.168.1.1" veth4_b_addr="192.168.1.2" veth4_c_addr="192.168.2.10"
@@ -346,6 +360,7 @@ dummy6_mask="64" err_buf= tcpdump_pids= nettest_pids= +socat_pids= err() { err_buf="${err_buf}${1}
@@ -725,7 +740,7 @@ setup_routing_old() { ns_name="$(nsname ${ns})" - ip -n ${ns_name} route add ${addr} via ${gw} + ip -n "${ns_name}" route add "${addr}" table "${rt_table}" via "${gw}" ns=""; addr=""; gw="" done
@@ -755,7 +770,7 @@ setup_routing_new() { ns_name="$(nsname ${ns})" - ip -n ${ns_name} -${fam} route add ${addr} nhid ${nhid} + ip -n "${ns_name}" -"${fam}" route add "${addr}" table "${rt_table}" nhid "${nhid}" ns=""; fam=""; addr=""; nhid="" done
@@ -800,6 +815,24 @@ setup_routing() { return 0 } +setup_policy_routing() { + setup_routing + + ip -netns "${NS_A}" -4 rule add dsfield "${policy_mark}" \ + table "${rt_table}" + + # Set the IPv4 Don't Fragment bit with tc, since socat doesn't seem to + # have an option do to it. + tc -netns "${NS_A}" qdisc replace dev veth_A-R1 root prio + tc -netns "${NS_A}" qdisc replace dev veth_A-R2 root prio + tc -netns "${NS_A}" filter add dev veth_A-R1 \ + protocol ipv4 flower ip_proto udp \ + action pedit ex munge ip df set 0x40 pipe csum ip and udp + tc -netns "${NS_A}" filter add dev veth_A-R2 \ + protocol ipv4 flower ip_proto udp \ + action pedit ex munge ip df set 0x40 pipe csum ip and udp +} + setup_bridge() { run_cmd ${ns_a} ip link add br0 type bridge || return $ksft_skip run_cmd ${ns_a} ip link set br0 up
@@ -905,6 +938,11 @@ cleanup() { done nettest_pids= + for pid in ${socat_pids}; do + kill "${pid}" + done + socat_pids= + for n in ${NS_A} ${NS_B} ${NS_C} ${NS_R1} ${NS_R2}; do ip netns del ${n} 2> /dev/null done
@@ -952,15 +990,21 @@ link_get_mtu() { route_get_dst_exception() { ns_cmd="${1}" dst="${2}" + dsfield="${3}" - ${ns_cmd} ip route get "${dst}" + if [ -z "${dsfield}" ]; then + dsfield=0 + fi + + ${ns_cmd} ip route get "${dst}" dsfield "${dsfield}" } route_get_dst_pmtu_from_exception() { ns_cmd="${1}" dst="${2}" + dsfield="${3}" - mtu_parse "$(route_get_dst_exception "${ns_cmd}" ${dst})" + mtu_parse "$(route_get_dst_exception "${ns_cmd}" "${dst}" "${dsfield}")" } check_pmtu_value() {
@@ -1070,6 +1114,95 @@ test_pmtu_ipv6_exception() { test_pmtu_ipvX 6 } +test_pmtu_ipv4_dscp_icmp_exception() { + rt_table=100 + + setup namespaces policy_routing || return $ksft_skip + trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ + "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \ + "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \ + "${ns_r2}" veth_R2-B "${ns_b}" veth_B-R2 + + # Set up initial MTU values + mtu "${ns_a}" veth_A-R1 2000 + mtu "${ns_r1}" veth_R1-A 2000 + mtu "${ns_r1}" veth_R1-B 1400 + mtu "${ns_b}" veth_B-R1 1400 + + mtu "${ns_a}" veth_A-R2 2000 + mtu "${ns_r2}" veth_R2-A 2000 + mtu "${ns_r2}" veth_R2-B 1500 + mtu "${ns_b}" veth_B-R2 1500 + + len=$((2000 - 20 - 8)) # Fills MTU of veth_A-R1 + + dst1="${prefix4}.${b_r1}.1" + dst2="${prefix4}.${b_r2}.1" + + # Create route exceptions + dsfield=${policy_mark} # No ECN bit set (Not-ECT) + run_cmd "${ns_a}" ping -q -M want -Q "${dsfield}" -c 1 -w 1 -s "${len}" "${dst1}" + + dsfield=$(printf "%#x" $((policy_mark + 0x02))) # ECN=2 (ECT(0)) + run_cmd "${ns_a}" ping -q -M want -Q "${dsfield}" -c 1 -w 1 -s "${len}" "${dst2}" + + # Check that exceptions have been created with the correct PMTU + pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst1}" "${policy_mark}")" + check_pmtu_value "1400" "${pmtu_1}" "exceeding MTU" || return 1 + + pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst2}" "${policy_mark}")" + check_pmtu_value "1500" "${pmtu_2}" "exceeding MTU" || return 1 +} + +test_pmtu_ipv4_dscp_udp_exception() { + rt_table=100 + + if ! which socat > /dev/null 2>&1; then + echo "'socat' command not found; skipping tests" + return $ksft_skip + fi + + setup namespaces policy_routing || return $ksft_skip + trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ + "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \ + "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \ + "${ns_r2}" veth_R2-B "${ns_b}" veth_B-R2 + + # Set up initial MTU values + mtu "${ns_a}" veth_A-R1 2000 + mtu "${ns_r1}" veth_R1-A 2000 + mtu "${ns_r1}" veth_R1-B 1400 + mtu "${ns_b}" veth_B-R1 1400 + + mtu "${ns_a}" veth_A-R2 2000 + mtu "${ns_r2}" veth_R2-A 2000 + mtu "${ns_r2}" veth_R2-B 1500 + mtu "${ns_b}" veth_B-R2 1500 + + len=$((2000 - 20 - 8)) # Fills MTU of veth_A-R1 + + dst1="${prefix4}.${b_r1}.1" + dst2="${prefix4}.${b_r2}.1" + + # Create route exceptions + run_cmd_bg "${ns_b}" socat UDP-LISTEN:50000 OPEN:/dev/null,wronly=1 + socat_pids="${socat_pids} $!" + + dsfield=${policy_mark} # No ECN bit set (Not-ECT) + run_cmd "${ns_a}" socat OPEN:/dev/zero,rdonly=1,readbytes="${len}" \ + UDP:"${dst1}":50000,tos="${dsfield}" + + dsfield=$(printf "%#x" $((policy_mark + 0x02))) # ECN=2 (ECT(0)) + run_cmd "${ns_a}" socat OPEN:/dev/zero,rdonly=1,readbytes="${len}" \ + UDP:"${dst2}":50000,tos="${dsfield}" + + # Check that exceptions have been created with the correct PMTU + pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst1}" "${policy_mark}")" + check_pmtu_value "1400" "${pmtu_1}" "exceeding MTU" || return 1 + pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst2}" "${policy_mark}")" + check_pmtu_value "1500" "${pmtu_2}" "exceeding MTU" || return 1 +} + test_pmtu_ipvX_over_vxlanY_or_geneveY_exception() { type=${1} family=${2}
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 400/620 net: ipv4: Cache pmtu for all packet paths if multipath enabled
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Vdovin <[email protected]>
[ Upstream commit 7d3f3b4367f315a61fc615e3138f3d320da8c466 ]
Check number of paths by fib_info_num_path(), and update_or_create_fnhe() for every path. Problem is that pmtu is cached only for the oif that has received icmp message "need to frag", other oifs will still try to use "default" iface mtu.
An example topology showing the problem:
| host1
+---------+
| dummy0 | 10.179.20.18/32 mtu9000
+---------+
+-----------+----------------+
+---------+ +---------+
| ens17f0 | 10.179.2.141/31 | ens17f1 | 10.179.2.13/31
+---------+ +---------+
| (all here have mtu 9000) |
+------+ +------+
| ro1 | 10.179.2.140/31 | ro2 | 10.179.2.12/31
+------+ +------+
| |
---------+------------+-------------------+------
|
+-----+
| ro3 | 10.10.10.10 mtu1500
+-----+
|
========================================
some networks
========================================
|
+-----+
| eth0| 10.10.30.30 mtu9000
+-----+
| host2host1 have enabled multipath and
sysctl net.ipv4.fib_multipath_hash_policy = 1:
default proto static src 10.179.20.18
nexthop via 10.179.2.12 dev ens17f1 weight 1
nexthop via 10.179.2.140 dev ens17f0 weight 1When host1 tries to do pmtud from 10.179.20.18/32 to host2, host1 receives at ens17f1 iface an icmp packet from ro3 that ro3 mtu=1500. And host1 caches it in nexthop exceptions cache.
Problem is that it is cached only for the iface that has received icmp, and there is no way that ro3 will send icmp msg to host1 via another path.
Host1 now have this routes to host2:
ip r g 10.10.30.30 sport 30000 dport 443
10.10.30.30 via 10.179.2.12 dev ens17f1 src 10.179.20.18 uid 0
cache expires 521sec mtu 1500
ip r g 10.10.30.30 sport 30033 dport 443
10.10.30.30 via 10.179.2.140 dev ens17f0 src 10.179.20.18 uid 0
cache
So when host1 tries again to reach host2 with mtu>1500,
if packet flow is lucky enough to be hashed with oif=ens17f1 its ok, if oif=ens17f0 it blackholes and still gets icmp msgs from ro3 to ens17f1, until lucky day when ro3 will send it through another flow to ens17f0.
Stable-dep-of: 139512191bd0 ("ipv4: use RCU protection in __ip_rt_update_pmtu()")
--- net/ipv4/route.c | 13 ++++ tools/testing/selftests/net/pmtu.sh | 112 +++++++++++++++++++++++----- 2 files changed, 108 insertions(+), 17 deletions(-)
net/ipv4/route.c +13 -0
@@ -1049,6 +1049,19 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)struct fib_nh_common *nhc;fib_select_path (net, &res, fl4,NULL ); +#ifdef CONFIG_IP_ROUTE_MULTIPATH +if (fib_info_num_path (res.fi) >1 ) { +int nhsel; + +for (nhsel =0 ; nhsel <fib_info_num_path (res.fi); nhsel++) { + nhc =fib_info_nhc (res.fi, nhsel); +update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, + jiffies + net->ipv4.ip_rt_mtu_expires); + } +rcu_read_unlock (); +return ; + } +#endif /* CONFIG_IP_ROUTE_MULTIPATH */ nhc =FIB_RES_NHC (res);update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, jiffies + net->ipv4.ip_rt_mtu_expires);
tools/testing/selftests/net/pmtu.sh +95 -17
168 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 401/620 ipv4: use RCU protection in __ip_rt_update_pmtu()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 139512191bd06f1b496117c76372b2ce372c9a41 ]
__ip_rt_update_pmtu() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/route.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/ipv4/route.c +6 -5
@@ -1023,9 +1023,9 @@ out: kfree_skb(skb);static void __ip_rt_update_pmtu (struct rtable *rt,struct flowi4 *fl4,u32 mtu) {struct dst_entry *dst = &rt->dst; -struct net *net =dev_net (dst->dev);struct fib_result res;bool lock = false; +struct net *net;u32 old_mtu;if (ip_mtu_locked (dst))
@@ -1035,6 +1035,8 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)if (old_mtu < mtu)return ; +rcu_read_lock (); + net =dev_net_rcu (dst->dev);if (mtu < net->ipv4.ip_rt_min_pmtu) { lock = true; mtu =min (old_mtu, net->ipv4.ip_rt_min_pmtu);
@@ -1042,9 +1044,8 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)if (rt->rt_pmtu == mtu && !lock &&time_before (jiffies, dst->expires - net->ipv4.ip_rt_mtu_expires /2 )) -return ; + goto out; -rcu_read_lock ();if (fib_lookup (net, fl4, &res,0 ) ==0 ) {struct fib_nh_common *nhc;
@@ -1058,14 +1059,14 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, jiffies + net->ipv4.ip_rt_mtu_expires); } -rcu_read_unlock (); -return ; + goto out; }#endif /* CONFIG_IP_ROUTE_MULTIPATH */ nhc =FIB_RES_NHC (res);update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, jiffies + net->ipv4.ip_rt_mtu_expires); } +out:rcu_read_unlock (); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 402/620 ipv6: use RCU protection in ip6_default_advmss()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 3c8ffcd248da34fc41e52a46e51505900115fc2a ]
ip6_default_advmss() needs rcu protection to make sure the net structure it reads does not disappear.
--- net/ipv6/route.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/ipv6/route.c +6 -1
@@ -3184,13 +3184,18 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst) {struct net_device *dev = dst->dev;unsigned int mtu =dst_mtu (dst); -struct net *net =dev_net (dev); +struct net *net; mtu -=sizeof (struct ipv6hdr ) +sizeof (struct tcphdr ); +rcu_read_lock (); + + net =dev_net_rcu (dev);if (mtu < net->ipv6.sysctl.ip6_rt_min_advmss) mtu = net->ipv6.sysctl.ip6_rt_min_advmss; +rcu_read_unlock (); +/* * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and * corresponding MSS is IPV6_MAXPLEN - tcp_header_size.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 403/620 ndisc: use RCU protection in ndisc_alloc_skb()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 628e6d18930bbd21f2d4562228afe27694f66da9 ]
ndisc_alloc_skb() can be called without RTNL or RCU being held.
Add RCU protection to avoid possible UAF.
--- net/ipv6/ndisc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/ipv6/ndisc.c +4 -6
@@ -417,15 +417,11 @@ static struct sk_buff *ndisc_alloc_skb(struct net_device *dev, {int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -struct sock *sk =dev_net (dev)->ipv6.ndisc_sk;struct sk_buff *skb; skb =alloc_skb (hlen +sizeof (struct ipv6hdr ) + len + tlen,GFP_ATOMIC ); -if (!skb) { -ND_PRINTK (0 , err,"ndisc: %s failed to allocate an skb\n" , - __func__); +if (!skb)return NULL ; - } skb->protocol =htons (ETH_P_IPV6 ); skb->dev = dev;
@@ -436,7 +432,9 @@ static struct sk_buff *ndisc_alloc_skb(struct net_device *dev,/* Manually assign socket ownership as we avoid calling * sock_alloc_send_pskb() to bypass wmem buffer limits */ -skb_set_owner_w (skb, sk); +rcu_read_lock (); +skb_set_owner_w (skb,dev_net_rcu (dev)->ipv6.ndisc_sk); +rcu_read_unlock ();return skb; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 404/620 neighbour: delete redundant judgment statements
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zetao <[email protected]>
[ Upstream commit c25bdd2ac8cf7da70a226f1a66cdce7af15ff86f ]
The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise.
Stable-dep-of: becbd5850c03 ("neighbour: use RCU protection in __neigh_notify()")
--- net/core/neighbour.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/core/neighbour.c +1 -2
@@ -3387,8 +3387,7 @@ static void __neigh_notify(struct neighbour *n, int type, int flags,rtnl_notify (skb, net,0 ,RTNLGRP_NEIGH ,NULL ,GFP_ATOMIC );return ; errout: -if (err <0 ) -rtnl_set_sk_err (net,RTNLGRP_NEIGH , err); +rtnl_set_sk_err (net,RTNLGRP_NEIGH , err); }void neigh_app_ns (struct neighbour *n)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 405/620 neighbour: use RCU protection in __neigh_notify()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit becbd5850c03ed33b232083dd66c6e38c0c0e569 ]
__neigh_notify() can be called without RTNL or RCU protection.
Use RCU protection to avoid potential UAF.
--- net/core/neighbour.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/core/neighbour.c +6 -2
@@ -3369,10 +3369,12 @@ static const struct seq_operations neigh_stat_seq_ops = {static void __neigh_notify (struct neighbour *n,int type,int flags,u32 pid) { -struct net *net =dev_net (n->dev);struct sk_buff *skb;int err = -ENOBUFS ; +struct net *net; +rcu_read_lock (); + net =dev_net_rcu (n->dev); skb =nlmsg_new (neigh_nlmsg_size (),GFP_ATOMIC );if (skb ==NULL ) goto errout;
@@ -3385,9 +3387,11 @@ static void __neigh_notify(struct neighbour *n, int type, int flags, goto errout; }rtnl_notify (skb, net,0 ,RTNLGRP_NEIGH ,NULL ,GFP_ATOMIC ); -return ; + goto out; errout:rtnl_set_sk_err (net,RTNLGRP_NEIGH , err); +out: +rcu_read_unlock (); }void neigh_app_ns (struct neighbour *n)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 406/620 arp: use RCU protection in arp_xmit()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a42b69f692165ec39db42d595f4f65a4c8f42e44 ]
arp_xmit() can be called without RTNL or RCU protection.
Use RCU protection to avoid potential UAF.
--- net/ipv4/arp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/arp.c +3 -1
@@ -637,10 +637,12 @@ static int arp_xmit_finish(struct net *net, struct sock *sk, struct sk_buff *skb*/ void arp_xmit (struct sk_buff *skb) { +rcu_read_lock ();/* Send it off, maybe filter it using firewalling first. */ NF_HOOK (NFPROTO_ARP ,NF_ARP_OUT , -dev_net (skb->dev),NULL , skb,NULL , skb->dev, +dev_net_rcu (skb->dev),NULL , skb,NULL , skb->dev, arp_xmit_finish); +rcu_read_unlock (); }EXPORT_SYMBOL (arp_xmit);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 407/620 openvswitch: use RCU protection in ovs_vport_cmd_fill_info()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 90b2f49a502fa71090d9f4fe29a2f51fe5dff76d ]
ovs_vport_cmd_fill_info() can be called without RTNL or RCU.
Use RCU protection and dev_net_rcu() to avoid potential UAF.
--- net/openvswitch/datapath.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/openvswitch/datapath.c +9 -3
@@ -2058,6 +2058,7 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, {struct ovs_header *ovs_header;struct ovs_vport_stats vport_stats; +struct net *net_vport;int err; ovs_header = genlmsg_put(skb, portid, seq, &dp_vport_genl_family,
@@ -2074,12 +2075,15 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, nla_put_u32(skb, OVS_VPORT_ATTR_IFINDEX, vport->dev->ifindex)) goto nla_put_failure; -if (!net_eq (net,dev_net (vport->dev))) { -int id =peernet2id_alloc (net,dev_net (vport->dev), gfp); +rcu_read_lock (); + net_vport =dev_net_rcu (vport->dev); +if (!net_eq (net, net_vport)) { +int id =peernet2id_alloc (net, net_vport,GFP_ATOMIC );if (nla_put_s32 (skb,OVS_VPORT_ATTR_NETNSID , id)) - goto nla_put_failure; + goto nla_put_failure_unlock; } +rcu_read_unlock ();ovs_vport_get_stats (vport, &vport_stats); if (nla_put_64bit(skb, OVS_VPORT_ATTR_STATS,
@@ -2097,6 +2101,8 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb,genlmsg_end (skb, ovs_header);return 0 ; +nla_put_failure_unlock: +rcu_read_unlock (); nla_put_failure: err = -EMSGSIZE ; error:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 408/620 ndisc: extend RCU protection in ndisc_send_skb()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ed6ae1f325d3c43966ec1b62ac1459e2b8e45640 ]
ndisc_send_skb() can be called without RTNL or RCU held.
Acquire rcu_read_lock() earlier, so that we can use dev_net_rcu() and avoid a potential UAF.
--- net/ipv6/ndisc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/ipv6/ndisc.c +8 -4
@@ -471,16 +471,20 @@ static void ndisc_send_skb(struct sk_buff *skb,const struct in6_addr *daddr, const struct in6_addr *saddr) { + struct icmp6hdr *icmp6h = icmp6_hdr(skb);struct dst_entry *dst =skb_dst (skb); -struct net *net =dev_net (skb->dev); -struct sock *sk = net->ipv6.ndisc_sk;struct inet6_dev *idev; +struct net *net; +struct sock *sk;int err; -struct icmp6hdr *icmp6h =icmp6_hdr (skb);u8 type; type = icmp6h->icmp6_type; +rcu_read_lock (); + + net =dev_net_rcu (skb->dev); + sk = net->ipv6.ndisc_sk;if (!dst) {struct flowi6 fl6;int oif = skb->dev->ifindex;
@@ -488,6 +492,7 @@ static void ndisc_send_skb(struct sk_buff *skb,icmpv6_flow_init (sk, &fl6, type, saddr, daddr, oif); dst =icmp6_dst_alloc (skb->dev, &fl6);if (IS_ERR (dst)) { +rcu_read_unlock ();kfree_skb (skb);return ; }
@@ -502,7 +507,6 @@ static void ndisc_send_skb(struct sk_buff *skb,ip6_nd_hdr (skb, saddr, daddr,inet6_sk (sk)->hop_limit, skb->len); -rcu_read_lock (); idev =__in6_dev_get (dst->dev);IP6_UPD_PO_STATS (net, idev,IPSTATS_MIB_OUT , skb->len);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 409/620 ipv6: mcast: add RCU protection to mld_newpack()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a527750d877fd334de87eef81f1cb5f0f0ca3373 ]
mld_newpack() can be called without RTNL or RCU being held.
Note that we no longer can use sock_alloc_send_skb() because ipv6.igmp_sk uses GFP_KERNEL allocations which can sleep.
Instead use alloc_skb() and charge the net->ipv6.igmp_sk socket under RCU protection.
--- net/ipv6/mcast.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/ipv6/mcast.c +10 -4
@@ -1731,21 +1731,19 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)struct net_device *dev = idev->dev;int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -struct net *net =dev_net (dev);const struct in6_addr *saddr;struct in6_addr addr_buf;struct mld2_report *pmr;struct sk_buff *skb;unsigned int size;struct sock *sk; -int err; +struct net *net; - sk = net->ipv6.igmp_sk;/* we assume size > sizeof(ra) here * Also try to not allocate high-order pages for big MTU */ size =min_t (int, mtu,PAGE_SIZE /2 ) + hlen + tlen; - skb =sock_alloc_send_skb (sk, size,1 , &err); + skb =alloc_skb (size,GFP_KERNEL );if (!skb)return NULL ;
@@ -1753,6 +1751,12 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)skb_reserve (skb, hlen);skb_tailroom_reserve (skb, mtu, tlen); +rcu_read_lock (); + + net =dev_net_rcu (dev); + sk = net->ipv6.igmp_sk; +skb_set_owner_w (skb, sk); +if (ipv6_get_lladdr (dev, &addr_buf,IFA_F_TENTATIVE )) {/* <draft-ietf-magma-mld-source-05.txt>: * use unspecified address as the source address
@@ -1764,6 +1768,8 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)ip6_mc_hdr (sk, skb, dev, saddr, &mld2_all_mcr,NEXTHDR_HOP ,0 ); +rcu_read_unlock (); +skb_put_data (skb, ra,sizeof (ra));skb_set_transport_header (skb,skb_tail_pointer (skb) - skb->data);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 410/620 drm/tidss: Fix issue in irq handling causing irq-flood issue
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 44b6730ab53ef04944fbaf6da0e77397531517b7 upstream.
It has been observed that sometimes DSS will trigger an interrupt and the top level interrupt (DISPC_IRQSTATUS) is not zero, but the VP and VID level interrupt-statuses are zero.
As the top level irqstatus is supposed to tell whether we have VP/VID interrupts, the thinking of the driver authors was that this particular case could never happen. Thus the driver only clears the DISPC_IRQSTATUS bits which has corresponding interrupts in VP/VID status. So when this issue happens, the driver will not clear DISPC_IRQSTATUS, and we get an interrupt flood.
It is unclear why the issue happens. It could be a race issue in the driver, but no such race has been found. It could also be an issue with the HW. However a similar case can be easily triggered by manually writing to DISPC_IRQSTATUS_RAW. This will forcibly set a bit in the DISPC_IRQSTATUS and trigger an interrupt, and as the driver never clears the bit, we get an interrupt flood.
To fix the issue, always clear DISPC_IRQSTATUS. The concern with this solution is that if the top level irqstatus is the one that triggers the interrupt, always clearing DISPC_IRQSTATUS might leave some interrupts unhandled if VP/VID interrupt statuses have bits set. However, testing shows that if any of the irqstatuses is set (i.e. even if DISPC_IRQSTATUS == 0, but a VID irqstatus has a bit set), we will get an interrupt.
--- drivers/gpu/drm/tidss/tidss_dispc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/tidss/tidss_dispc.c +4 -8
@@ -676,24 +676,20 @@ staticvoid dispc_k3_clear_irqstatus (struct dispc_device *dispc,dispc_irq_t clearmask) {unsigned int i; -u32 top_clear =0 ;for (i =0 ; i < dispc->feat->num_vps; ++i) { -if (clearmask &DSS_IRQ_VP_MASK (i)) { +if (clearmask &DSS_IRQ_VP_MASK (i))dispc_k3_vp_write_irqstatus (dispc, i, clearmask); - top_clear |=BIT (i); - } }for (i =0 ; i < dispc->feat->num_planes; ++i) { -if (clearmask &DSS_IRQ_PLANE_MASK (i)) { +if (clearmask &DSS_IRQ_PLANE_MASK (i))dispc_k3_vid_write_irqstatus (dispc, i, clearmask); - top_clear |=BIT (4 + i); - } }if (dispc->feat->subrev ==DISPC_K2G )return ; -dispc_write (dispc,DISPC_IRQSTATUS , top_clear); +/* always clear the top level irqstatus */ +dispc_write (dispc,DISPC_IRQSTATUS ,dispc_read (dispc,DISPC_IRQSTATUS ));/* Flush posted writes */ dispc_read (dispc,DISPC_IRQSTATUS );
Greg Kroah-Hartman
maintainerPATCH 411/620 drm/tidss: Clear the interrupt status for interrupts being disabled
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devarsh Thakkar <[email protected]>
commit 361a2ebb5cad211732ec3c5d962de49b21895590 upstream.
The driver does not touch the irqstatus register when it is disabling interrupts. This might cause an interrupt to trigger for an interrupt that was just disabled.
To fix the issue, clear the irqstatus registers right after disabling the interrupts.
--- drivers/gpu/drm/tidss/tidss_dispc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/tidss/tidss_dispc.c +8 -2
@@ -596,7 +596,7 @@ void dispc_k2g_set_irqenable(struct disp {dispc_irq_t old_mask =dispc_k2g_read_irqenable (dispc); -/* clear the irqstatus for newly enabled irqs */ +/* clear the irqstatus for irqs that will be enabled */ dispc_k2g_clear_irqstatus (dispc, (mask ^ old_mask) & mask);dispc_k2g_vp_set_irqenable (dispc,0 , mask);
@@ -604,6 +604,9 @@ void dispc_k2g_set_irqenable(struct dispdispc_write (dispc,DISPC_IRQENABLE_SET , (1 <<0 ) | (1 <<7 )); +/* clear the irqstatus for irqs that were disabled */ +dispc_k2g_clear_irqstatus (dispc, (mask ^ old_mask) & old_mask); +/* flush posted write */ dispc_k2g_read_irqenable (dispc); }
@@ -735,7 +738,7 @@ static void dispc_k3_set_irqenable(struc old_mask =dispc_k3_read_irqenable (dispc); -/* clear the irqstatus for newly enabled irqs */ +/* clear the irqstatus for irqs that will be enabled */ dispc_k3_clear_irqstatus (dispc, (old_mask ^ mask) & mask);for (i =0 ; i < dispc->feat->num_vps; ++i) {
@@ -760,6 +763,9 @@ static void dispc_k3_set_irqenable(strucif (main_disable)dispc_write (dispc,DISPC_IRQENABLE_CLR , main_disable); +/* clear the irqstatus for irqs that were disabled */ +dispc_k3_clear_irqstatus (dispc, (old_mask ^ mask) & old_mask); +/* Flush posted writes */ dispc_read (dispc,DISPC_IRQENABLE_SET ); }
Greg Kroah-Hartman
maintainerPATCH 412/620 drm/v3d: Stop active perfmon if it is being destroyed
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Gmeiner <[email protected]>
commit 21f1435b1e6b012a07c42f36b206d2b66fc8f13b upstream.
If the active performance monitor (v3d->active_perfmon) is being destroyed, stop it first. Currently, the active perfmon is not stopped during destruction, leaving the v3d->active_perfmon pointer stale. This can lead to undefined behavior and instability.
This patch ensures that the active perfmon is stopped before being destroyed, aligning with the behavior introduced in commit 7d1fd3638ee3 ("drm/v3d: Stop the active perfmon before being destroyed").
--- drivers/gpu/drm/v3d/v3d_perfmon.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/v3d/v3d_perfmon.c +5 -0
@@ -175,6 +175,7 @@ int v3d_perfmon_destroy_ioctl(struct drm {struct v3d_file_priv *v3d_priv = file_priv->driver_priv;struct drm_v3d_perfmon_destroy *req = data; +struct v3d_dev *v3d = v3d_priv->v3d;struct v3d_perfmon *perfmon;mutex_lock (&v3d_priv->perfmon.lock);
@@ -184,6 +185,10 @@ int v3d_perfmon_destroy_ioctl(struct drmif (!perfmon)return -EINVAL ; +/* If the active perfmon is being destroyed, stop it first */ +if (perfmon == v3d->active_perfmon) +v3d_perfmon_stop (v3d, perfmon, false); +v3d_perfmon_put (perfmon);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 413/620 kdb: Do not assume write() callback available
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
commit 6d3e0d8cc63221dec670d0ee92ac57961581e975 upstream.
It is allowed for consoles to not provide a write() callback. For example ttynull does this.
Check if a write() callback is available before using it.
--- kernel/debug/kdb/kdb_io.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/debug/kdb/kdb_io.c +2 -0
@@ -577,6 +577,8 @@ static void kdb_msg_write(const char *mscontinue ;if (c == dbg_io_ops->cons)continue ; +if (!c->write) +continue ;/* * Set oops_in_progress to encourage the console drivers to * disregard their internal spin locks: in the current calling
Greg Kroah-Hartman
maintainerPATCH 414/620 x86/static-call: Remove early_boot_irqs_disabled check to fix Xen PVH dom0
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Cooper <[email protected]>
commit 5cc2db37124bb33914996d6fdbb2ddb3811f2945 upstream.
__static_call_update_early() has a check for early_boot_irqs_disabled, but is used before early_boot_irqs_disabled is set up in start_kernel().
Xen PV has always special cased early_boot_irqs_disabled, but Xen PVH does not and falls over the BUG when booting as dom0.
It is very suspect that early_boot_irqs_disabled starts as 0, becomes 1 for a time, then becomes 0 again, but as this needs backporting to fix a breakage in a security fix, dropping the BUG_ON() is the far safer option.
--- arch/x86/kernel/static_call.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/kernel/static_call.c +0 -1
@@ -169,7 +169,6 @@ EXPORT_SYMBOL_GPL(arch_static_call_trans noinstr void __static_call_update_early(void *tramp, void *func) {BUG_ON (system_state !=SYSTEM_BOOTING ); -BUG_ON (!early_boot_irqs_disabled);BUG_ON (static_call_initialized);__text_gen_insn (tramp,JMP32_INSN_OPCODE , tramp, func,JMP32_INSN_SIZE );sync_core ();
Greg Kroah-Hartman
maintainerPATCH 415/620 alpha: replace hardcoded stack offsets with autogenerated ones
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Kokshaysky <[email protected]>
commit 77b823fa619f97d16409ca37ad4f7936e28c5f83 upstream.
This allows the assembly in entry.S to automatically keep in sync with changes in the stack layout (struct pt_regs and struct switch_stack).
--- arch/alpha/kernel/asm-offsets.c | 2 ++ arch/alpha/kernel/entry.S | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-)
arch/alpha/kernel/asm-offsets.c +2 -0
@@ -32,7 +32,9 @@ void foo(void)DEFINE (CRED_EGID , offsetof(struct cred , egid));BLANK (); +DEFINE (SP_OFF , offsetof(struct pt_regs , ps));DEFINE (SIZEOF_PT_REGS ,sizeof (struct pt_regs )); +DEFINE (SWITCH_STACK_SIZE ,sizeof (struct switch_stack ));DEFINE (PT_PTRACED ,PT_PTRACED );DEFINE (CLONE_VM ,CLONE_VM );DEFINE (CLONE_UNTRACED ,CLONE_UNTRACED );
arch/alpha/kernel/entry.S +0 -4
@@ -15,10 +15,6 @@ .set noat .cfi_sections .debug_frame -/* Stack offsets. */ -#define SP_OFF 184 -#define SWITCH_STACK_SIZE 320 - .macro CFI_START_OSF_FRAME func .align 4 .globl \func
Greg Kroah-Hartman
maintainerPATCH 416/620 nilfs2: do not output warnings when clearing dirty buffers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 299910dcb4525ac0274f3efa9527876315ba4f67 upstream.
After detecting file system corruption and degrading to a read-only mount, dirty folios and buffers in the page cache are cleared, and a large number of warnings are output at that time, often filling up the kernel log.
In this case, since the degrading to a read-only mount is output to the kernel log, these warnings are not very meaningful, and are rather a nuisance in system management and debugging.
The related nilfs2-specific page/folio routines have a silent argument that suppresses the warning output, but since it is not currently used meaningfully, remove both the silent argument and the warning output.
Stable-dep-of: ca76bb226bf4 ("nilfs2: do not force clear folio if buffer is referenced")
--- fs/nilfs2/inode.c | 4 ++-- fs/nilfs2/mdt.c | 6 +++--- fs/nilfs2/page.c | 20 +++----------------- fs/nilfs2/page.h | 4 ++-- 4 files changed, 10 insertions(+), 24 deletions(-)
fs/nilfs2/inode.c +2 -2
@@ -162,7 +162,7 @@ static int nilfs_writepages(struct addreint err =0 ;if (sb_rdonly (inode->i_sb)) { -nilfs_clear_dirty_pages (mapping, false); +nilfs_clear_dirty_pages (mapping);return -EROFS ; }
@@ -185,7 +185,7 @@ static int nilfs_writepage(struct page ** have dirty pages that try to be flushed in background. * So, here we simply discard this dirty page. */ -nilfs_clear_dirty_page (page, false); +nilfs_clear_dirty_page (page);unlock_page (page);return -EROFS ; }
fs/nilfs2/mdt.c +3 -3
@@ -410,7 +410,7 @@ nilfs_mdt_write_page(struct page *page,* have dirty pages that try to be flushed in background. * So, here we simply discard this dirty page. */ -nilfs_clear_dirty_page (page, false); +nilfs_clear_dirty_page (page);unlock_page (page);return -EROFS ; }
@@ -632,10 +632,10 @@ void nilfs_mdt_restore_from_shadow_map(sif (mi->mi_palloc_cache)nilfs_palloc_clear_cache (inode); -nilfs_clear_dirty_pages (inode->i_mapping, true); +nilfs_clear_dirty_pages (inode->i_mapping);nilfs_copy_back_pages (inode->i_mapping, shadow->inode->i_mapping); -nilfs_clear_dirty_pages (ii->i_assoc_inode->i_mapping, true); +nilfs_clear_dirty_pages (ii->i_assoc_inode->i_mapping);nilfs_copy_back_pages (ii->i_assoc_inode->i_mapping,NILFS_I (shadow->inode)->i_assoc_inode->i_mapping);
fs/nilfs2/page.c +3 -17
@@ -354,9 +354,8 @@ repeat:/** * nilfs_clear_dirty_pages - discard dirty pages in address space * @mapping: address space with dirty pages for discarding -* @silent: suppress [true] or print [false] warning messages */ -void nilfs_clear_dirty_pages (struct address_space *mapping,bool silent) +void nilfs_clear_dirty_pages (struct address_space *mapping) {struct pagevec pvec;unsigned int i;
@@ -377,7 +376,7 @@ void nilfs_clear_dirty_pages(struct addr* was acquired. Skip processing in that case. */ if (likely (page->mapping == mapping)) -nilfs_clear_dirty_page (page, silent); +nilfs_clear_dirty_page (page);unlock_page (page); }
@@ -389,19 +388,11 @@ void nilfs_clear_dirty_pages(struct addr/** * nilfs_clear_dirty_page - discard dirty page * @page: dirty page that will be discarded -* @silent: suppress [true] or print [false] warning messages */ -void nilfs_clear_dirty_page (struct page *page,bool silent) +void nilfs_clear_dirty_page (struct page *page) { -struct inode *inode = page->mapping->host; -struct super_block *sb = inode->i_sb; -BUG_ON (!PageLocked (page)); -if (!silent) -nilfs_warn (sb,"discard dirty page: offset=%lld, ino=%lu" , -page_offset (page), inode->i_ino); -ClearPageUptodate (page);ClearPageMappedToDisk (page);ClearPageChecked (page);
@@ -417,11 +408,6 @@ void nilfs_clear_dirty_page(struct page bh = head =page_buffers (page);do {lock_buffer (bh); -if (!silent) -nilfs_warn (sb, -"discard dirty block: blocknr=%llu, size=%zu" , - (u64 )bh->b_blocknr, bh->b_size); -set_mask_bits (&bh->b_state, clear_bits,0 );unlock_buffer (bh); }while (bh = bh->b_this_page, bh != head);
fs/nilfs2/page.h +2 -2
@@ -41,8 +41,8 @@ void nilfs_page_bug(struct page *);int nilfs_copy_dirty_pages (struct address_space *,struct address_space *);void nilfs_copy_back_pages (struct address_space *,struct address_space *); -void nilfs_clear_dirty_page (struct page *,bool ); -void nilfs_clear_dirty_pages (struct address_space *,bool ); +void nilfs_clear_dirty_page (struct page *page); +void nilfs_clear_dirty_pages (struct address_space *mapping);void nilfs_mapping_init (struct address_space *mapping,struct inode *inode);unsigned int nilfs_page_count_clean_buffers (struct page *,unsigned int ,unsigned int );
Greg Kroah-Hartman
maintainerPATCH 417/620 nilfs2: do not force clear folio if buffer is referenced
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit ca76bb226bf47ff04c782cacbd299f12ddee1ec1 upstream.
Patch series "nilfs2: protect busy buffer heads from being force-cleared".
This series fixes the buffer head state inconsistency issues reported by syzbot that occurs when the filesystem is corrupted and falls back to read-only, and the associated buffer head use-after-free issue.
This patch (of 2):
Syzbot has reported that after nilfs2 detects filesystem corruption and falls back to read-only, inconsistencies in the buffer state may occur.
One of the inconsistencies is that when nilfs2 calls mark_buffer_dirty() to set a data or metadata buffer as dirty, but it detects that the buffer is not in the uptodate state:
WARNING: CPU: 0 PID: 6049 at fs/buffer.c:1177 mark_buffer_dirty+0x2e5/0x520 fs/buffer.c:1177 ... Call Trace: <TASK> nilfs_palloc_commit_alloc_entry+0x4b/0x160 fs/nilfs2/alloc.c:598 nilfs_ifile_create_inode+0x1dd/0x3a0 fs/nilfs2/ifile.c:73 nilfs_new_inode+0x254/0x830 fs/nilfs2/inode.c:344 nilfs_mkdir+0x10d/0x340 fs/nilfs2/namei.c:218 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257 do_mkdirat+0x264/0x3a0 fs/namei.c:4280 __do_sys_mkdirat fs/namei.c:4295 [inline] __se_sys_mkdirat fs/namei.c:4293 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4293 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
The other is when nilfs_btree_propagate(), which propagates the dirty state to the ancestor nodes of a b-tree that point to a dirty buffer, detects that the origin buffer is not dirty, even though it should be:
WARNING: CPU: 0 PID: 5245 at fs/nilfs2/btree.c:2089 nilfs_btree_propagate+0xc79/0xdf0 fs/nilfs2/btree.c:2089 ... Call Trace: <TASK> nilfs_bmap_propagate+0x75/0x120 fs/nilfs2/bmap.c:345 nilfs_collect_file_data+0x4d/0xd0 fs/nilfs2/segment.c:587 nilfs_segctor_apply_buffers+0x184/0x340 fs/nilfs2/segment.c:1006 nilfs_segctor_scan_file+0x28c/0xa50 fs/nilfs2/segment.c:1045 nilfs_segctor_collect_blocks fs/nilfs2/segment.c:1216 [inline] nilfs_segctor_collect fs/nilfs2/segment.c:1540 [inline] nilfs_segctor_do_construct+0x1c28/0x6b90 fs/nilfs2/segment.c:2115 nilfs_segctor_construct+0x181/0x6b0 fs/nilfs2/segment.c:2479 nilfs_segctor_thread_construct fs/nilfs2/segment.c:2587 [inline] nilfs_segctor_thread+0x69e/0xe80 fs/nilfs2/segment.c:2701 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 </TASK>
Both of these issues are caused by the callbacks that handle the page/folio write requests, forcibly clear various states, including the working state of the buffers they hold, at unexpected times when they detect read-only fallback.
Fix these issues by checking if the buffer is referenced before clearing the page/folio state, and skipping the clear if it is.
--- fs/nilfs2/page.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-)
fs/nilfs2/page.c +29 -6
@@ -388,24 +388,44 @@ void nilfs_clear_dirty_pages(struct addr/** * nilfs_clear_dirty_page - discard dirty page * @page: dirty page that will be discarded +* +* nilfs_clear_dirty_page() clears working states including dirty state for +* the page and its buffers. If the page has buffers, clear only if it is +* confirmed that none of the buffer heads are busy (none have valid +* references and none are locked). */ void nilfs_clear_dirty_page (struct page *page) {BUG_ON (!PageLocked (page)); -ClearPageUptodate (page); -ClearPageMappedToDisk (page); -ClearPageChecked (page); -if (page_has_buffers (page)) { -struct buffer_head *bh, *head; +struct buffer_head *bh, *head =page_buffers (page);const unsigned long clear_bits = (BIT (BH_Uptodate) |BIT (BH_Dirty) |BIT (BH_Mapped) |BIT (BH_Async_Write) |BIT (BH_NILFS_Volatile) |BIT (BH_NILFS_Checked) |BIT (BH_NILFS_Redirected) |BIT (BH_Delay)); +bool busy, invalidated = false; - bh = head =page_buffers (page); +recheck_buffers: + busy = false; + bh = head; +do { +if (atomic_read (&bh->b_count) |buffer_locked (bh)) { + busy = true; +break ; + } + }while (bh = bh->b_this_page, bh != head); + +if (busy) { +if (invalidated) +return ; +invalidate_bh_lrus (); + invalidated = true; + goto recheck_buffers; + } + + bh = head; do { lock_buffer(bh); set_mask_bits(&bh->b_state, clear_bits, 0);
@@ -413,6 +433,9 @@ void nilfs_clear_dirty_page(struct page }while (bh = bh->b_this_page, bh != head); } +ClearPageUptodate (page); +ClearPageMappedToDisk (page); +ClearPageChecked (page);__nilfs_clear_page_dirty (page); }
Greg Kroah-Hartman
maintainerPATCH 418/620 nilfs2: protect access to buffers with no active references
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 367a9bffabe08c04f6d725032cce3d891b2b9e1a upstream.
nilfs_lookup_dirty_data_buffers(), which iterates through the buffers attached to dirty data folios/pages, accesses the attached buffers without locking the folios/pages.
For data cache, nilfs_clear_folio_dirty() may be called asynchronously when the file system degenerates to read only, so nilfs_lookup_dirty_data_buffers() still has the potential to cause use after free issues when buffers lose the protection of their dirty state midway due to this asynchronous clearing and are unintentionally freed by try_to_free_buffers().
Eliminate this race issue by adjusting the lock section in this function.
--- fs/nilfs2/segment.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nilfs2/segment.c +3 -1
@@ -732,7 +732,6 @@ static size_t nilfs_lookup_dirty_data_bu }if (!page_has_buffers (page))create_empty_buffers (page,i_blocksize (inode),0 ); -unlock_page (page); bh = head =page_buffers (page); do {
@@ -742,11 +741,14 @@ static size_t nilfs_lookup_dirty_data_bulist_add_tail (&bh->b_assoc_buffers, listp); ndirties++;if (unlikely (ndirties >= nlimit)) { +unlock_page (page);pagevec_release (&pvec);cond_resched ();return ndirties; } }while (bh = bh->b_this_page, bh != head); + +unlock_page (page); }pagevec_release (&pvec);cond_resched ();
Greg Kroah-Hartman
maintainerPATCH 419/620 can: ems_pci: move ASIX AX99100 ids to pci_ids.h
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaqing Zhao <[email protected]>
commit 3029ad91335353a70feb42acd24d580d70ab258b upstream.
Move PCI Vendor and Device ID of ASIX AX99100 PCIe to Multi I/O Controller to pci_ids.h for its serial and parallel port driver support in subsequent patches.
--- include/linux/pci_ids.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/pci_ids.h +4 -0
@@ -1743,6 +1743,10 @@#define PCI_SUBDEVICE_ID_AT_2700FX 0x2701#define PCI_SUBDEVICE_ID_AT_2701FX 0x2703 +#define PCI_VENDOR_ID_ASIX 0x125b +#define PCI_DEVICE_ID_ASIX_AX99100 0x9100 +#define PCI_DEVICE_ID_ASIX_AX99100_LB 0x9110 +#define PCI_VENDOR_ID_ESS 0x125d#define PCI_DEVICE_ID_ESS_ESS1968 0x1968#define PCI_DEVICE_ID_ESS_ESS1978 0x1978
Greg Kroah-Hartman
maintainerPATCH 420/620 serial: 8250_pci: add support for ASIX AX99100
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaqing Zhao <[email protected]>
commit 0b32216557ce3b2a468d1282d99b428bf72ff532 upstream.
Each of the 4 PCI functions on ASIX AX99100 PCIe to Multi I/O Controller can be configured as a single-port serial port controller. The subvendor id is 0x1000 when configured as serial port and MSI interrupts are supported.
--- drivers/tty/serial/8250/8250_pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/tty/serial/8250/8250_pci.c +10 -0
@@ -66,6 +66,8 @@ static const struct pci_device_id pci_us 0xA000, 0x1000) }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_NETMOS ,PCI_DEVICE_ID_NETMOS_9922 , 0xA000, 0x1000) }, + { PCI_DEVICE_SUB(PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100, + 0xA000, 0x1000) }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL, PCI_ANY_ID, PCI_ANY_ID) }, { }
@@ -6299,6 +6301,14 @@ static const struct pci_device_id serial {PCI_VENDOR_ID_NETMOS ,PCI_DEVICE_ID_NETMOS_9865 ,0xA000 ,0x3004 , 0, 0, pbn_b0_bt_4_115200 }, + +/* +* ASIX AX99100 PCIe to Multi I/O Controller +*/ + { PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100, +0xA000 ,0x1000 , + 0, 0, pbn_b0_1_115200 }, +/* Intel CE4100 */ { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Greg Kroah-Hartman
maintainerPATCH 421/620 parport_pc: add support for ASIX AX99100
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaqing Zhao <[email protected]>
commit 16aae4c64600a6319a6f10dbff833fa198bf9599 upstream.
The PCI function 2 on ASIX AX99100 PCIe to Multi I/O Controller can be configured as a single-port parallel port controller. The subvendor id is 0x2000 when configured as parallel port. It supports IEEE-1284 EPP / ECP with its ECR on BAR1.
--- drivers/parport/parport_pc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/parport/parport_pc.c +5 -0
@@ -2611,6 +2611,7 @@ enum parport_pc_pci_cards { netmos_9815, netmos_9901, netmos_9865, + asix_ax99100, quatech_sppxp100, wch_ch382l, brainboxes_uc146,
@@ -2676,6 +2677,7 @@ static struct parport_pc_pci { /* netmos_9815 */ { 2, { { 0, 1 }, { 2, 3 }, } }, /* netmos_9901 */ { 1, { { 0, -1 }, } }, /* netmos_9865 */ { 1, { { 0, -1 }, } }, + /* asix_ax99100 */ { 1, { { 0, 1 }, } }, /* quatech_sppxp100 */ { 1, { { 0, 1 }, } }, /* wch_ch382l */ { 1, { { 2, -1 }, } }, /* brainboxes_uc146 */ { 1, { { 3, -1 }, } },
@@ -2766,6 +2768,9 @@ static const struct pci_device_id parpor 0xA000, 0x1000, 0, 0, netmos_9865 }, {PCI_VENDOR_ID_NETMOS ,PCI_DEVICE_ID_NETMOS_9865 , 0xA000, 0x2000, 0, 0, netmos_9865 }, +/* ASIX AX99100 PCIe to Multi I/O Controller */ + { PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100, + 0xA000, 0x2000, 0, 0, asix_ax99100 },/* Quatech SPPXP-100 Parallel port PCI ExpressCard */ { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
Greg Kroah-Hartman
maintainerPATCH 422/620 netdevsim: print human readable IP address
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
commit c71bc6da6198a6d88df86094f1052bb581951d65 upstream.
Currently, IPSec addresses are printed in hexadecimal format, which is not user-friendly. e.g.
# cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec SA count=2 tx=20 sa[0] rx ipaddr=0x00000000 00000000 00000000 0100a8c0 sa[0] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[0] key=0x3167608a ca4f1397 43565909 941fa627 sa[1] tx ipaddr=0x00000000 00000000 00000000 00000000 sa[1] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[1] key=0x3167608a ca4f1397 43565909 941fa627
This patch updates the code to print the IPSec address in a human-readable format for easier debug. e.g.
# cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec SA count=4 tx=40 sa[0] tx ipaddr=0.0.0.0 sa[0] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[0] key=0x3167608a ca4f1397 43565909 941fa627 sa[1] rx ipaddr=192.168.0.1 sa[1] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[1] key=0x3167608a ca4f1397 43565909 941fa627 sa[2] tx ipaddr=:: sa[2] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[2] key=0x3167608a ca4f1397 43565909 941fa627 sa[3] rx ipaddr=2000::1 sa[3] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[3] key=0x3167608a ca4f1397 43565909 941fa627
--- drivers/net/netdevsim/ipsec.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/netdevsim/ipsec.c +8 -4
@@ -39,10 +39,14 @@ static ssize_t nsim_dbg_netdev_ops_read(if (!sap->used)continue ; - p +=scnprintf (p, bufsize - (p - buf), -"sa[%i] %cx ipaddr=0x%08x %08x %08x %08x\n" , - i, (sap->rx ?'r' :'t' ), sap->ipaddr[0 ], - sap->ipaddr[1 ], sap->ipaddr[2 ], sap->ipaddr[3 ]); +if (sap->xs->props.family ==AF_INET6 ) + p +=scnprintf (p, bufsize - (p - buf), +"sa[%i] %cx ipaddr=%pI6c\n" , + i, (sap->rx ?'r' :'t' ), &sap->ipaddr); +else + p +=scnprintf (p, bufsize - (p - buf), +"sa[%i] %cx ipaddr=%pI4\n" , + i, (sap->rx ?'r' :'t' ), &sap->ipaddr[3 ]); p += scnprintf(p, bufsize - (p - buf), "sa[%i] spi=0x%08x proto=0x%x salt=0x%08x crypt=%d\n", i, be32_to_cpu(sap->xs->id.spi),