5.15.190-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 583/644 comedi: pcl726: Prevent invalid irq number
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]>
commit 96cb948408b3adb69df7e451ba7da9d21f814d00 upstream.
The reproducer passed in an irq number(0x80008000) that was too large, which triggered the oob.
Added an interrupt number check to prevent users from passing in an irq number that was too large.
If it->options[1] is 31, then 1 << it->options[1] is still invalid because it shifts a 1-bit into the sign bit (which is UB in C). Possible solutions include reducing the upper bound on the it->options[1] value to 30 or lower, or using 1U << it->options[1].
The old code would just not attempt to request the IRQ if the options[1] value were invalid. And it would still configure the device without interrupts even if the call to request_irq returned an error. So it would be better to combine this test with the test below.
--- drivers/comedi/drivers/pcl726.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/comedi/drivers/pcl726.c +2 -1
@@ -329,7 +329,8 @@ static int pcl726_attach(struct comedi_d* Hook up the external trigger source interrupt only if the * user config option is valid and the board supports interrupts. */ -if (it->options[1 ] && (board->irq_mask & (1 << it->options[1 ]))) { +if (it->options[1 ] >0 && it->options[1 ] <16 && + (board->irq_mask & (1U << it->options[1 ]))) { ret =request_irq (it->options[1 ], pcl726_interrupt,0 , dev->board_name, dev);if (ret ==0 ) {
Greg Kroah-Hartman
maintainerPATCH 584/644 comedi: Fix use of uninitialized memory in do_insn_ioctl() and do_insnlist_ioctl()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 3cd212e895ca2d58963fdc6422502b10dd3966bb upstream.
syzbot reports a KMSAN kernel-infoleak in do_insn_ioctl(). A kernel buffer is allocated to hold insn->n samples (each of which is an unsigned int). For some instruction types, insn->n samples are copied back to user-space, unless an error code is being returned. The problem is that not all the instruction handlers that need to return data to userspace fill in the whole insn->n samples, so that there is an information leak. There is a similar syzbot report for do_insnlist_ioctl(), although it does not have a reproducer for it at the time of writing.
One culprit is insn_rw_emulate_bits() which is used as the handler for INSN_READ or INSN_WRITE instructions for subdevices that do not have a specific handler for that instruction, but do have an INSN_BITS handler. For INSN_READ it only fills in at most 1 sample, so if insn->n is greater than 1, the remaining insn->n - 1 samples copied to userspace will be uninitialized kernel data.
Another culprit is vm80xx_ai_insn_read() in the "vm80xx" driver. It never returns an error, even if it fails to fill the buffer.
Fix it in do_insn_ioctl() and do_insnlist_ioctl() by making sure that uninitialized parts of the allocated buffer are zeroed before handling each instruction.
Thanks to Arnaud Lecomte for their fix to do_insn_ioctl(). That fix replaced the call to kmalloc_array() with kcalloc(), but it is not always necessary to clear the whole buffer.
--- drivers/comedi/comedi_fops.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/comedi/comedi_fops.c +5 -0
@@ -1582,6 +1582,9 @@ static int do_insnlist_ioctl(struct comememset (&data[n],0 , (MIN_SAMPLES - n) *sizeof (unsigned int )); } + }else { + memset(data, 0, max_t(unsigned int, n, MIN_SAMPLES) * +sizeof (unsigned int )); } ret =parse_insn (dev, insns + i, data, file);if (ret <0 )
@@ -1665,6 +1668,8 @@ static int do_insn_ioctl(struct comedi_dmemset (&data[insn->n],0 , (MIN_SAMPLES - insn->n) *sizeof (unsigned int )); } + }else { +memset (data,0 , n_data *sizeof (unsigned int )); } ret =parse_insn (dev, insn, data, file);if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 585/644 usb: core: hcd: fix accessing unmapped memory in SINGLE_STEP_SET_FEATURE test
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit 8fe06185e11ae753414aa6117f0e798aa77567ff upstream.
The USB core will unmap urb->transfer_dma after SETUP stage completes. Then the USB controller will access unmapped memory when it received device descriptor. If iommu is equipped, the entire test can't be completed due to the memory accessing is blocked.
Fix it by calling map_urb_for_dma() again for IN stage. To reduce redundant map for urb->transfer_buffer, this will also set URB_NO_TRANSFER_DMA_MAP flag before first map_urb_for_dma() to skip dma map for urb->transfer_buffer and clear URB_NO_TRANSFER_DMA_MAP flag before second map_urb_for_dma().
--- drivers/usb/core/hcd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/core/hcd.c +7 -1
@@ -2183,7 +2183,7 @@ static struct urb *request_single_step_s urb->complete = usb_ehset_completion; urb->status = -EINPROGRESS ; urb->actual_length =0 ; - urb->transfer_flags =URB_DIR_IN ; + urb->transfer_flags =URB_DIR_IN |URB_NO_TRANSFER_DMA_MAP ;usb_get_urb (urb);atomic_inc (&urb->use_count);atomic_inc (&urb->dev->urbnum);
@@ -2247,9 +2247,15 @@ int ehset_single_step_set_feature(struct/* Complete remaining DATA and STATUS stages using the same URB */ urb->status = -EINPROGRESS ; + urb->transfer_flags &= ~URB_NO_TRANSFER_DMA_MAP ;usb_get_urb (urb);atomic_inc (&urb->use_count);atomic_inc (&urb->dev->urbnum); +if (map_urb_for_dma (hcd, urb,GFP_KERNEL )) { +usb_put_urb (urb); + goto out1; + } + retval = hcd->driver->submit_single_step_set_feature (hcd, urb,0 );if (!retval && !wait_for_completion_timeout (&done,msecs_to_jiffies (2000 ))) {
Greg Kroah-Hartman
maintainerPATCH 586/644 usb: renesas-xhci: Fix External ROM access timeouts
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 f9420f4757752f056144896024d5ea89e5a611f1 upstream.
Increase the External ROM access timeouts to prevent failures during programming of External SPI EEPROM chips. The current timeouts are too short for some SPI EEPROMs used with uPD720201 controllers.
The current timeout for Chip Erase in renesas_rom_erase() is 100 ms , the current timeout for Sector Erase issued by the controller before Page Program in renesas_fw_download_image() is also 100 ms. Neither timeout is sufficient for e.g. the Macronix MX25L5121E or MX25V5126F.
MX25L5121E reference manual [1] page 35 section "ERASE AND PROGRAMMING PERFORMANCE" and page 23 section "Table 8. AC CHARACTERISTICS (Temperature = 0°C to 70°C for Commercial grade, VCC = 2.7V ~ 3.6V)" row "tCE" indicate that the maximum time required for Chip Erase opcode to complete is 2 s, and for Sector Erase it is 300 ms .
MX25V5126F reference manual [2] page 47 section "13. ERASE AND PROGRAMMING PERFORMANCE (2.3V - 3.6V)" and page 42 section "Table 8. AC CHARACTERISTICS (Temperature = -40°C to 85°C for Industrial grade, VCC = 2.3V - 3.6V)" row "tCE" indicate that the maximum time required for Chip Erase opcode to complete is 3.2 s, and for Sector Erase it is 400 ms .
Update the timeouts such, that Chip Erase timeout is set to 5 seconds, and Sector Erase timeout is set to 500 ms. Such lengthy timeouts ought to be sufficient for majority of SPI EEPROM chips.
[1] https://www.macronix.com/Lists/Datasheet/Attachments/8634/MX25L5121E,%203V,%20512Kb,%20v1.3.pdf
[2] https://www.macronix.com/Lists/Datasheet/Attachments/8750/MX25V5126F,%202.5V,%20512Kb,%20v1.1.pdf
--- drivers/usb/host/xhci-pci-renesas.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-pci-renesas.c +4 -3
@@ -47,8 +47,9 @@#define RENESAS_ROM_ERASE_MAGIC 0x5A65726F#define RENESAS_ROM_WRITE_MAGIC 0x53524F4D -#define RENESAS_RETRY 10000 -#define RENESAS_DELAY 10 +#define RENESAS_RETRY 50000/* 50000 * RENESAS_DELAY ~= 500ms */ +#define RENESAS_CHIP_ERASE_RETRY 500000/* 500000 * RENESAS_DELAY ~= 5s */ +#define RENESAS_DELAY 10static int renesas_fw_download_image (struct pci_dev *dev,const u32 *fw,size_t step,bool rom)
@@ -409,7 +410,7 @@ static void renesas_rom_erase(struct pci/* sleep a bit while ROM is erased */ msleep (20 ); -for (i =0 ; i <RENESAS_RETRY ; i++) { +for (i =0 ; i <RENESAS_CHIP_ERASE_RETRY ; i++) { retval =pci_read_config_byte (pdev,RENESAS_ROM_STATUS , &status); status &=RENESAS_ROM_STATUS_ERASE ;
Greg Kroah-Hartman
maintainerPATCH 587/644 USB: storage: Add unusual-devs entry for Novatek NTK96550-based camera
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mael GUERIN <[email protected]>
commit 6ca8af3c8fb584f3424a827f554ff74f898c27cd upstream.
Add the US_FL_BULK_IGNORE_TAG quirk for Novatek NTK96550-based camera to fix USB resets after sending SCSI vendor commands due to CBW and CSW tags difference, leading to undesired slowness while communicating with the device.
Please find below the copy of /sys/kernel/debug/usb/devices with my device plugged in (listed as TechSys USB mass storage here, the underlying chipset being the Novatek NTK96550-based camera):
T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0603 ProdID=8611 Rev= 0.01 S: Manufacturer=TechSys S: Product=USB Mass Storage S: SerialNumber=966110000000100 C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/storage/unusual_devs.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/storage/unusual_devs.h +7 -0
@@ -934,6 +934,13 @@ UNUSUAL_DEV( 0x05e3, 0x0723, 0x9451, 0x USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_SANE_SENSE ), +/* Added by Maël GUERIN <[email protected]> */ +UNUSUAL_DEV (0x0603 ,0x8611 ,0x0000 ,0xffff , +"Novatek" , +"NTK96550-based camera" , +USB_SC_SCSI ,USB_PR_BULK ,NULL , + US_FL_BULK_IGNORE_TAG ), +/* * Reported by Hanno Boeck <[email protected]> * Taken from the Lycoris Kernel
Greg Kroah-Hartman
maintainerPATCH 588/644 usb: storage: realtek_cr: Use correct byte order for bcs->Residue
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit 98da66a70ad2396e5a508c4245367797ebc052ce upstream.
Since 'bcs->Residue' has the data type '__le32', convert it to the correct byte order of the CPU using this driver when assigning it to the local variable 'residue'.
--- drivers/usb/storage/realtek_cr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/storage/realtek_cr.c +1 -1
@@ -252,7 +252,7 @@ static int rts51x_bulk_transport(structreturn USB_STOR_TRANSPORT_ERROR ; } - residue = bcs->Residue; + residue =le32_to_cpu (bcs->Residue);if (bcs->Tag != us->tag)return USB_STOR_TRANSPORT_ERROR ;
Greg Kroah-Hartman
maintainerPATCH 589/644 USB: storage: Ignore driver CD mode for Realtek multi-mode Wi-Fi dongles
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zenm Chen <[email protected]>
commit a3dc32c635bae0ae569f489e00de0e8f015bfc25 upstream.
Many Realtek USB Wi-Fi dongles released in recent years have two modes:
one is driver CD mode which has Windows driver onboard, another one is Wi-Fi mode. Add the US_FL_IGNORE_DEVICE quirk for these multi-mode devices. Otherwise, usb_modeswitch may fail to switch them to Wi-Fi mode.
Currently there are only two USB IDs known to be used by these multi-mode Wi-Fi dongles: 0bda:1a2b and 0bda:a192.
Information about Mercury MW310UH in /sys/kernel/debug/usb/devices.
T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 12 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0bda ProdID=a192 Rev= 2.00 S: Manufacturer=Realtek S: Product=DISK C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=0b(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
Information about D-Link AX9U rev. A1 in /sys/kernel/debug/usb/devices.
T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 55 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0bda ProdID=1a2b Rev= 0.00 S: Manufacturer=Realtek S: Product=DISK C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/storage/unusual_devs.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/usb/storage/unusual_devs.h +22 -0
@@ -1490,6 +1490,28 @@ UNUSUAL_DEV( 0x0bc2, 0x3332, 0x0000, 0x9 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_WP_DETECT ), +/* +* Reported by Zenm Chen <[email protected]> +* Ignore driver CD mode, otherwise usb_modeswitch may fail to switch +* the device into Wi-Fi mode. +*/ +UNUSUAL_DEV (0x0bda ,0x1a2b ,0x0000 ,0xffff , +"Realtek" , +"DISK" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_IGNORE_DEVICE ), + +/* +* Reported by Zenm Chen <[email protected]> +* Ignore driver CD mode, otherwise usb_modeswitch may fail to switch +* the device into Wi-Fi mode. +*/ +UNUSUAL_DEV (0x0bda ,0xa192 ,0x0000 ,0xffff , +"Realtek" , +"DISK" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_IGNORE_DEVICE ), + UNUSUAL_DEV( 0x0d49, 0x7310, 0x0000, 0x9999, "Maxtor", "USB to SATA",
Greg Kroah-Hartman
maintainerPATCH 590/644 usb: dwc3: Ignore late xferNotReady event to prevent halt timeout
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuen-Han Tsai <[email protected]>
commit 58577118cc7cec9eb7c1836bf88f865ff2c5e3a3 upstream.
During a device-initiated disconnect, the End Transfer command resets the event filter, allowing a new xferNotReady event to be generated before the controller is fully halted. Processing this late event incorrectly triggers a Start Transfer, which prevents the controller from halting and results in a DSTS.DEVCTLHLT bit polling timeout.
Ignore the late xferNotReady event if the controller is already in a disconnected state.
--- drivers/usb/dwc3/gadget.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/dwc3/gadget.c +9 -0
@@ -3534,6 +3534,15 @@ static void dwc3_gadget_endpoint_transfestatic void dwc3_gadget_endpoint_transfer_not_ready (struct dwc3_ep *dep,const struct dwc3_event_depevt *event) { +/* +* During a device-initiated disconnect, a late xferNotReady event can +* be generated after the End Transfer command resets the event filter, +* but before the controller is halted. Ignore it to prevent a new +* transfer from starting. +*/ +if (!dep->dwc->connected) +return ; +dwc3_gadget_endpoint_frame_from_event (dep, event);/*
Greg Kroah-Hartman
maintainerPATCH 591/644 usb: dwc3: Remove WARN_ON for device endpoint command timeouts
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvarasu Ganesan <[email protected]>
commit 45eae113dccaf8e502090ecf5b3d9e9b805add6f upstream.
This commit addresses a rarely observed endpoint command timeout which causes kernel panic due to warn when 'panic_on_warn' is enabled and unnecessary call trace prints when 'panic_on_warn' is disabled. It is seen during fast software-controlled connect/disconnect testcases. The following is one such endpoint command timeout that we observed:
1. Connect
=======
->dwc3_thread_interrupt
->dwc3_ep0_interrupt
->configfs_composite_setup
->composite_setup
->usb_ep_queue
->dwc3_gadget_ep0_queue
->__dwc3_gadget_ep0_queue
->__dwc3_ep0_do_control_data
->dwc3_send_gadget_ep_cmd2. Disconnect
==========
->dwc3_thread_interrupt
->dwc3_gadget_disconnect_interrupt
->dwc3_ep0_reset_state
->dwc3_ep0_end_control_data
->dwc3_send_gadget_ep_cmd
In the issue scenario, in Exynos platforms, we observed that control transfers for the previous connect have not yet been completed and end transfer command sent as a part of the disconnect sequence and processing of USB_ENDPOINT_HALT feature request from the host timeout. This maybe an expected scenario since the controller is processing EP commands sent as a part of the previous connect. It maybe better to remove WARN_ON in all places where device endpoint commands are sent to avoid unnecessary kernel panic due to warn.
--- drivers/usb/dwc3/ep0.c | 20 ++++++++++++++++---- drivers/usb/dwc3/gadget.c | 10 ++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-)
drivers/usb/dwc3/ep0.c +16 -4
@@ -282,7 +282,9 @@ void dwc3_ep0_out_start(struct dwc3 *dwcdwc3_ep0_prepare_one_trb (dep, dwc->ep0_trb_addr,8 ,DWC3_TRBCTL_CONTROL_SETUP , false); ret =dwc3_ep0_start_trans (dep); -WARN_ON (ret <0 ); +if (ret <0 ) +dev_err (dwc->dev,"ep0 out start transfer failed: %d\n" , ret); +for (i =2 ; i <DWC3_ENDPOINTS_NUM ; i++) {struct dwc3_ep *dwc3_ep;
@@ -1050,7 +1052,9 @@ static void __dwc3_ep0_do_control_data(s ret =dwc3_ep0_start_trans (dep); } -WARN_ON (ret <0 ); +if (ret <0 ) +dev_err (dwc->dev, +"ep0 data phase start transfer failed: %d\n" , ret); }static int dwc3_ep0_start_control_status (struct dwc3_ep *dep)
@@ -1067,7 +1071,12 @@ static int dwc3_ep0_start_control_statusstatic void __dwc3_ep0_do_control_status (struct dwc3 *dwc,struct dwc3_ep *dep) { -WARN_ON (dwc3_ep0_start_control_status (dep)); +int ret; + + ret =dwc3_ep0_start_control_status (dep); +if (ret) +dev_err (dwc->dev, +"ep0 status phase start transfer failed: %d\n" , ret); } static void dwc3_ep0_do_control_status(struct dwc3 *dwc,
@@ -1109,7 +1118,10 @@ void dwc3_ep0_end_control_data(struct dw cmd |=DWC3_DEPCMD_PARAM (dep->resource_index);memset (¶ms,0 ,sizeof (params)); ret =dwc3_send_gadget_ep_cmd (dep, cmd, ¶ms); -WARN_ON_ONCE (ret); +if (ret) +dev_err_ratelimited (dwc->dev, +"ep0 data phase end transfer failed: %d\n" , ret); + dep->resource_index =0 ; }
drivers/usb/dwc3/gadget.c +8 -2
@@ -1693,7 +1693,11 @@ static int __dwc3_stop_active_transfer(s dep->flags |=DWC3_EP_DELAY_STOP ;return 0 ; } -WARN_ON_ONCE (ret); + +if (ret) +dev_err_ratelimited (dep->dwc->dev, +"end transfer failed: %d\n" , ret); + dep->resource_index =0 ;if (!interrupt) {
@@ -3835,7 +3839,9 @@ static void dwc3_clear_stall_all_ep(stru dep->flags &= ~DWC3_EP_STALL ; ret =dwc3_send_clear_stall_ep_cmd (dep); -WARN_ON_ONCE (ret); +if (ret) +dev_err_ratelimited (dwc->dev, +"failed to clear STALL on %s\n" , dep->name); } }
Greg Kroah-Hartman
maintainerPATCH 592/644 drm/amd/display: Dont overclock DCE 6 by 15%
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit cb7b7ae53b557d168b4af5cd8549f3eff920bfb5 ]
The extra 15% clock was added as a workaround for a Polaris issue which uses DCE 11, and should not have been used on DCE 6 which is already hardcoded to the highest possible display clock. Unfortunately, the extra 15% was mistakenly copied and kept even on code paths which don't affect Polaris.
This commit fixes that and also adds a check to make sure not to exceed the maximum DCE 6 display clock.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c +3 -5
@@ -112,11 +112,9 @@ static void dce60_update_clocks(struct c {struct clk_mgr_internal *clk_mgr_dce =TO_CLK_MGR_INTERNAL (clk_mgr_base);struct dm_pp_power_level_change_request level_change_req; -int patched_disp_clk = context->bw_ctx.bw.dce.dispclk_khz; - -/*TODO: W/A for dal3 linux, investigate why this works */ -if (!clk_mgr_dce->dfs_bypass_active) - patched_disp_clk = patched_disp_clk *115 /100 ; +const int max_disp_clk = + clk_mgr_dce->max_clks_by_state[DM_PP_CLOCKS_STATE_PERFORMANCE ].display_clk_khz; +int patched_disp_clk =min (max_disp_clk, context->bw_ctx.bw.dce.dispclk_khz); level_change_req.power_level =dce_get_required_clocks_state (clk_mgr_base, context);/* get max clock state from PPLIB */
Greg Kroah-Hartman
maintainerPATCH 593/644 mptcp: disable add_addr retransmission when timeout is 0
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geliang Tang <[email protected]>
[ Upstream commit f5ce0714623cffd00bf2a83e890d09c609b7f50a ]
When add_addr_timeout was set to 0, this caused the ADD_ADDR to be retransmitted immediately, which looks like a buggy behaviour. Instead, interpret 0 as "no retransmissions needed".
The documentation is updated to explicitly state that setting the timeout to 0 disables retransmission.
--- Documentation/networking/mptcp-sysctl.rst | 2 ++ net/mptcp/pm_netlink.c | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-)
Documentation/networking/mptcp-sysctl.rst +2 -0
@@ -20,6 +20,8 @@ add_addr_timeout - INTEGER (seconds) resent to an MPTCP peer that has not acknowledged a previous ADD_ADDR message. + Do not retransmit if set to 0. + The default value matches TCP_RTO_MAX. This is a per-namespace sysctl.
net/mptcp/pm_netlink.c +10 -3
@@ -316,6 +316,7 @@ static void mptcp_pm_add_timer(struct tistruct mptcp_pm_add_entry *entry =from_timer (entry, timer, add_timer);struct mptcp_sock *msk = entry->sock;struct sock *sk = (struct sock *)msk; +unsigned int timeout;pr_debug ("msk=%p\n" , msk);
@@ -333,6 +334,10 @@ static void mptcp_pm_add_timer(struct ti goto out; } + timeout =mptcp_get_add_addr_timeout (sock_net (sk)); +if (!timeout) + goto out; +spin_lock_bh (&msk->pm.lock);if (!mptcp_pm_should_add_signal_addr (msk)) {
@@ -344,7 +349,7 @@ static void mptcp_pm_add_timer(struct tiif (entry->retrans_times <ADD_ADDR_RETRANS_MAX )sk_reset_timer (sk, timer, - jiffies +mptcp_get_add_addr_timeout (sock_net (sk))); + jiffies + timeout);spin_unlock_bh (&msk->pm.lock);
@@ -386,6 +391,7 @@ static bool mptcp_pm_alloc_anno_list(strstruct mptcp_pm_add_entry *add_entry =NULL ;struct sock *sk = (struct sock *)msk;struct net *net =sock_net (sk); +unsigned int timeout;lockdep_assert_held (&msk->pm.lock);
@@ -403,8 +409,9 @@ static bool mptcp_pm_alloc_anno_list(str add_entry->retrans_times =0 ;timer_setup (&add_entry->add_timer, mptcp_pm_add_timer,0 ); -sk_reset_timer (sk, &add_entry->add_timer, - jiffies +mptcp_get_add_addr_timeout (net)); + timeout =mptcp_get_add_addr_timeout (net); +if (timeout) +sk_reset_timer (sk, &add_entry->add_timer, jiffies + timeout);return true; }
Greg Kroah-Hartman
maintainerPATCH 594/644 drm/dp: Change AUX DPCD probe address from DPCD_REV to LANE0_1_STATUS
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
[ Upstream commit a40c5d727b8111b5db424a1e43e14a1dcce1e77f ]
Reading DPCD registers has side-effects in general. In particular accessing registers outside of the link training register range (0x102-0x106, 0x202-0x207, 0x200c-0x200f, 0x2216) is explicitly forbidden by the DP v2.1 Standard, see
3.6.5.1 DPTX AUX Transaction Handling Mandates 3.6.7.4 128b/132b DP Link Layer LTTPR Link Training Mandates
Based on my tests, accessing the DPCD_REV register during the link training of an UHBR TBT DP tunnel sink leads to link training failures.
Solve the above by using the DP_LANE0_1_STATUS (0x202) register for the DPCD register access quirk.
--- drivers/gpu/drm/drm_dp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_helper.c +1 -1
@@ -336,7 +336,7 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_a* monitor doesn't power down exactly after the throw away read. */ if (!aux->is_remote) { - ret =drm_dp_dpcd_access (aux,DP_AUX_NATIVE_READ ,DP_DPCD_REV , + ret =drm_dp_dpcd_access (aux,DP_AUX_NATIVE_READ ,DP_LANE0_1_STATUS , buffer,1 );if (ret !=1 ) goto out;
Greg Kroah-Hartman
maintainerPATCH 595/644 f2fs: fix to avoid out-of-boundary access in dnode page
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 77de19b6867f2740cdcb6c9c7e50d522b47847a4 ]
As Jiaming Zhang reported:
<TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x1c1/0x2a0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x17e/0x800 mm/kasan/report.c:480 kasan_report+0x147/0x180 mm/kasan/report.c:593 data_blkaddr fs/f2fs/f2fs.h:3053 [inline] f2fs_data_blkaddr fs/f2fs/f2fs.h:3058 [inline] f2fs_get_dnode_of_data+0x1a09/0x1c40 fs/f2fs/node.c:855 f2fs_reserve_block+0x53/0x310 fs/f2fs/data.c:1195 prepare_write_begin fs/f2fs/data.c:3395 [inline] f2fs_write_begin+0xf39/0x2190 fs/f2fs/data.c:3594 generic_perform_write+0x2c7/0x910 mm/filemap.c:4112 f2fs_buffered_write_iter fs/f2fs/file.c:4988 [inline] f2fs_file_write_iter+0x1ec8/0x2410 fs/f2fs/file.c:5216 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x546/0xa90 fs/read_write.c:686 ksys_write+0x149/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x3d0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f
The root cause is in the corrupted image, there is a dnode has the same node id w/ its inode, so during f2fs_get_dnode_of_data(), it tries to access block address in dnode at offset 934, however it parses the dnode as inode node, so that get_dnode_addr() returns 360, then it tries to access page address from 360 + 934 * 4 = 4096 w/ 4 bytes.
To fix this issue, let's add sanity check for node id of all direct nodes during f2fs_get_dnode_of_data().
--- fs/f2fs/node.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/f2fs/node.c +10 -0
@@ -798,6 +798,16 @@ int f2fs_get_dnode_of_data(struct dnode_for (i =1 ; i <= level; i++) {bool done = false; +if (nids[i] && nids[i] == dn->inode->i_ino) { + err = -EFSCORRUPTED ; +f2fs_err (sbi, +"inode mapping table is corrupted, run fsck to fix it, " +"ino:%lu, nid:%u, level:%d, offset:%d" , + dn->inode->i_ino, nids[i], level, offset[level]); +set_sbi_flag (sbi,SBI_NEED_FSCK ); + goto release_pages; + } +if (!nids[i] && mode ==ALLOC_NODE ) {/* alloc new node */ if (!f2fs_alloc_nid (sbi, &(nids[i]))) {
Greg Kroah-Hartman
maintainerPATCH 596/644 media: camss: Convert to platform remove callback returning void
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 428bbf4be4018aefa26e4d6531779fa8925ecaaf ]
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Stable-dep-of: 69080ec3d0da ("media: qcom: camss: cleanup media device allocated resource on error path")
--- drivers/media/platform/qcom/camss/camss.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/camss/camss.c +2 -4
@@ -1477,7 +1477,7 @@ void camss_delete(struct camss *camss)* * Always returns 0. */ -static int camss_remove (struct platform_device *pdev) +static void camss_remove (struct platform_device *pdev) {struct camss *camss =platform_get_drvdata (pdev);
@@ -1487,8 +1487,6 @@ static int camss_remove(struct platform_if (atomic_read (&camss->ref_count) ==0 )camss_delete (camss); - -return 0 ; }static const struct of_device_id camss_dt_match[] = {
@@ -1519,7 +1517,7 @@ static const struct dev_pm_ops camss_pm_static struct platform_driver qcom_camss_driver = { .probe = camss_probe, - .remove = camss_remove, + .remove_new = camss_remove, .driver = { .name ="qcom-camss" , .of_match_table = camss_dt_match,
Greg Kroah-Hartman
maintainerPATCH 597/644 media: qcom: camss: cleanup media device allocated resource on error path
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <[email protected]>
[ Upstream commit 69080ec3d0daba8a894025476c98ab16b5a505a4 ]
A call to media_device_init() requires media_device_cleanup() counterpart to complete cleanup and release any allocated resources.
This has been done in the driver .remove() right from the beginning, but error paths on .probe() shall also be fixed.
--- drivers/media/platform/qcom/camss/camss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/camss/camss.c +3 -1
@@ -1396,7 +1396,7 @@ static int camss_probe(struct platform_d ret =v4l2_device_register (camss->dev, &camss->v4l2_dev);if (ret <0 ) {dev_err (dev,"Failed to register V4L2 device: %d\n" , ret); - goto err_cleanup; + goto err_media_cleanup; } ret =camss_register_entities (camss);
@@ -1438,6 +1438,8 @@ err_register_subdevs:camss_unregister_entities (camss); err_register_entities:v4l2_device_unregister (&camss->v4l2_dev); +err_media_cleanup: +media_device_cleanup (&camss->media_dev); err_cleanup:v4l2_async_notifier_cleanup (&camss->notifier); err_free:
Greg Kroah-Hartman
maintainerPATCH 598/644 media: venus: Add support for SSR trigger using fault injection
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
[ Upstream commit 748b080f21678f2988b0da2d2b396a6f928d9b2c ]
Here we introduce a new fault injection for SSR trigger.
To trigger the SSR:
echo 100 > /sys/kernel/debug/venus/fail_ssr/probability echo 1 > /sys/kernel/debug/venus/fail_ssr/times
Stable-dep-of: 3200144a2fa4 ("media: venus: protect against spurious interrupts during probe")
--- drivers/media/platform/qcom/venus/core.c | 15 ++++++++++++++- drivers/media/platform/qcom/venus/dbgfs.c | 9 +++++++++ drivers/media/platform/qcom/venus/dbgfs.h | 13 +++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/venus/core.c +14 -1
@@ -263,6 +263,19 @@ static void venus_assign_register_offset } } +static irqreturn_t venus_isr_thread (int irq,void *dev_id) +{ +struct venus_core *core = dev_id; +irqreturn_t ret; + + ret =hfi_isr_thread (irq, dev_id); + +if (ret ==IRQ_HANDLED &&venus_fault_inject_ssr ()) +hfi_core_trigger_ssr (core,HFI_TEST_SSR_SW_ERR_FATAL ); + +return ret; +} +static int venus_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -319,7 +332,7 @@ static int venus_probe(struct platform_dmutex_init (&core->lock);INIT_DELAYED_WORK (&core->work, venus_sys_error_handler); - ret =devm_request_threaded_irq (dev, core->irq, hfi_isr, hfi_isr_thread, + ret =devm_request_threaded_irq (dev, core->irq, hfi_isr, venus_isr_thread,IRQF_TRIGGER_HIGH |IRQF_ONESHOT ,"venus" , core);if (ret)
drivers/media/platform/qcom/venus/dbgfs.c +9 -0
@@ -4,13 +4,22 @@*/ #include <linux/debugfs.h> +#include <linux/fault-inject.h> #include "core.h" +#ifdef CONFIG_FAULT_INJECTION +DECLARE_FAULT_ATTR (venus_ssr_attr); +#endif +void venus_dbgfs_init (struct venus_core *core) { core->root =debugfs_create_dir ("venus" ,NULL );debugfs_create_x32 ("fw_level" ,0644 , core->root, &venus_fw_debug); + +#ifdef CONFIG_FAULT_INJECTION +fault_create_debugfs_attr ("fail_ssr" , core->root, &venus_ssr_attr); +#endif }void venus_dbgfs_deinit (struct venus_core *core)
drivers/media/platform/qcom/venus/dbgfs.h +13 -0
@@ -4,8 +4,21 @@#ifndef __VENUS_DBGFS_H__#define __VENUS_DBGFS_H__ +#include <linux/fault-inject.h> +struct venus_core ; +#ifdef CONFIG_FAULT_INJECTION +extern struct fault_attr venus_ssr_attr; +static inline bool venus_fault_inject_ssr (void ) +{ +return should_fail (&venus_ssr_attr,1 ); +} +#else +static inline bool venus_fault_inject_ssr (void ) {return false; } +#endif + +void venus_dbgfs_init (struct venus_core *core);void venus_dbgfs_deinit (struct venus_core *core);
Greg Kroah-Hartman
maintainerPATCH 599/644 media: venus: protect against spurious interrupts during probe
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jorge Ramirez-Ortiz <[email protected]>
[ Upstream commit 3200144a2fa4209dc084a19941b9b203b43580f0 ]
Make sure the interrupt handler is initialized before the interrupt is registered.
If the IRQ is registered before hfi_create(), it's possible that an interrupt fires before the handler setup is complete, leading to a NULL dereference.
This error condition has been observed during system boot on Rb3Gen2.
--- drivers/media/platform/qcom/venus/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/venus/core.c +4 -4
@@ -332,13 +332,13 @@ static int venus_probe(struct platform_dmutex_init (&core->lock);INIT_DELAYED_WORK (&core->work, venus_sys_error_handler); - ret =devm_request_threaded_irq (dev, core->irq, hfi_isr, venus_isr_thread, -IRQF_TRIGGER_HIGH |IRQF_ONESHOT , -"venus" , core); + ret =hfi_create (core, &venus_core_ops);if (ret) goto err_core_put; - ret =hfi_create (core, &venus_core_ops); + ret =devm_request_threaded_irq (dev, core->irq, hfi_isr, venus_isr_thread, +IRQF_TRIGGER_HIGH |IRQF_ONESHOT , +"venus" , core);if (ret) goto err_core_put;
Greg Kroah-Hartman
maintainerPATCH 600/644 locking/barriers, kcsan: Support generic instrumentation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Elver <[email protected]>
[ Upstream commit 2505a51ac6f249956735e0a369e2404f96eebef0 ]
Thus far only smp_*() barriers had been defined by asm-generic/barrier.h based on __smp_*() barriers, because the !SMP case is usually generic.
With the introduction of instrumentation, it also makes sense to have asm-generic/barrier.h assist in the definition of instrumented versions of mb(), rmb(), wmb(), dma_rmb(), and dma_wmb().
Because there is no requirement to distinguish the !SMP case, the definition can be simpler: we can avoid also providing fallbacks for the __ prefixed cases, and only check if defined(__<barrier>), to finally define the KCSAN-instrumented versions.
This also allows for the compiler to complain if an architecture accidentally defines both the normal and __ prefixed variant.
Stable-dep-of: aa6956150f82 ("wifi: ath11k: fix dest ring-buffer corruption when ring is full")
--- include/asm-generic/barrier.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
include/asm-generic/barrier.h +25 -0
@@ -21,6 +21,31 @@#endif /* +* Architectures that want generic instrumentation can define __ prefixed +* variants of all barriers. +*/ + +#ifdef __mb +#define mb () do { kcsan_mb(); __mb(); } while (0) +#endif + +#ifdef __rmb +#define rmb () do { kcsan_rmb(); __rmb(); } while (0) +#endif + +#ifdef __wmb +#define wmb () do { kcsan_wmb(); __wmb(); } while (0) +#endif + +#ifdef __dma_rmb +#define dma_rmb () do { kcsan_rmb(); __dma_rmb(); } while (0) +#endif + +#ifdef __dma_wmb +#define dma_wmb () do { kcsan_wmb(); __dma_wmb(); } while (0) +#endif + +/* * Force strict CPU ordering. And yes, this is required on UP too when we're * talking to devices. *
Greg Kroah-Hartman
maintainerPATCH 601/644 asm-generic: Add memory barrier dma_mb()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kefeng Wang <[email protected]>
[ Upstream commit ed59dfd9509d172e4920994ed9cbebf93b0050cc ]
The memory barrier dma_mb() is introduced by commit a76a37777f2c ("iommu/arm-smmu-v3: Ensure queue is read after updating prod pointer"), which is used to ensure that prior (both reads and writes) accesses to memory by a CPU are ordered w.r.t. a subsequent MMIO write.
Stable-dep-of: aa6956150f82 ("wifi: ath11k: fix dest ring-buffer corruption when ring is full")
--- Documentation/memory-barriers.txt | 11 ++++++----- include/asm-generic/barrier.h | 8 ++++++++ 2 files changed, 14 insertions(+), 5 deletions(-)
Documentation/memory-barriers.txt +6 -5
@@ -1894,6 +1894,7 @@ There are some more advanced barrier fun (*) dma_wmb(); (*) dma_rmb(); + (*) dma_mb(); These are for use with consistent memory to guarantee the ordering of writes or reads of shared memory accessible to both the CPU and a
@@ -1925,11 +1926,11 @@ There are some more advanced barrier fun The dma_rmb() allows us guarantee the device has released ownership before we read the data from the descriptor, and the dma_wmb() allows us to guarantee the data is written to the descriptor before the device - can see it now has ownership. Note that, when using writel(), a prior - wmb() is not needed to guarantee that the cache coherent memory writes - have completed before writing to the MMIO region. The cheaper - writel_relaxed() does not provide this guarantee and must not be used - here. + can see it now has ownership. The dma_mb() implies both a dma_rmb() and + a dma_wmb(). Note that, when using writel(), a prior wmb() is not needed + to guarantee that the cache coherent memory writes have completed before + writing to the MMIO region. The cheaper writel_relaxed() does not provide + this guarantee and must not be used here. See the subsection "Kernel I/O barrier effects" for more information on relaxed I/O accessors and the Documentation/core-api/dma-api.rst file for
include/asm-generic/barrier.h +8 -0
@@ -37,6 +37,10 @@#define wmb () do { kcsan_wmb(); __wmb(); } while (0)#endif +#ifdef __dma_mb +#define dma_mb () do { kcsan_mb(); __dma_mb(); } while (0) +#endif +#ifdef __dma_rmb#define dma_rmb () do { kcsan_rmb(); __dma_rmb(); } while (0)#endif
@@ -64,6 +68,10 @@#define wmb () mb()#endif +#ifndef dma_mb +#define dma_mb () mb() +#endif +#ifndef dma_rmb#define dma_rmb () rmb()#endif
Greg Kroah-Hartman
maintainerPATCH 602/644 wifi: ath11k: fix dest ring-buffer corruption when ring is full
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit aa6956150f820e6a6deba44be325ddfcb5b10f88 ]
Add the missing memory barriers to make sure that destination ring descriptors are read before updating the tail pointer (and passing ownership to the device) to avoid memory corruption on weakly ordered architectures like aarch64 when the ring is full.
Tested-on: WCN6855 hw2.1 WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.41
--- drivers/net/wireless/ath/ath11k/hal.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/hal.c +9 -2
@@ -789,7 +789,6 @@ void ath11k_hal_srng_access_end(struct a {lockdep_assert_held (&srng->lock); -/* TODO: See if we need a write memory barrier here */ if (srng->flags &HAL_SRNG_FLAGS_LMAC_RING ) {/* For LMAC rings, ring pointer updates are done through FW and * hence written to a shared memory location that is read by FW
@@ -804,7 +803,11 @@ void ath11k_hal_srng_access_end(struct aWRITE_ONCE (*srng->u.src_ring.hp_addr, srng->u.src_ring.hp); }else { srng->u.dst_ring.last_hp = *srng->u.dst_ring.hp_addr; - *srng->u.dst_ring.tp_addr = srng->u.dst_ring.tp; +/* Make sure descriptor is read before updating the +* tail pointer. +*/ +dma_mb (); +WRITE_ONCE (*srng->u.dst_ring.tp_addr, srng->u.dst_ring.tp); } }else {if (srng->ring_dir ==HAL_SRNG_DIR_SRC ) {
@@ -820,6 +823,10 @@ void ath11k_hal_srng_access_end(struct a srng->u.src_ring.hp); }else { srng->u.dst_ring.last_hp = *srng->u.dst_ring.hp_addr; +/* Make sure descriptor is read before updating the +* tail pointer. +*/ +mb (); ath11k_hif_write32(ab, (unsigned long)srng->u.dst_ring.tp_addr - (unsigned long)ab->mem,
Greg Kroah-Hartman
maintainerPATCH 603/644 soc: qcom: mdt_loader: Ensure we dont read past the ELF header
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Andersson <[email protected]>
[ Upstream commit 9f9967fed9d066ed3dae9372b45ffa4f6fccfeef ]
When the MDT loader is used in remoteproc, the ELF header is sanitized beforehand, but that's not necessary the case for other clients.
Validate the size of the firmware buffer to ensure that we don't read past the end as we iterate over the header. e_phentsize and e_shentsize are validated as well, to ensure that the assumptions about step size in the traversal are valid.
--- drivers/soc/qcom/mdt_loader.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
drivers/soc/qcom/mdt_loader.c +41 -0
@@ -12,11 +12,43 @@#include <linux/firmware.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/overflow.h> #include <linux/qcom_scm.h> #include <linux/sizes.h> #include <linux/slab.h> #include <linux/soc/qcom/mdt_loader.h> +static bool mdt_header_valid (const struct firmware *fw) +{ +const struct elf32_hdr *ehdr; +size_t phend; +size_t shend; + +if (fw->size <sizeof (*ehdr)) +return false; + + ehdr = (struct elf32_hdr *)fw->data; + +if (memcmp (ehdr->e_ident,ELFMAG ,SELFMAG )) +return false; + +if (ehdr->e_phentsize !=sizeof (struct elf32_phdr )) +return false; + + phend =size_add (size_mul (sizeof (struct elf32_phdr ), ehdr->e_phnum), ehdr->e_phoff); +if (phend > fw->size) +return false; + +if (ehdr->e_shentsize !=sizeof (struct elf32_shdr )) +return false; + + shend =size_add (size_mul (sizeof (struct elf32_shdr ), ehdr->e_shnum), ehdr->e_shoff); +if (shend > fw->size) +return false; + +return true; +} +static bool mdt_phdr_valid (const struct elf32_phdr *phdr) {if (phdr->p_type !=PT_LOAD )
@@ -46,6 +78,9 @@ ssize_t qcom_mdt_get_size(const struct fphys_addr_t max_addr =0 ;int i; +if (!mdt_header_valid (fw)) +return -EINVAL ; + ehdr = (struct elf32_hdr *)fw->data; phdrs = (struct elf32_phdr *)(ehdr +1 );
@@ -92,6 +127,9 @@ void *qcom_mdt_read_metadata(const strucsize_t ehdr_size;void *data; +if (!mdt_header_valid (fw)) +return ERR_PTR (-EINVAL ); + ehdr = (struct elf32_hdr *)fw->data; phdrs = (struct elf32_phdr *)(ehdr +1 );
@@ -151,6 +189,9 @@ static int __qcom_mdt_load(struct deviceif (!fw || !mem_region || !mem_phys || !mem_size)return -EINVAL ; +if (!mdt_header_valid (fw)) +return -EINVAL ; + ehdr = (struct elf32_hdr *)fw->data; phdrs = (struct elf32_phdr *)(ehdr +1 );
Greg Kroah-Hartman
maintainerPATCH 604/644 iio: adc: ad_sigma_delta: change to buffer predisable
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
[ Upstream commit 66d4374d97f85516b5a22418c5e798aed2606dec ]
Change the buffer disable callback from postdisable to predisable. This balances the existing posteanble callback. Using postdisable with posteanble can be problematic, for example, if update_scan_mode fails, it would call postdisable without ever having called posteanble, so the drivers using this would be in an unexpected state when postdisable was called.
--- drivers/iio/adc/ad_sigma_delta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ad_sigma_delta.c +2 -2
@@ -371,7 +371,7 @@ err_unlock:return ret; } -static int ad_sd_buffer_postdisable (struct iio_dev *indio_dev) +static int ad_sd_buffer_predisable (struct iio_dev *indio_dev) {struct ad_sigma_delta *sigma_delta =iio_device_get_drvdata (indio_dev);
@@ -432,7 +432,7 @@ static irqreturn_t ad_sd_trigger_handlerstatic const struct iio_buffer_setup_ops ad_sd_buffer_setup_ops = { .postenable = &ad_sd_buffer_postenable, - .postdisable = &ad_sd_buffer_postdisable, + .predisable = &ad_sd_buffer_predisable, .validate_scan_mask = &iio_validate_scan_mask_onehot, };
Greg Kroah-Hartman
maintainerPATCH 605/644 scsi: ufs: exynos: Fix programming of HCI_UTRL_NEXUS_TYPE
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: André Draszik <[email protected]>
[ Upstream commit 01aad16c2257ab8ff33b152b972c9f2e1af47912 ]
On Google gs101, the number of UTP transfer request slots (nutrs) is 32, and in this case the driver ends up programming the UTRL_NEXUS_TYPE incorrectly as 0.
This is because the left hand side of the shift is 1, which is of type int, i.e. 31 bits wide. Shifting by more than that width results in undefined behaviour.
Fix this by switching to the BIT() macro, which applies correct type casting as required. This ensures the correct value is written to UTRL_NEXUS_TYPE (0xffffffff on gs101), and it also fixes a UBSAN shift warning:
UBSAN: shift-out-of-bounds in drivers/ufs/host/ufs-exynos.c:1113:21
shift exponent 32 is too large for 32-bit type 'int'For consistency, apply the same change to the nutmrs / UTMRL_NEXUS_TYPE write.
--- drivers/scsi/ufs/ufs-exynos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufs-exynos.c +2 -2
@@ -837,8 +837,8 @@ static int exynos_ufs_post_link(struct uhci_writel (ufs,0xa ,HCI_DATA_REORDER );hci_writel (ufs,PRDT_SET_SIZE (12 ),HCI_TXPRDT_ENTRY_SIZE );hci_writel (ufs,PRDT_SET_SIZE (12 ),HCI_RXPRDT_ENTRY_SIZE ); -hci_writel (ufs, (1 << hba->nutrs) -1 ,HCI_UTRL_NEXUS_TYPE ); -hci_writel (ufs, (1 << hba->nutmrs) -1 ,HCI_UTMRL_NEXUS_TYPE ); +hci_writel (ufs,BIT (hba->nutrs) -1 ,HCI_UTRL_NEXUS_TYPE ); +hci_writel (ufs,BIT (hba->nutmrs) -1 ,HCI_UTMRL_NEXUS_TYPE );hci_writel (ufs,0xf ,HCI_AXIDMA_RWDATA_BURST_LEN );if (ufs->opts &EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB )
Greg Kroah-Hartman
maintainerPATCH 606/644 scsi: mpi3mr: Drop unnecessary volatile from __iomem pointers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjan Kumar <[email protected]>
[ Upstream commit 6853885b21cb1d7157cc14c9d30cc17141565bae ]
The volatile qualifier is redundant for __iomem pointers.
Cleaned up usage in mpi3mr_writeq() and sysif_regs pointer as per Upstream compliance.
Stable-dep-of: c91e140c82eb ("scsi: mpi3mr: Serialize admin queue BAR writes on 32-bit systems")
--- drivers/scsi/mpi3mr/mpi3mr.h | 2 +- drivers/scsi/mpi3mr/mpi3mr_fw.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +1 -1
@@ -714,7 +714,7 @@ struct mpi3mr_ioc {char name[MPI3MR_NAME_LENGTH ];char driver_name[MPI3MR_NAME_LENGTH ]; -volatile struct mpi3_sysif_registers __iomem *sysif_regs; +struct mpi3_sysif_registers __iomem *sysif_regs;resource_size_t sysif_regs_phys;int bars;u64 dma_mask;
drivers/scsi/mpi3mr/mpi3mr_fw.c +2 -2
@@ -11,12 +11,12 @@#include <linux/io-64-nonatomic-lo-hi.h> #if defined(writeq) && defined(CONFIG_64BIT ) -static inline void mpi3mr_writeq (__u64 b,volatile void __iomem *addr) +static inline void mpi3mr_writeq (__u64 b,void __iomem *addr) {writeq (b, addr); }#else -static inline void mpi3mr_writeq (__u64 b,volatile void __iomem *addr) +static inline void mpi3mr_writeq (__u64 b,void __iomem *addr) {__u64 data_out = b;
Greg Kroah-Hartman
maintainerPATCH 607/644 scsi: mpi3mr: Serialize admin queue BAR writes on 32-bit systems
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjan Kumar <[email protected]>
[ Upstream commit c91e140c82eb58724c435f623702e51cc7896646 ]
On 32-bit systems, 64-bit BAR writes to admin queue registers are performed as two 32-bit writes. Without locking, this can cause partial writes when accessed concurrently.
Updated per-queue spinlocks is used to serialize these writes and prevent race conditions.
--- drivers/scsi/mpi3mr/mpi3mr.h | 4 ++++ drivers/scsi/mpi3mr/mpi3mr_fw.c | 15 +++++++++++---- drivers/scsi/mpi3mr/mpi3mr_os.c | 2 ++ 3 files changed, 17 insertions(+), 4 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +4 -0
@@ -701,6 +701,8 @@ struct scmd_priv {* @driver_info: Driver, Kernel, OS information to firmware * @change_count: Topology change count * @op_reply_q_offset: Operational reply queue offset with MSIx +* @adm_req_q_bar_writeq_lock: Admin request queue lock +* @adm_reply_q_bar_writeq_lock: Admin reply queue lock */ struct mpi3mr_ioc {struct list_head list;
@@ -828,6 +830,8 @@ struct mpi3mr_ioc {struct mpi3_driver_info_layout driver_info;u16 change_count;u16 op_reply_q_offset; +spinlock_t adm_req_q_bar_writeq_lock; +spinlock_t adm_reply_q_bar_writeq_lock; };/**
drivers/scsi/mpi3mr/mpi3mr_fw.c +11 -4
@@ -11,17 +11,22 @@#include <linux/io-64-nonatomic-lo-hi.h> #if defined(writeq) && defined(CONFIG_64BIT ) -static inline void mpi3mr_writeq (__u64 b,void __iomem *addr) +static inline void mpi3mr_writeq (__u64 b,void __iomem *addr, +spinlock_t *write_queue_lock) {writeq (b, addr); }#else -static inline void mpi3mr_writeq (__u64 b,void __iomem *addr) +static inline void mpi3mr_writeq (__u64 b,void __iomem *addr, +spinlock_t *write_queue_lock) {__u64 data_out = b; +unsigned long flags; +spin_lock_irqsave (write_queue_lock, flags);writel ((u32)(data_out), addr);writel ((u32)(data_out >>32 ), (addr +4 )); +spin_unlock_irqrestore (write_queue_lock, flags); }#endif
@@ -2183,9 +2188,11 @@ static int mpi3mr_setup_admin_qpair(stru (mrioc->num_admin_req);writel (num_admin_entries, &mrioc->sysif_regs->admin_queue_num_entries);mpi3mr_writeq (mrioc->admin_req_dma, - &mrioc->sysif_regs->admin_request_queue_address); + &mrioc->sysif_regs->admin_request_queue_address, + &mrioc->adm_req_q_bar_writeq_lock);mpi3mr_writeq (mrioc->admin_reply_dma, - &mrioc->sysif_regs->admin_reply_queue_address); + &mrioc->sysif_regs->admin_reply_queue_address, + &mrioc->adm_reply_q_bar_writeq_lock);writel (mrioc->admin_req_pi, &mrioc->sysif_regs->admin_request_queue_pi);writel (mrioc->admin_reply_ci, &mrioc->sysif_regs->admin_reply_queue_ci);return retval;
drivers/scsi/mpi3mr/mpi3mr_os.c +2 -0
@@ -3796,6 +3796,8 @@ mpi3mr_probe(struct pci_dev *pdev, constspin_lock_init (&mrioc->tgtdev_lock);spin_lock_init (&mrioc->watchdog_lock);spin_lock_init (&mrioc->chain_buf_lock); +spin_lock_init (&mrioc->adm_req_q_bar_writeq_lock); +spin_lock_init (&mrioc->adm_reply_q_bar_writeq_lock);INIT_LIST_HEAD (&mrioc->fwevt_list);INIT_LIST_HEAD (&mrioc->tgtdev_list);
Greg Kroah-Hartman
maintainerPATCH 608/644 pwm: mediatek: Implement .apply() callback
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 758de66f4bd2cac2b1d71db917c65c3d611d4e74 ]
To eventually get rid of all legacy drivers convert this driver to the modern world implementing .apply().
This just pushed a variant of pwm_apply_legacy() into the driver that was slightly simplified because the driver doesn't provide a .set_polarity() callback.
Stable-dep-of: f21d136caf81 ("pwm: mediatek: Fix duty and period setting")
--- drivers/pwm/pwm-mediatek.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
drivers/pwm/pwm-mediatek.c +26 -3
@@ -205,10 +205,33 @@ static void pwm_mediatek_disable(structpwm_mediatek_clk_disable (chip, pwm); } +static int pwm_mediatek_apply (struct pwm_chip *chip,struct pwm_device *pwm, +const struct pwm_state *state) +{ +int err; + +if (state->polarity !=PWM_POLARITY_NORMAL ) +return -EINVAL ; + +if (!state->enabled) { +if (pwm->state.enabled) +pwm_mediatek_disable (chip, pwm); + +return 0 ; + } + + err =pwm_mediatek_config (pwm->chip, pwm, state->duty_cycle, state->period); +if (err) +return err; + +if (!pwm->state.enabled) + err =pwm_mediatek_enable (chip, pwm); + +return err; +} +static const struct pwm_ops pwm_mediatek_ops = { - .config = pwm_mediatek_config, - .enable = pwm_mediatek_enable, - .disable = pwm_mediatek_disable, + .apply = pwm_mediatek_apply, .owner =THIS_MODULE , };
Greg Kroah-Hartman
maintainerPATCH 609/644 pwm: mediatek: Handle hardware enable and clock enable separately
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 704d918341c378c5f9505dfdf32d315e256d3846 ]
Stop handling the clocks in pwm_mediatek_enable() and pwm_mediatek_disable(). This is a preparing change for the next commit that requires that clocks and the enable bit are handled separately.
Also move these two functions a bit further up in the source file to make them usable in pwm_mediatek_config(), which is needed in the next commit, too.
Stable-dep-of: f21d136caf81 ("pwm: mediatek: Fix duty and period setting")
--- drivers/pwm/pwm-mediatek.c | 60 +++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 32 deletions(-)
drivers/pwm/pwm-mediatek.c +28 -32
@@ -114,6 +114,26 @@ static inline void pwm_mediatek_writel(swritel (value, chip->regs + pwm_mediatek_reg_offset[num] + offset); } +static void pwm_mediatek_enable (struct pwm_chip *chip,struct pwm_device *pwm) +{ +struct pwm_mediatek_chip *pc =to_pwm_mediatek_chip (chip); +u32 value; + + value =readl (pc->regs); + value |=BIT (pwm->hwpwm); +writel (value, pc->regs); +} + +static void pwm_mediatek_disable (struct pwm_chip *chip,struct pwm_device *pwm) +{ +struct pwm_mediatek_chip *pc =to_pwm_mediatek_chip (chip); +u32 value; + + value =readl (pc->regs); + value &= ~BIT (pwm->hwpwm); +writel (value, pc->regs); +} +static int pwm_mediatek_config (struct pwm_chip *chip,struct pwm_device *pwm,int duty_ns,int period_ns) {
@@ -176,35 +196,6 @@ out:return ret; } -static int pwm_mediatek_enable (struct pwm_chip *chip,struct pwm_device *pwm) -{ -struct pwm_mediatek_chip *pc =to_pwm_mediatek_chip (chip); -u32 value; -int ret; - - ret =pwm_mediatek_clk_enable (chip, pwm); -if (ret <0 ) -return ret; - - value =readl (pc->regs); - value |=BIT (pwm->hwpwm); -writel (value, pc->regs); - -return 0 ; -} - -static void pwm_mediatek_disable (struct pwm_chip *chip,struct pwm_device *pwm) -{ -struct pwm_mediatek_chip *pc =to_pwm_mediatek_chip (chip); -u32 value; - - value =readl (pc->regs); - value &= ~BIT (pwm->hwpwm); -writel (value, pc->regs); - -pwm_mediatek_clk_disable (chip, pwm); -} -static int pwm_mediatek_apply (struct pwm_chip *chip,struct pwm_device *pwm,const struct pwm_state *state) {
@@ -214,8 +205,10 @@ static int pwm_mediatek_apply(struct pwmreturn -EINVAL ;if (!state->enabled) { -if (pwm->state.enabled) +if (pwm->state.enabled) {pwm_mediatek_disable (chip, pwm); +pwm_mediatek_clk_disable (chip, pwm); + }return 0 ; }
@@ -224,8 +217,11 @@ static int pwm_mediatek_apply(struct pwmif (err)return err; -if (!pwm->state.enabled) - err =pwm_mediatek_enable (chip, pwm); +if (!pwm->state.enabled) { + err =pwm_mediatek_clk_enable (chip, pwm); +if (!err) +pwm_mediatek_enable (chip, pwm); + }return err; }
Greg Kroah-Hartman
maintainerPATCH 610/644 pwm: mediatek: Fix duty and period setting
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit f21d136caf8171f94159d975ea4620c164431bd9 ]
The period generated by the hardware is
(PWMDWIDTH + 1) << CLKDIV) / freq
according to my tests with a signal analyser and also the documentation.
The current algorithm doesn't consider the + 1 part and so configures slightly too high periods. The same issue exists for the duty cycle setting. So subtract 1 from both the register values for period and duty cycle. If period is 0, bail out, if duty_cycle is 0, just disable the PWM which results in a constant low output.
--- drivers/pwm/pwm-mediatek.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/pwm/pwm-mediatek.c +14 -7
@@ -163,7 +163,10 @@ static int pwm_mediatek_config(struct pwdo_div (resolution, clk_rate); cnt_period =DIV_ROUND_CLOSEST_ULL ((u64 )period_ns *1000 , resolution); -while (cnt_period >8191 ) { +if (!cnt_period) +return -EINVAL ; + +while (cnt_period >8192 ) { resolution *=2 ; clkdiv++; cnt_period = DIV_ROUND_CLOSEST_ULL((u64)period_ns * 1000,
@@ -186,9 +189,16 @@ static int pwm_mediatek_config(struct pw } cnt_duty =DIV_ROUND_CLOSEST_ULL ((u64 )duty_ns *1000 , resolution); +pwm_mediatek_writel (pc, pwm->hwpwm,PWMCON ,BIT (15 ) | clkdiv); -pwm_mediatek_writel (pc, pwm->hwpwm, reg_width, cnt_period); -pwm_mediatek_writel (pc, pwm->hwpwm, reg_thres, cnt_duty); +pwm_mediatek_writel (pc, pwm->hwpwm, reg_width, cnt_period -1 ); + +if (cnt_duty) { +pwm_mediatek_writel (pc, pwm->hwpwm, reg_thres, cnt_duty -1 ); +pwm_mediatek_enable (chip, pwm); + }else { +pwm_mediatek_disable (chip, pwm); + } out:pwm_mediatek_clk_disable (chip, pwm);
@@ -217,11 +227,8 @@ static int pwm_mediatek_apply(struct pwmif (err)return err; -if (!pwm->state.enabled) { +if (!pwm->state.enabled) err =pwm_mediatek_clk_enable (chip, pwm); -if (!err) -pwm_mediatek_enable (chip, pwm); - }return err; }
Greg Kroah-Hartman
maintainerPATCH 611/644 selftests: mptcp: pm: check flush doesnt reset limits
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 452690be7de2f91cc0de68cb9e95252875b33503 upstream.
This modification is linked to the parent commit where the received ADD_ADDR limit was accidentally reset when the endpoints were flushed.
To validate that, the test is now flushing endpoints after having set new limits, and before checking them.
The 'Fixes' tag here below is the same as the one from the previous
commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID.
[ Conflicts in pm_netlink.sh, because some refactoring have been done
later on: commit 3188309c8ceb ("selftests: mptcp: netlink:
add 'limits' helpers") and commit c99d57d0007a ("selftests: mptcp: use pm_nl endpoint ops") are not in this version. The same operation can still be done at the same place, without using the new helper. ]
--- tools/testing/selftests/net/mptcp/pm_netlink.sh | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/mptcp/pm_netlink.sh +1 -0
@@ -131,6 +131,7 @@ ip netns exec $ns1 ./pm_nl_ctl limits 1 check "ip netns exec $ns1 ./pm_nl_ctl limits" "$default_limits" "subflows above hard limit" ip netns exec $ns1 ./pm_nl_ctl limits 8 8 +ip netns exec $ns1 ./pm_nl_ctl flush check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 8 subflows 8" "set limits"
Greg Kroah-Hartman
maintainerPATCH 612/644 compiler: remove __ADDRESSABLE_ASM{_STR,}() again
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <[email protected]>
[ Upstream commit 8ea815399c3fcce1889bd951fec25b5b9a3979c1 ]
__ADDRESSABLE_ASM_STR() is where the necessary stringification happens. As long as "sym" doesn't contain any odd characters, no quoting is required for its use with .quad / .long. In fact the quotation gets in the way with gas 2.25; it's only from 2.26 onwards that quoted symbols are half-way properly supported.
However, assembly being different from C anyway, drop __ADDRESSABLE_ASM_STR() and its helper macro altogether. A simple .global directive will suffice to get the symbol "declared", i.e. into the symbol table. While there also stop open-coding STATIC_CALL_TRAMP() and STATIC_CALL_KEY().
Message-ID: <[email protected]>
--- arch/x86/include/asm/xen/hypercall.h | 6 ++++-- include/linux/compiler.h | 8 -------- 2 files changed, 4 insertions(+), 10 deletions(-)
arch/x86/include/asm/xen/hypercall.h +4 -2
@@ -37,6 +37,7 @@#include <linux/spinlock.h> #include <linux/errno.h> #include <linux/string.h> +#include <linux/stringify.h> #include <linux/types.h> #include <linux/pgtable.h> #include <linux/instrumentation.h>
@@ -94,12 +95,13 @@ DECLARE_STATIC_CALL(xen_hypercall, xen_h#ifdef MODULE #define __ADDRESSABLE_xen_hypercall#else -#define __ADDRESSABLE_xen_hypercall __ADDRESSABLE_ASM_STR(__SCK__xen_hypercall) +#define __ADDRESSABLE_xen_hypercall \ + __stringify(.global STATIC_CALL_KEY(xen_hypercall);)#endif #define __HYPERCALL \ __ADDRESSABLE_xen_hypercall \ - "call __SCT__xen_hypercall" + __stringify(call STATIC_CALL_TRAMP(xen_hypercall))#define __HYPERCALL_ENTRY (x) "a" (x)
include/linux/compiler.h +0 -8
@@ -249,14 +249,6 @@ static inline void *offset_to_ptr(const static void * __section(".discard.addressable") __used \__UNIQUE_ID (__PASTE (__addressable_ ,sym )) = (void *)&sym; -#define __ADDRESSABLE_ASM (sym) \ - .pushsection .discard.addressable,"aw"; \ - .align ARCH_SEL(8,4); \ - ARCH_SEL(.quad, .long) __stringify(sym); \ - .popsection; - -#define __ADDRESSABLE_ASM_STR (sym) __stringify(__ADDRESSABLE_ASM(sym)) -/* &a[0] degrades to a pointer: a different type from an array */ #define __must_be_array (a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
Greg Kroah-Hartman
maintainerPATCH 613/644 usb: xhci: Fix slot_id resource race conflict
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weitao Wang <[email protected]>
[ Upstream commit 2eb03376151bb8585caa23ed2673583107bb5193 ]
xHC controller may immediately reuse a slot_id after it's disabled, giving it to a new enumerating device before the xhci driver freed all resources related to the disabled device.
In such a scenario, device-A with slot_id equal to 1 is disconnecting while device-B is enumerating, device-B will fail to enumerate in the follow sequence.
1.[device-A] send disable slot command
2.[device-B] send enable slot command
3.[device-A] disable slot command completed and wakeup waiting thread 4.[device-B] enable slot command completed with slot_id equal to 1 and
wakeup waiting thread
5.[device-B] driver checks that slot_id is still in use (by device-A) in
xhci_alloc_virt_device, and fail to enumerate due to this conflict
6.[device-A] xhci->devs[slot_id] set to NULL in xhci_free_virt_device
To fix driver's slot_id resources conflict, clear xhci->devs[slot_id] and xhci->dcbba->dev_context_ptrs[slot_id] pointers in the interrupt context when disable slot command completes successfully. Simultaneously, adjust function xhci_free_virt_device to accurately handle device release.
[minor smatch warning and commit message fix -Mathias]
--- drivers/usb/host/xhci-hub.c | 3 +-- drivers/usb/host/xhci-mem.c | 22 +++++++++++----------- drivers/usb/host/xhci-ring.c | 9 +++++++-- drivers/usb/host/xhci.c | 18 +++++++++++++----- drivers/usb/host/xhci.h | 3 ++- 5 files changed, 34 insertions(+), 21 deletions(-)
drivers/usb/host/xhci-hub.c +1 -2
@@ -716,8 +716,7 @@ static int xhci_enter_test_mode(struct xif (!xhci->devs[i])continue ; - retval =xhci_disable_slot (xhci, i); -xhci_free_virt_device (xhci, i); + retval =xhci_disable_and_free_slot (xhci, i);if (retval)xhci_err (xhci,"Failed to disable slot %d, %d. Enter test mode anyway\n" , i, retval);
drivers/usb/host/xhci-mem.c +11 -11
@@ -871,21 +871,20 @@ free_tts:* will be manipulated by the configure endpoint, allocate device, or update * hub functions while this function is removing the TT entries from the list. */ -void xhci_free_virt_device (struct xhci_hcd *xhci,int slot_id) +void xhci_free_virt_device (struct xhci_hcd *xhci,struct xhci_virt_device *dev, +int slot_id) { -struct xhci_virt_device *dev;int i;int old_active_eps =0 ;/* Slot ID 0 is reserved */ -if (slot_id ==0 || !xhci->devs[slot_id]) +if (slot_id ==0 || !dev)return ; - dev = xhci->devs[slot_id]; - - xhci->dcbaa->dev_context_ptrs[slot_id] =0 ; -if (!dev) -return ; +/* If device ctx array still points to _this_ device, clear it */ +if (dev->out_ctx && + xhci->dcbaa->dev_context_ptrs[slot_id] ==cpu_to_le64 (dev->out_ctx->dma)) + xhci->dcbaa->dev_context_ptrs[slot_id] =0 ;trace_xhci_free_virt_device (dev);
@@ -924,8 +923,9 @@ void xhci_free_virt_device(struct xhci_hif (dev->udev && dev->udev->slot_id) dev->udev->slot_id =0 ; -kfree (xhci->devs[slot_id]); - xhci->devs[slot_id] =NULL ; +if (xhci->devs[slot_id] == dev) + xhci->devs[slot_id] =NULL ; +kfree (dev); }/*
@@ -967,7 +967,7 @@ static void xhci_free_virt_devices_depth out:/* we are now at a leaf device */ xhci_debugfs_remove_slot (xhci, slot_id); -xhci_free_virt_device (xhci, slot_id); +xhci_free_virt_device (xhci, vdev, slot_id); } int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
drivers/usb/host/xhci-ring.c +7 -2
@@ -1612,7 +1612,8 @@ static void xhci_handle_cmd_enable_slot( command->slot_id =0 ; } -static void xhci_handle_cmd_disable_slot (struct xhci_hcd *xhci,int slot_id) +static void xhci_handle_cmd_disable_slot (struct xhci_hcd *xhci,int slot_id, +u32 cmd_comp_code) {struct xhci_virt_device *virt_dev;struct xhci_slot_ctx *slot_ctx;
@@ -1627,6 +1628,10 @@ static void xhci_handle_cmd_disable_slotif (xhci->quirks &XHCI_EP_LIMIT_QUIRK )/* Delete default control endpoint resources */ xhci_free_device_endpoint_resources (xhci, virt_dev, true); +if (cmd_comp_code ==COMP_SUCCESS ) { + xhci->dcbaa->dev_context_ptrs[slot_id] =0 ; + xhci->devs[slot_id] =NULL ; + } } static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id,
@@ -1876,7 +1881,7 @@ static void handle_cmd_completion(structxhci_handle_cmd_enable_slot (xhci, slot_id, cmd, cmd_comp_code);break ;case TRB_DISABLE_SLOT : -xhci_handle_cmd_disable_slot (xhci, slot_id); +xhci_handle_cmd_disable_slot (xhci, slot_id, cmd_comp_code);break ;case TRB_CONFIG_EP :if (!cmd->completion)
drivers/usb/host/xhci.c +13 -5
@@ -4032,7 +4032,7 @@ static void xhci_free_dev(struct usb_hcdxhci_disable_slot (xhci, udev->slot_id);spin_lock_irqsave (&xhci->lock, flags); -xhci_free_virt_device (xhci, udev->slot_id); +xhci_free_virt_device (xhci, virt_dev, udev->slot_id);spin_unlock_irqrestore (&xhci->lock, flags); }
@@ -4081,6 +4081,16 @@ int xhci_disable_slot(struct xhci_hcd *xreturn ret; } +int xhci_disable_and_free_slot (struct xhci_hcd *xhci,u32 slot_id) +{ +struct xhci_virt_device *vdev = xhci->devs[slot_id]; +int ret; + + ret =xhci_disable_slot (xhci, slot_id); +xhci_free_virt_device (xhci, vdev, slot_id); +return ret; +} +/* * Checks if we have enough host controller resources for the default control * endpoint.
@@ -4186,8 +4196,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd,return 1 ; disable_slot: -xhci_disable_slot (xhci, udev->slot_id); -xhci_free_virt_device (xhci, udev->slot_id); +xhci_disable_and_free_slot (xhci, udev->slot_id);return 0 ; }
@@ -4323,8 +4332,7 @@ static int xhci_setup_device(struct usb_dev_warn (&udev->dev,"Device not responding to setup %s.\n" , act);mutex_unlock (&xhci->mutex); - ret =xhci_disable_slot (xhci, udev->slot_id); -xhci_free_virt_device (xhci, udev->slot_id); + ret =xhci_disable_and_free_slot (xhci, udev->slot_id);if (!ret) {if (xhci_alloc_dev (hcd, udev) ==1 )xhci_setup_addressable_virt_dev (xhci, udev);
drivers/usb/host/xhci.h +2 -1
@@ -1782,7 +1782,7 @@ void xhci_dbg_trace(struct xhci_hcd *xhc/* xHCI memory management */ void xhci_mem_cleanup (struct xhci_hcd *xhci);int xhci_mem_init (struct xhci_hcd *xhci,gfp_t flags); -void xhci_free_virt_device (struct xhci_hcd *xhci,int slot_id); +void xhci_free_virt_device (struct xhci_hcd *xhci,struct xhci_virt_device *dev,int slot_id);int xhci_alloc_virt_device (struct xhci_hcd *xhci,int slot_id,struct usb_device *udev,gfp_t flags);int xhci_setup_addressable_virt_dev (struct xhci_hcd *xhci,struct usb_device *udev); void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci,
@@ -1874,6 +1874,7 @@ void xhci_reset_bandwidth(struct usb_hcdint xhci_update_hub_device (struct usb_hcd *hcd,struct usb_device *hdev,struct usb_tt *tt,gfp_t mem_flags);int xhci_disable_slot (struct xhci_hcd *xhci,u32 slot_id); +int xhci_disable_and_free_slot (struct xhci_hcd *xhci,u32 slot_id);int xhci_ext_cap_init (struct xhci_hcd *xhci);int xhci_suspend (struct xhci_hcd *xhci,bool do_wakeup);
Greg Kroah-Hartman
maintainerPATCH 614/644 iio: imu: inv_icm42600: change invalid data error to -EBUSY
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <[email protected]>
[ Upstream commit dfdc31e7ccf3ac1d5ec01d5120c71e14745e3dd8 ]
Temperature sensor returns the temperature of the mechanical parts of the chip. If both accel and gyro are off, the temperature sensor is also automatically turned off and returns invalid data.
In this case, returning -EBUSY error code is better then -EINVAL and indicates userspace that it needs to retry reading temperature in another context.
--- drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c +5 -1
@@ -32,8 +32,12 @@ static int inv_icm42600_temp_read(struct goto exit; *temp = (int16_t )be16_to_cpup (raw); +/* +* Temperature data is invalid if both accel and gyro are off. +* Return -EBUSY in this case. +*/ if (*temp ==INV_ICM42600_DATA_INVALID ) - ret = -EINVAL ; + ret = -EBUSY ; exit:mutex_unlock (&st->lock);
Greg Kroah-Hartman
maintainerPATCH 615/644 tracing: Remove unneeded goto out logic
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit c89504a703fb779052213add0e8ed642f4a4f1c8 ]
Several places in the trace.c file there's a goto out where the out is simply a return. There's no reason to jump to the out label if it's not doing any more logic but simply returning from the function.
Replace the goto outs with a return and remove the out labels.
--- kernel/trace/trace.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-)
kernel/trace/trace.c +14 -23
@@ -1605,7 +1605,7 @@ int trace_get_user(struct trace_parser * ret =get_user (ch, ubuf++);if (ret) - goto out; +return ret; read++; cnt--;
@@ -1619,7 +1619,7 @@ int trace_get_user(struct trace_parser *while (cnt &&isspace (ch)) { ret =get_user (ch, ubuf++);if (ret) - goto out; +return ret; read++; cnt--; }
@@ -1629,8 +1629,7 @@ int trace_get_user(struct trace_parser */* only spaces were written */ if (isspace (ch) || !ch) { *ppos += read; - ret = read; - goto out; +return read; } }
@@ -1638,13 +1637,12 @@ int trace_get_user(struct trace_parser *while (cnt && !isspace (ch) && ch) {if (parser->idx < parser->size -1 ) parser->buffer[parser->idx++] = ch; -else { - ret = -EINVAL ; - goto out; - } +else +return -EINVAL ; + ret =get_user (ch, ubuf++);if (ret) - goto out; +return ret; read++; cnt--; }
@@ -1659,15 +1657,11 @@ int trace_get_user(struct trace_parser */* Make sure the parsed string always terminates with '\0'. */ parser->buffer[parser->idx] =0 ; }else { - ret = -EINVAL ; - goto out; +return -EINVAL ; } *ppos += read; - ret = read; - -out: -return ret; +return read; }/* TODO add a seq_buf_to_buffer() */
@@ -2136,10 +2130,10 @@ int __init register_tracer(struct tracermutex_unlock (&trace_types_lock);if (ret || !default_bootup_tracer) - goto out_unlock; +return ret;if (strncmp (default_bootup_tracer, type->name,MAX_TRACER_SIZE )) - goto out_unlock; +return 0 ;printk (KERN_INFO "Starting tracer '%s'\n" , type->name);/* Do we want this tracer to start on bootup? */
@@ -2151,8 +2145,7 @@ int __init register_tracer(struct tracer/* disable other selftests, since this will break it. */ disable_tracing_selftest ("running a tracer" ); - out_unlock: -return ret; +return 0 ; }static void tracing_reset_cpu (struct array_buffer *buf,int cpu)
@@ -8711,11 +8704,10 @@ ftrace_trace_snapshot_callback(struct tr out_reg: ret =tracing_alloc_snapshot_instance (tr);if (ret <0 ) - goto out; +return ret; ret =register_ftrace_function_probe (glob, tr, ops, count); - out:return ret <0 ? ret :0 ; }
@@ -10231,7 +10223,7 @@ __init static int tracer_alloc_buffers(vBUILD_BUG_ON (TRACE_ITER_LAST_BIT >TRACE_FLAGS_MAX_SIZE );if (!alloc_cpumask_var (&tracing_buffer_mask,GFP_KERNEL )) - goto out; +return -ENOMEM ;if (!alloc_cpumask_var (&global_trace.tracing_cpumask,GFP_KERNEL )) goto out_free_buffer_mask;
@@ -10344,7 +10336,6 @@ out_free_cpumask:free_cpumask_var (global_trace.tracing_cpumask); out_free_buffer_mask:free_cpumask_var (tracing_buffer_mask); -out:return ret; }
Greg Kroah-Hartman
maintainerPATCH 616/644 tracing: Limit access to parser->buffer when trace_get_user failed
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pu Lehui <[email protected]>
[ Upstream commit 6a909ea83f226803ea0e718f6e88613df9234d58 ]
When the length of the string written to set_ftrace_filter exceeds FTRACE_BUFF_MAX, the following KASAN alarm will be triggered:
BUG: KASAN: slab-out-of-bounds in strsep+0x18c/0x1b0 Read of size 1 at addr ffff0000d00bd5ba by task ash/165 CPU: 1 UID: 0 PID: 165 Comm: ash Not tainted 6.16.0-g6bcdbd62bd56-dirty Hardware name: linux,dummy-virt (DT) Call trace: show_stack+0x34/0x50 (C) dump_stack_lvl+0xa0/0x158 print_address_description.constprop.0+0x88/0x398 print_report+0xb0/0x280 kasan_report+0xa4/0xf0 __asan_report_load1_noabort+0x20/0x30 strsep+0x18c/0x1b0 ftrace_process_regex.isra.0+0x100/0x2d8 ftrace_regex_release+0x484/0x618 __fput+0x364/0xa58 ____fput+0x28/0x40 task_work_run+0x154/0x278 do_notify_resume+0x1f0/0x220 el0_svc+0xec/0xf0 el0t_64_sync_handler+0xa0/0xe8 el0t_64_sync+0x1ac/0x1b0
The reason is that trace_get_user will fail when processing a string longer than FTRACE_BUFF_MAX, but not set the end of parser->buffer to 0. Then an OOB access will be triggered in ftrace_regex_release-> ftrace_process_regex->strsep->strpbrk. We can solve this problem by limiting access to parser->buffer when trace_get_user failed.
--- kernel/trace/trace.c | 18 ++++++++++++------ kernel/trace/trace.h | 8 +++++++- 2 files changed, 19 insertions(+), 7 deletions(-)
kernel/trace/trace.c +12 -6
@@ -1605,7 +1605,7 @@ int trace_get_user(struct trace_parser * ret =get_user (ch, ubuf++);if (ret) -return ret; + goto fail; read++; cnt--;
@@ -1619,7 +1619,7 @@ int trace_get_user(struct trace_parser *while (cnt &&isspace (ch)) { ret =get_user (ch, ubuf++);if (ret) -return ret; + goto fail; read++; cnt--; }
@@ -1637,12 +1637,14 @@ int trace_get_user(struct trace_parser *while (cnt && !isspace (ch) && ch) {if (parser->idx < parser->size -1 ) parser->buffer[parser->idx++] = ch; -else -return -EINVAL ; +else { + ret = -EINVAL ; + goto fail; + } ret =get_user (ch, ubuf++);if (ret) -return ret; + goto fail; read++; cnt--; }
@@ -1657,11 +1659,15 @@ int trace_get_user(struct trace_parser */* Make sure the parsed string always terminates with '\0'. */ parser->buffer[parser->idx] =0 ; }else { -return -EINVAL ; + ret = -EINVAL ; + goto fail; } *ppos += read;return read; +fail: +trace_parser_fail (parser); +return ret; }/* TODO add a seq_buf_to_buffer() */
kernel/trace/trace.h +7 -1
@@ -1132,6 +1132,7 @@ bool ftrace_event_is_function(struct tra*/ struct trace_parser {bool cont; +bool fail;char *buffer;unsigned idx;unsigned size;
@@ -1139,7 +1140,7 @@ struct trace_parser {static inline bool trace_parser_loaded (struct trace_parser *parser) { -return (parser->idx !=0 ); +return !parser->fail && parser->idx !=0 ; }static inline bool trace_parser_cont (struct trace_parser *parser)
@@ -1153,6 +1154,11 @@ static inline void trace_parser_clear(st parser->idx =0 ; } +static inline void trace_parser_fail (struct trace_parser *parser) +{ + parser->fail = true; +} +extern int trace_parser_get_init (struct trace_parser *parser,int size);extern void trace_parser_put (struct trace_parser *parser); extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
Greg Kroah-Hartman
maintainerPATCH 617/644 iio: light: as73211: Ensure buffer holes are zeroed
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit 433b99e922943efdfd62b9a8e3ad1604838181f2 ]
Given that the buffer is copied to a kfifo that ultimately user space can read, ensure we zero it.
--- drivers/iio/light/as73211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/as73211.c +1 -1
@@ -573,7 +573,7 @@ static irqreturn_t as73211_trigger_handlstruct {__le16 chan[4 ];s64 ts__aligned(8) ; - } scan; + } scan = { };int data_result, ret;mutex_lock (&data->mutex);
Greg Kroah-Hartman
maintainerPATCH 618/644 mm/memory-failure: fix infinite UCE for VM_PFNMAP pfn
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjiang Tu <[email protected]>
[ Upstream commit 2e6053fea379806269c4f7f5e36b523c9c0fb35c ]
When memory_failure() is called for a already hwpoisoned pfn, kill_accessing_process() will be called to kill current task. However, if the vma of the accessing vaddr is VM_PFNMAP, walk_page_range() will skip the vma in walk_page_test() and return 0.
Before commit aaf99ac2ceb7 ("mm/hwpoison: do not send SIGBUS to processes with recovered clean pages"), kill_accessing_process() will return EFAULT. For x86, the current task will be killed in kill_me_maybe().
However, after this commit, kill_accessing_process() simplies return 0, that means UCE is handled properly, but it doesn't actually. In such case, the user task will trigger UCE infinitely.
To fix it, add .test_walk callback for hwpoison_walk_ops to scan all vmas.
--- mm/memory-failure.c | 8 ++++++++ 1 file changed, 8 insertions(+)
mm/memory-failure.c +8 -0
@@ -674,9 +674,17 @@ static int hwpoison_hugetlb_range(pte_t#define hwpoison_hugetlb_range NULL#endif +static int hwpoison_test_walk (unsigned long start,unsigned long end, +struct mm_walk *walk) +{ +/* We also want to consider pages mapped into VM_PFNMAP. */ +return 0 ; +} +static struct mm_walk_ops hwp_walk_ops = { .pmd_entry = hwpoison_pte_range, .hugetlb_entry = hwpoison_hugetlb_range, + .test_walk = hwpoison_test_walk, };/*
Greg Kroah-Hartman
maintainerPATCH 619/644 x86/cpu/hygon: Add missing resctrl_cpu_detect() in bsp_init helper
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tianxiang Peng <[email protected]>
commit d8df126349dad855cdfedd6bbf315bad2e901c2f upstream.
Since
923f3a2b48bd ("x86/resctrl: Query LLC monitoring properties once during boot")
resctrl_cpu_detect() has been moved from common CPU initialization code to the vendor-specific BSP init helper, while Hygon didn't put that call in their code.
This triggers a division by zero fault during early booting stage on our machines with X86_FEATURE_CQM* supported, where get_rdt_mon_resources() tries to calculate mon_l3_config with uninitialized boot_cpu_data.x86_cache_occ_scale.
Add the missing resctrl_cpu_detect() in the Hygon BSP init helper.
[ bp: Massage commit message. ]
--- arch/x86/kernel/cpu/hygon.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kernel/cpu/hygon.c +3 -0
@@ -14,6 +14,7 @@#include <asm/cacheinfo.h> #include <asm/spec-ctrl.h> #include <asm/delay.h> +#include <asm/resctrl.h> #include "cpu.h"
@@ -239,6 +240,8 @@ static void bsp_init_hygon(struct cpuinf x86_amd_ls_cfg_ssbd_mask =1ULL <<10 ; } } + +resctrl_cpu_detect (c); }static void early_init_hygon (struct cpuinfo_x86 *c)
Greg Kroah-Hartman
maintainerPATCH 620/644 mm/page_alloc: detect allocation forbidden by cpuset and bail out early
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Feng Tang <[email protected]>
[ Upstream commit 8ca1b5a49885f0c0c486544da46a9e0ac790831d ]
There was a report that starting an Ubuntu in docker while using cpuset to bind it to movable nodes (a node only has movable zone, like a node for hotplug or a Persistent Memory node in normal usage) will fail due to memory allocation failure, and then OOM is involved and many other innocent processes got killed.
It can be reproduced with command:
$ docker run -it --rm --cpuset-mems 4 ubuntu:latest bash -c "grep Mems_allowed /proc/self/status"
(where node 4 is a movable node)
runc:[2:INIT] invoked oom-killer: gfp_mask=0x500cc2(GFP_HIGHUSER|__GFP_ACCOUNT), order=0, oom_score_adj=0
CPU: 8 PID: 8291 Comm: runc:[2:INIT] Tainted: G W I E 5.8.2-0.g71b519a-default #1 openSUSE Tumbleweed (unreleased) Hardware name: Dell Inc. PowerEdge R640/0PHYDR, BIOS 2.6.4 04/09/2020 Call Trace: dump_stack+0x6b/0x88 dump_header+0x4a/0x1e2 oom_kill_process.cold+0xb/0x10 out_of_memory.part.0+0xaf/0x230 out_of_memory+0x3d/0x80 __alloc_pages_slowpath.constprop.0+0x954/0xa20 __alloc_pages_nodemask+0x2d3/0x300 pipe_write+0x322/0x590 new_sync_write+0x196/0x1b0 vfs_write+0x1c3/0x1f0 ksys_write+0xa7/0xe0 do_syscall_64+0x52/0xd0 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Mem-Info:
active_anon:392832 inactive_anon:182 isolated_anon:0
active_file:68130 inactive_file:151527 isolated_file:0
unevictable:2701 dirty:0 writeback:7
slab_reclaimable:51418 slab_unreclaimable:116300
mapped:45825 shmem:735 pagetables:2540 bounce:0
free:159849484 free_pcp:73 free_cma:0
Node 4 active_anon:1448kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:0kB writeback:0kB shmem:0kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 0kB writeback_tmp:0kB all_unreclaimable? no
Node 4 Movable free:130021408kB min:9140kB low:139160kB high:269180kB reserved_highatomic:0KB active_anon:1448kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:130023424kB managed:130023424kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:292kB local_pcp:84kB free_cma:0kB lowmem_reserve[]: 0 0 0 0 0
Node 4 Movable: 1*4kB (M) 0*8kB 0*16kB 1*32kB (M) 0*64kB 0*128kB 1*256kB (M) 1*512kB (M) 1*1024kB (M) 0*2048kB 31743*4096kB (M) = 130021156kB
oom-kill:constraint=CONSTRAINT_CPUSET,nodemask=(null),cpuset=docker-9976a269caec812c134fa317f27487ee36e1129beba7278a463dd53e5fb9997b.scope,mems_allowed=4,global_oom,task_memcg=/system.slice/containerd.service,task=containerd,pid=4100,uid=0 Out of memory: Killed process 4100 (containerd) total-vm:4077036kB, anon-rss:51184kB, file-rss:26016kB, shmem-rss:0kB, UID:0 pgtables:676kB oom_score_adj:0
oom_reaper: reaped process 8248 (docker), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
oom_reaper: reaped process 2054 (node_exporter), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
oom_reaper: reaped process 1452 (systemd-journal), now anon-rss:0kB, file-rss:8564kB, shmem-rss:4kB
oom_reaper: reaped process 2146 (munin-node), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
oom_reaper: reaped process 8291 (runc:[2:INIT]), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
The reason is that in this case, the target cpuset nodes only have movable zone, while the creation of an OS in docker sometimes needs to allocate memory in non-movable zones (dma/dma32/normal) like GFP_HIGHUSER, and the cpuset limit forbids the allocation, then out-of-memory killing is involved even when normal nodes and movable nodes both have many free memory.
The OOM killer cannot help to resolve the situation as there is no usable memory for the request in the cpuset scope. The only reasonable measure to take is to fail the allocation right away and have the caller to deal with it.
So add a check for cases like this in the slowpath of allocation, and bail out early returning NULL for the allocation.
As page allocation is one of the hottest path in kernel, this check will hurt all users with sane cpuset configuration, add a static branch check and detect the abnormal config in cpuset memory binding setup so that the extra check cost in page allocation is not paid by everyone.
[thanks to Micho Hocko and David Rientjes for suggesting not handling
it inside OOM code, adding cpuset check, refining comments]
Stable-dep-of: 65f97cc81b0a ("cgroup/cpuset: Use static_branch_enable_cpuslocked() on cpusets_insane_config_key")
--- include/linux/cpuset.h | 17 +++++++++++++++++ include/linux/mmzone.h | 22 ++++++++++++++++++++++ kernel/cgroup/cpuset.c | 23 +++++++++++++++++++++++ mm/page_alloc.c | 13 +++++++++++++ 4 files changed, 75 insertions(+)
include/linux/cpuset.h +17 -0
@@ -34,6 +34,8 @@*/ extern struct static_key_false cpusets_pre_enable_key;extern struct static_key_false cpusets_enabled_key; +extern struct static_key_false cpusets_insane_config_key; +static inline bool cpusets_enabled (void ) {return static_branch_unlikely (&cpusets_enabled_key);
@@ -51,6 +53,19 @@ static inline void cpuset_dec(void)static_branch_dec_cpuslocked (&cpusets_pre_enable_key); } +/* +* This will get enabled whenever a cpuset configuration is considered +* unsupportable in general. E.g. movable only node which cannot satisfy +* any non movable allocations (see update_nodemask). Page allocator +* needs to make additional checks for those configurations and this +* check is meant to guard those checks without any overhead for sane +* configurations. +*/ +static inline bool cpusets_insane_config (void ) +{ +return static_branch_unlikely (&cpusets_insane_config_key); +} +extern int cpuset_init (void );extern void cpuset_init_smp (void );extern void cpuset_force_rebuild (void );
@@ -169,6 +184,8 @@ static inline void set_mems_allowed(nodemask_t nodemask)static inline bool cpusets_enabled (void ) {return false; } +static inline bool cpusets_insane_config (void ) {return false; } +static inline int cpuset_init (void ) {return 0 ; }static inline void cpuset_init_smp (void ) {}
include/linux/mmzone.h +22 -0
@@ -1229,6 +1229,28 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,#define for_each_zone_zonelist (zone, z, zlist, highidx) \ for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, NULL) +/* Whether the 'nodes' are all movable nodes */ +static inline bool movable_only_nodes (nodemask_t *nodes) +{ +struct zonelist *zonelist; +struct zoneref *z; +int nid; + +if (nodes_empty (*nodes)) +return false; + +/* +* We can chose arbitrary node from the nodemask to get a +* zonelist as they are interlinked. We just need to find +* at least one zone that can satisfy kernel allocations. +*/ + nid =first_node (*nodes); + zonelist = &NODE_DATA (nid)->node_zonelists[ZONELIST_FALLBACK ]; + z =first_zones_zonelist (zonelist,ZONE_NORMAL , nodes); +return (!z->zone) ? true : false; +} + +#ifdef CONFIG_SPARSEMEM #include <asm/sparsemem.h> #endif
kernel/cgroup/cpuset.c +23 -0
@@ -71,6 +71,13 @@DEFINE_STATIC_KEY_FALSE (cpusets_pre_enable_key);DEFINE_STATIC_KEY_FALSE (cpusets_enabled_key); +/* +* There could be abnormal cpuset configurations for cpu or memory +* node binding, add this key to provide a quick low-cost judgement +* of the situation. +*/ +DEFINE_STATIC_KEY_FALSE (cpusets_insane_config_key); +/* See "Frequency meter" comments, below. */ struct fmeter {
@@ -397,6 +404,17 @@ static DECLARE_WORK(cpuset_hotplug_work, cpuset_hotplug_workfn);static DECLARE_WAIT_QUEUE_HEAD (cpuset_attach_wq); +static inline void check_insane_mems_config (nodemask_t *nodes) +{ +if (!cpusets_insane_config () && +movable_only_nodes (nodes)) { +static_branch_enable (&cpusets_insane_config_key); +pr_info ("Unsupported (movable nodes only) cpuset configuration detected (nmask=%*pbl)!\n" +"Cpuset allocations might fail even with a lot of memory available.\n" , +nodemask_pr_args (nodes)); + } +} +/* * Cgroup v2 behavior is used on the "cpus" and "mems" control files when * on default hierarchy or when the cpuset_v2_mode flag is set by mounting
@@ -1915,6 +1933,8 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,if (retval <0 ) goto done; +check_insane_mems_config (&trialcs->mems_allowed); +spin_lock_irq (&callback_lock); cs->mems_allowed = trialcs->mems_allowed;spin_unlock_irq (&callback_lock);
@@ -3262,6 +3282,9 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp) cpus_updated = !cpumask_equal (&new_cpus, cs->effective_cpus); mems_updated = !nodes_equal (new_mems, cs->effective_mems); +if (mems_updated) +check_insane_mems_config (&new_mems); +if (is_in_v2_mode ())hotplug_update_tasks (cs, &new_cpus, &new_mems, cpus_updated, mems_updated);
mm/page_alloc.c +13 -0
@@ -4990,6 +4990,19 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,if (!ac->preferred_zoneref->zone) goto nopage; +/* +* Check for insane configurations where the cpuset doesn't contain +* any suitable zone to satisfy the request - e.g. non-movable +* GFP_HIGHUSER allocations from MOVABLE nodes only. +*/ +if (cpusets_insane_config () && (gfp_mask & __GFP_HARDWALL)) { +struct zoneref *z =first_zones_zonelist (ac->zonelist, + ac->highest_zoneidx, + &cpuset_current_mems_allowed); +if (!z->zone) + goto nopage; + } +if (alloc_flags &ALLOC_KSWAPD )wake_all_kswapds (order, gfp_mask, ac);
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 621/644 cgroup/cpuset: Use static_branch_enable_cpuslocked() on cpusets_insane_config_key
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 65f97cc81b0adc5f49cf6cff5d874be0058e3f41 ]
The following lockdep splat was observed.
[ 812.359086] ============================================
[ 812.359089] WARNING: possible recursive locking detected
[ 812.359097] --------------------------------------------
[ 812.359100] runtest.sh/30042 is trying to acquire lock:
[ 812.359105] ffffffffa7f27420 (cpu_hotplug_lock){++++}-{0:0}, at: static_key_enable+0xe/0x20
[ 812.359131]
[ 812.359131] but task is already holding lock:
[ 812.359134] ffffffffa7f27420 (cpu_hotplug_lock){++++}-{0:0}, at: cpuset_write_resmask+0x98/0xa70
:
[ 812.359267] Call Trace:
[ 812.359272] <TASK>
[ 812.359367] cpus_read_lock+0x3c/0xe0
[ 812.359382] static_key_enable+0xe/0x20
[ 812.359389] check_insane_mems_config.part.0+0x11/0x30
[ 812.359398] cpuset_write_resmask+0x9f2/0xa70
[ 812.359411] cgroup_file_write+0x1c7/0x660
[ 812.359467] kernfs_fop_write_iter+0x358/0x530
[ 812.359479] vfs_write+0xabe/0x1250
[ 812.359529] ksys_write+0xf9/0x1d0
[ 812.359558] do_syscall_64+0x5f/0xe0Since commit d74b27d63a8b ("cgroup/cpuset: Change cpuset_rwsem and hotplug lock order"), the ordering of cpu hotplug lock and cpuset_mutex had been reversed. That patch correctly used the cpuslocked version of the static branch API to enable cpusets_pre_enable_key and cpusets_enabled_key, but it didn't do the same for cpusets_insane_config_key.
The cpusets_insane_config_key can be enabled in the check_insane_mems_config() which is called from update_nodemask() or cpuset_hotplug_update_tasks() with both cpu hotplug lock and cpuset_mutex held. Deadlock can happen with a pending hotplug event that tries to acquire the cpu hotplug write lock which will block further cpus_read_lock() attempt from check_insane_mems_config(). Fix that by switching to use static_branch_enable_cpuslocked().
--- kernel/cgroup/cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup/cpuset.c +1 -1
@@ -408,7 +408,7 @@ static inline void check_insane_mems_config(nodemask_t *nodes) {if (!cpusets_insane_config () &&movable_only_nodes (nodes)) { -static_branch_enable (&cpusets_insane_config_key); +static_branch_enable_cpuslocked (&cpusets_insane_config_key);pr_info ("Unsupported (movable nodes only) cpuset configuration detected (nmask=%*pbl)!\n" "Cpuset allocations might fail even with a lot of memory available.\n" ,nodemask_pr_args (nodes));
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 622/644 RDMA/bnxt_re: Fix to initialize the PBL array
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anantha Prabhu <[email protected]>
[ Upstream commit 806b9f494f62791ee6d68f515a8056c615a0e7b2 ]
memset the PBL page pointer and page map arrays before populating the SGL addresses of the HWQ.
--- drivers/infiniband/hw/bnxt_re/qplib_res.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/bnxt_re/qplib_res.c +2 -0
@@ -121,6 +121,7 @@ static int __alloc_pbl(struct bnxt_qplib_res *res, pbl->pg_arr =vmalloc (pages *sizeof (void *));if (!pbl->pg_arr)return -ENOMEM ; +memset (pbl->pg_arr,0 , pages *sizeof (void *)); pbl->pg_map_arr =vmalloc (pages *sizeof (dma_addr_t));if (!pbl->pg_map_arr) {
@@ -128,6 +129,7 @@ static int __alloc_pbl(struct bnxt_qplib_res *res, pbl->pg_arr =NULL ;return -ENOMEM ; } +memset (pbl->pg_map_arr,0 , pages *sizeof (dma_addr_t)); pbl->pg_count =0 ; pbl->pg_size = sginfo->pgsize;
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 623/644 net: bridge: fix soft lockup in br_multicast_query_expired()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Liang <[email protected]>
[ Upstream commit d1547bf460baec718b3398365f8de33d25c5f36f ]
When set multicast_query_interval to a large value, the local variable 'time' in br_multicast_send_query() may overflow. If the time is smaller than jiffies, the timer will expire immediately, and then call mod_timer() again, which creates a loop and may trigger the following soft lockup issue.
watchdog: BUG: soft lockup - CPU#1 stuck for 221s! [rb_consumer:66] CPU: 1 UID: 0 PID: 66 Comm: rb_consumer Not tainted 6.16.0+ #259 PREEMPT(none) Call Trace: <IRQ> __netdev_alloc_skb+0x2e/0x3a0 br_ip6_multicast_alloc_query+0x212/0x1b70 __br_multicast_send_query+0x376/0xac0 br_multicast_send_query+0x299/0x510 br_multicast_query_expired.constprop.0+0x16d/0x1b0 call_timer_fn+0x3b/0x2a0 __run_timers+0x619/0x950 run_timer_softirq+0x11c/0x220 handle_softirqs+0x18e/0x560 __irq_exit_rcu+0x158/0x1a0 sysvec_apic_timer_interrupt+0x76/0x90 </IRQ>
This issue can be reproduced with:
ip link add br0 type bridge
echo 1 > /sys/class/net/br0/bridge/multicast_querier echo 0xffffffffffffffff >
/sys/class/net/br0/bridge/multicast_query_interval
ip link set dev br0 up
The multicast_startup_query_interval can also cause this issue. Similar to the commit 99b40610956a ("net: bridge: mcast: add and enforce query interval minimum"), add check for the query interval maximum to fix this issue.
--- net/bridge/br_multicast.c | 16 ++++++++++++++++ net/bridge/br_private.h | 2 ++ 2 files changed, 18 insertions(+)
net/bridge/br_multicast.c +16 -0
@@ -4608,6 +4608,14 @@ void br_multicast_set_query_intvl(struct net_bridge_mcast *brmctx, intvl_jiffies =BR_MULTICAST_QUERY_INTVL_MIN ; } +if (intvl_jiffies >BR_MULTICAST_QUERY_INTVL_MAX ) { +br_info (brmctx->br, +"trying to set multicast query interval above maximum, setting to %lu (%ums)\n" , +jiffies_to_clock_t (BR_MULTICAST_QUERY_INTVL_MAX ), +jiffies_to_msecs (BR_MULTICAST_QUERY_INTVL_MAX )); + intvl_jiffies =BR_MULTICAST_QUERY_INTVL_MAX ; + } + brmctx->multicast_query_interval = intvl_jiffies; }
@@ -4624,6 +4632,14 @@ void br_multicast_set_startup_query_intvl(struct net_bridge_mcast *brmctx, intvl_jiffies =BR_MULTICAST_STARTUP_QUERY_INTVL_MIN ; } +if (intvl_jiffies >BR_MULTICAST_STARTUP_QUERY_INTVL_MAX ) { +br_info (brmctx->br, +"trying to set multicast startup query interval above maximum, setting to %lu (%ums)\n" , +jiffies_to_clock_t (BR_MULTICAST_STARTUP_QUERY_INTVL_MAX ), +jiffies_to_msecs (BR_MULTICAST_STARTUP_QUERY_INTVL_MAX )); + intvl_jiffies =BR_MULTICAST_STARTUP_QUERY_INTVL_MAX ; + } + brmctx->multicast_startup_query_interval = intvl_jiffies; }
net/bridge/br_private.h +2 -0
@@ -30,6 +30,8 @@#define BR_MULTICAST_DEFAULT_HASH_MAX 4096#define BR_MULTICAST_QUERY_INTVL_MIN msecs_to_jiffies(1000)#define BR_MULTICAST_STARTUP_QUERY_INTVL_MIN BR_MULTICAST_QUERY_INTVL_MIN +#define BR_MULTICAST_QUERY_INTVL_MAX msecs_to_jiffies(86400000)/* 24 hours */ +#define BR_MULTICAST_STARTUP_QUERY_INTVL_MAX BR_MULTICAST_QUERY_INTVL_MAX#define BR_HWDOM_MAX BITS_PER_LONG
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 624/644 scsi: qla4xxx: Prevent a potential error pointer dereference
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 9dcf111dd3e7ed5fce82bb108e3a3fc001c07225 ]
The qla4xxx_get_ep_fwdb() function is supposed to return NULL on error, but qla4xxx_ep_connect() returns error pointers. Propagating the error pointers will lead to an Oops in the caller, so change the error pointers to NULL.
--- drivers/scsi/qla4xxx/ql4_os.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/qla4xxx/ql4_os.c +2 -0
@@ -6607,6 +6607,8 @@ static struct iscsi_endpoint *qla4xxx_get_ep_fwdb(struct scsi_qla_host *ha, ep =qla4xxx_ep_connect (ha->host, (struct sockaddr *)dst_addr,0 );vfree (dst_addr); +if (IS_ERR (ep)) +return NULL ;return ep; }
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 625/644 iommu/amd: Avoid stack buffer overflow from kernel cmdline
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 8503d0fcb1086a7cfe26df67ca4bd9bd9e99bdec ]
While the kernel command line is considered trusted in most environments, avoid writing 1 byte past the end of "acpiid" if the "str" argument is maximum length.
--- drivers/iommu/amd/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/amd/init.c +2 -2
@@ -3286,7 +3286,7 @@ static int __init parse_ivrs_acpihid(char *str) {u32 seg =0 , bus, dev, fn;char *hid, *uid, *p, *addr; -char acpiid[ACPIID_LEN ] = {0 }; +char acpiid[ACPIID_LEN +1 ] = { };/* size with NULL terminator */ int i; addr =strchr (str,'@' );
@@ -3312,7 +3312,7 @@ static int __init parse_ivrs_acpihid(char *str)/* We have the '@', make it the terminator to get just the acpiid */ *addr++ =0 ; -if (strlen (str) >ACPIID_LEN +1 ) +if (strlen (str) >ACPIID_LEN ) goto not_found;if (sscanf (str,"=%s" , acpiid) !=1 )
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 626/644 mlxsw: spectrum: Forward packets with an IPv4 link-local source IP
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit f604d3aaf64ff0d90cc875295474d3abf4155629 ]
By default, the device does not forward IPv4 packets with a link-local source IP (i.e., 169.254.0.0/16). This behavior does not align with the kernel which does forward them.
Fix by instructing the device to forward such packets instead of dropping them.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 2 ++ drivers/net/ethernet/mellanox/mlxsw/trap.h | 1 + 2 files changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +2 -0
@@ -2269,6 +2269,8 @@ static const struct mlxsw_listener mlxsw_sp_listener[] = { ROUTER_EXP, false),MLXSW_SP_RXL_NO_MARK (DISCARD_ING_ROUTER_DIP_LINK_LOCAL ,FORWARD ,ROUTER_EXP , false), +MLXSW_SP_RXL_NO_MARK (DISCARD_ING_ROUTER_SIP_LINK_LOCAL ,FORWARD , +ROUTER_EXP , false),/* Multicast Router Traps */ MLXSW_SP_RXL_MARK (ACL1 ,TRAP_TO_CPU ,MULTICAST , false), MLXSW_SP_RXL_L3_MARK(ACL2, TRAP_TO_CPU, MULTICAST, false),
drivers/net/ethernet/mellanox/mlxsw/trap.h +1 -0
@@ -93,6 +93,7 @@ enum {MLXSW_TRAP_ID_DISCARD_ING_ROUTER_IPV4_SIP_BC =0x16A ,MLXSW_TRAP_ID_DISCARD_ING_ROUTER_IPV4_DIP_LOCAL_NET =0x16B ,MLXSW_TRAP_ID_DISCARD_ING_ROUTER_DIP_LINK_LOCAL =0x16C , +MLXSW_TRAP_ID_DISCARD_ING_ROUTER_SIP_LINK_LOCAL =0x16D ,MLXSW_TRAP_ID_DISCARD_ROUTER_IRIF_EN =0x178 ,MLXSW_TRAP_ID_DISCARD_ROUTER_ERIF_EN =0x179 , MLXSW_TRAP_ID_DISCARD_ROUTER_LPM4 = 0x17B,
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 627/644 drm/hisilicon/hibmc: fix the hibmc loaded failed bug
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baihan Li <[email protected]>
[ Upstream commit 93a08f856fcc5aaeeecad01f71bef3088588216a ]
When hibmc loaded failed, the driver use hibmc_unload to free the resource, but the mutexes in mode.config are not init, which will access an NULL pointer. Just change goto statement to return, because hibnc_hw_init() doesn't need to free anything.
--- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +2 -2
@@ -268,12 +268,12 @@ static int hibmc_load(struct drm_device *dev) ret =hibmc_hw_init (priv);if (ret) - goto err; +return ret; ret =drmm_vram_helper_init (dev,pci_resource_start (pdev,0 ), priv->fb_size);if (ret) {drm_err (dev,"Error initializing VRAM MM; %d\n" , ret); - goto err; +return ret; } ret =hibmc_kms_init (priv);
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 628/644 ALSA: usb-audio: Fix size validation in convert_chmap_v3()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 89f0addeee3cb2dc49837599330ed9c4612f05b0 ]
The "p" pointer is void so sizeof(*p) is 1. The intent was to check sizeof(*cs_desc), which is 3, instead.
--- sound/usb/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/stream.c +1 -1
@@ -349,7 +349,7 @@ snd_pcm_chmap_elem *convert_chmap_v3(struct uac3_cluster_header_descriptoru16 cs_len;u8 cs_type; -if (len <sizeof (*p)) +if (len <sizeof (*cs_desc))break ; cs_len =le16_to_cpu (cs_desc->wLength);if (len < cs_len)
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 629/644 drm/amd/display: Add null pointer check in mod_hdcp_hdcp1_create_session()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
[ Upstream commit 7a2ca2ea64b1b63c8baa94a8f5deb70b2248d119 ]
The function mod_hdcp_hdcp1_create_session() calls the function get_first_active_display(), but does not check its return value. The return value is a null pointer if the display list is empty. This will lead to a null pointer dereference.
Add a null pointer check for get_first_active_display() and return MOD_HDCP_STATUS_DISPLAY_NOT_FOUND if the function return null.
This is similar to the commit c3e9826a2202
("drm/amd/display: Add null pointer check for get_first_active_display()").
--- drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c +3 -0
@@ -256,6 +256,9 @@ enum mod_hdcp_status mod_hdcp_hdcp1_create_session(struct mod_hdcp *hdcp)return MOD_HDCP_STATUS_FAILURE ; } +if (!display) +return MOD_HDCP_STATUS_DISPLAY_NOT_FOUND ; + hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;mutex_lock (&psp->hdcp_context.mutex);
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 630/644 ipv6: sr: validate HMAC algorithm ID in seg6_hmac_info_add
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minhong He <[email protected]>
[ Upstream commit 84967deee9d9870b15bc4c3acb50f1d401807902 ]
The seg6_genl_sethmac() directly uses the algorithm ID provided by the userspace without verifying whether it is an HMAC algorithm supported by the system.
If an unsupported HMAC algorithm ID is configured, packets using SRv6 HMAC will be dropped during encapsulation or decapsulation.
--- net/ipv6/seg6_hmac.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv6/seg6_hmac.c +3 -0
@@ -294,6 +294,9 @@ int seg6_hmac_info_add(struct net *net, u32 key, struct seg6_hmac_info *hinfo)struct seg6_pernet_data *sdata =seg6_pernet (net);int err; +if (!__hmac_get_algo (hinfo->alg_id)) +return -EINVAL ; + err =rhashtable_lookup_insert_fast (&sdata->hmac_infos, &hinfo->node, rht_params);
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 631/644 ppp: fix race conditions in ppp_fill_forward_path
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qingfang Deng <[email protected]>
[ Upstream commit 0417adf367a0af11adf7ace849af4638cfb573f7 ]
ppp_fill_forward_path() has two race conditions:
1. The ppp->channels list can change between list_empty() and list_first_entry(), as ppp_lock() is not held. If the only channel is deleted in ppp_disconnect_channel(), list_first_entry() may access an empty head or a freed entry, and trigger a panic.
2. pch->chan can be NULL. When ppp_unregister_channel() is called, pch->chan is set to NULL before pch is removed from ppp->channels.
Fix these by using a lockless RCU approach:
- Use list_first_or_null_rcu() to safely test and access the first list entry.
- Convert list modifications on ppp->channels to their RCU variants and add synchronize_net() after removal.
- Check for a NULL pch->chan before dereferencing it.
--- drivers/net/ppp/ppp_generic.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/ppp/ppp_generic.c +11 -6
@@ -33,6 +33,7 @@#include <linux/ppp_channel.h> #include <linux/ppp-comp.h> #include <linux/skbuff.h> +#include <linux/rculist.h> #include <linux/rtnetlink.h> #include <linux/if_arp.h> #include <linux/ip.h>
@@ -1612,11 +1613,14 @@ static int ppp_fill_forward_path(struct net_device_path_ctx *ctx,if (ppp->flags &SC_MULTILINK )return -EOPNOTSUPP ; -if (list_empty (&ppp->channels)) + pch = list_first_or_null_rcu(&ppp->channels, struct channel, clist); +if (!pch) +return -ENODEV ; + + chan =READ_ONCE (pch->chan); +if (!chan)return -ENODEV ; - pch = list_first_entry(&ppp->channels, struct channel, clist); - chan = pch->chan;if (!chan->ops->fill_forward_path)return -EOPNOTSUPP ;
@@ -2999,7 +3003,7 @@ ppp_unregister_channel(struct ppp_channel *chan)*/ down_write (&pch->chan_sem);spin_lock_bh (&pch->downl); - pch->chan =NULL ; +WRITE_ONCE (pch->chan,NULL );spin_unlock_bh (&pch->downl);up_write (&pch->chan_sem);ppp_disconnect_channel (pch);
@@ -3505,7 +3509,7 @@ ppp_connect_channel(struct channel *pch, int unit) hdrlen = pch->file.hdrlen +2 ;/* for protocol bytes */ if (hdrlen > ppp->dev->hard_header_len) ppp->dev->hard_header_len = hdrlen; -list_add_tail (&pch->clist, &ppp->channels); +list_add_tail_rcu (&pch->clist, &ppp->channels); ++ppp->n_channels; pch->ppp = ppp;refcount_inc (&ppp->file.refcnt);
@@ -3535,10 +3539,11 @@ ppp_disconnect_channel(struct channel *pch)if (ppp) {/* remove it from the ppp unit's list */ ppp_lock (ppp); -list_del (&pch->clist); +list_del_rcu (&pch->clist);if (--ppp->n_channels ==0 )wake_up_interruptible (&ppp->file.rwait);ppp_unlock (ppp); +synchronize_net ();if (refcount_dec_and_test (&ppp->file.refcnt))ppp_destroy_interface (ppp); err =0 ;
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 632/644 net: phy: Use netif_rx().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit a3d73e15909bdcf25f341e6623cc165ba7eb5968 ]
Since commit
baebdf48c3600 ("net: dev: Makes sure netif_rx() can be invoked in any context.")
the function netif_rx() can be used in preemptible/thread context as well as in interrupt context.
Use netif_rx().
Stable-dep-of: bc1a59cff9f7 ("phy: mscc: Fix timestamping for vsc8584")
--- drivers/net/phy/dp83640.c | 6 +++--- drivers/net/phy/mscc/mscc_ptp.c | 2 +- drivers/net/phy/nxp-c45-tja11xx.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/phy/dp83640.c +3 -3
@@ -886,7 +886,7 @@ static void decode_rxts(struct dp83640_private *dp83640,spin_unlock_irqrestore (&dp83640->rx_lock, flags);if (shhwtstamps) -netif_rx_ni (skb); +netif_rx (skb); } static void decode_txts(struct dp83640_private *dp83640,
@@ -1332,7 +1332,7 @@ static void rx_timestamp_work(struct work_struct *work)break ; } -netif_rx_ni (skb); +netif_rx (skb); }if (!skb_queue_empty (&dp83640->rx_queue))
@@ -1383,7 +1383,7 @@ static bool dp83640_rxtstamp(struct mii_timestamper *mii_ts,skb_queue_tail (&dp83640->rx_queue, skb);schedule_delayed_work (&dp83640->ts_work,SKB_TIMESTAMP_TIMEOUT ); }else { -netif_rx_ni (skb); +netif_rx (skb); }return true;
drivers/net/phy/mscc/mscc_ptp.c +1 -1
@@ -1218,7 +1218,7 @@ static bool vsc85xx_rxtstamp(struct mii_timestamper *mii_ts, ts.tv_sec--; shhwtstamps->hwtstamp =ktime_set (ts.tv_sec, ns); -netif_rx_ni (skb); +netif_rx (skb);return true; }
drivers/net/phy/nxp-c45-tja11xx.c +1 -1
@@ -436,7 +436,7 @@ static long nxp_c45_do_aux_work(struct ptp_clock_info *ptp) shhwtstamps_rx =skb_hwtstamps (skb); shhwtstamps_rx->hwtstamp =ns_to_ktime (timespec64_to_ns (&ts));NXP_C45_SKB_CB (skb)->header->reserved2 =0 ; -netif_rx_ni (skb); +netif_rx (skb); }return reschedule ?1 :-1 ;
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 633/644 phy: mscc: Fix timestamping for vsc8584
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit bc1a59cff9f797bfbf8f3104507584d89e9ecf2e ]
There was a problem when we received frames and the frames were timestamped. The driver is configured to store the nanosecond part of the timestmap in the ptp reserved bits and it would take the second part by reading the LTC. The problem is that when reading the LTC we are in atomic context and to read the second part will go over mdio bus which might sleep, so we get an error.
The fix consists in actually put all the frames in a queue and start the aux work and in that work to read the LTC and then calculate the full received time.
--- drivers/net/phy/mscc/mscc.h | 12 ++++++++ drivers/net/phy/mscc/mscc_main.c | 12 ++++++++ drivers/net/phy/mscc/mscc_ptp.c | 49 ++++++++++++++++++++++++-------- 3 files changed, 61 insertions(+), 12 deletions(-)
drivers/net/phy/mscc/mscc.h +12 -0
@@ -360,6 +360,13 @@ struct vsc85xx_hw_stat {u16 mask; }; +struct vsc8531_skb_cb { +u32 ns; +}; + +#define VSC8531_SKB_CB (skb) \ + ((struct vsc8531_skb_cb *)((skb)->cb)) +struct vsc8531_private {int rate_magic;u16 supp_led_modes;
@@ -408,6 +415,11 @@ struct vsc8531_private {*/ struct mutex ts_lock;struct mutex phc_lock; + +/* list of skbs that were received and need timestamp information but it +* didn't received it yet +*/ +struct sk_buff_head rx_skbs_list; };/* Shared structure between the PHYs of the same package.
drivers/net/phy/mscc/mscc_main.c +12 -0
@@ -2324,6 +2324,13 @@ static int vsc85xx_probe(struct phy_device *phydev)return vsc85xx_dt_led_modes_get (phydev, default_mode); } +static void vsc85xx_remove (struct phy_device *phydev) +{ +struct vsc8531_private *priv = phydev->priv; + +skb_queue_purge (&priv->rx_skbs_list); +} +/* Microsemi VSC85xx PHYs */ static struct phy_driver vsc85xx_driver[] = { {
@@ -2554,6 +2561,7 @@ static struct phy_driver vsc85xx_driver[] = { .config_intr = &vsc85xx_config_intr, .suspend = &genphy_suspend, .resume = &genphy_resume, + .remove = &vsc85xx_remove, .probe = &vsc8574_probe, .set_wol = &vsc85xx_wol_set, .get_wol = &vsc85xx_wol_get,
@@ -2579,6 +2587,7 @@ static struct phy_driver vsc85xx_driver[] = { .config_intr = &vsc85xx_config_intr, .suspend = &genphy_suspend, .resume = &genphy_resume, + .remove = &vsc85xx_remove, .probe = &vsc8574_probe, .set_wol = &vsc85xx_wol_set, .get_wol = &vsc85xx_wol_get,
@@ -2604,6 +2613,7 @@ static struct phy_driver vsc85xx_driver[] = { .config_intr = &vsc85xx_config_intr, .suspend = &genphy_suspend, .resume = &genphy_resume, + .remove = &vsc85xx_remove, .probe = &vsc8584_probe, .get_tunable = &vsc85xx_get_tunable, .set_tunable = &vsc85xx_set_tunable,
@@ -2627,6 +2637,7 @@ static struct phy_driver vsc85xx_driver[] = { .config_intr = &vsc85xx_config_intr, .suspend = &genphy_suspend, .resume = &genphy_resume, + .remove = &vsc85xx_remove, .probe = &vsc8584_probe, .get_tunable = &vsc85xx_get_tunable, .set_tunable = &vsc85xx_set_tunable,
@@ -2650,6 +2661,7 @@ static struct phy_driver vsc85xx_driver[] = { .config_intr = &vsc85xx_config_intr, .suspend = &genphy_suspend, .resume = &genphy_resume, + .remove = &vsc85xx_remove, .probe = &vsc8584_probe, .get_tunable = &vsc85xx_get_tunable, .set_tunable = &vsc85xx_set_tunable,
drivers/net/phy/mscc/mscc_ptp.c +37 -12
85 lines not on this page · raw message
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 634/644 net: usb: asix_devices: Fix PHY address mask in MDIO bus initialization
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuichiro Tsuji <[email protected]>
[ Upstream commit 24ef2f53c07f273bad99173e27ee88d44d135b1c ]
Syzbot reported shift-out-of-bounds exception on MDIO bus initialization.
The PHY address should be masked to 5 bits (0-31). Without this mask, invalid PHY addresses could be used, potentially causing issues with MDIO bus operations.
Fix this by masking the PHY address with 0x1f (31 decimal) to ensure it stays within the valid range.
--- drivers/net/usb/asix_devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/asix_devices.c +1 -1
@@ -669,7 +669,7 @@ static int ax88772_init_mdio(struct usbnet *dev) priv->mdio->read = &asix_mdio_bus_read; priv->mdio->write = &asix_mdio_bus_write; priv->mdio->name ="Asix MDIO Bus" ; - priv->mdio->phy_mask = ~(BIT (priv->phy_addr) |BIT (AX_EMBD_PHY_ADDR )); + priv->mdio->phy_mask = ~(BIT (priv->phy_addr &0x1f ) |BIT (AX_EMBD_PHY_ADDR ));/* mii bus name is usb-<usb bus number>-<usb device number> */ snprintf (priv->mdio->id,MII_BUS_ID_SIZE ,"usb-%03d:%03d" , dev->udev->bus->busnum, dev->udev->devnum);
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 635/644 ixgbe: xsk: resolve the negative overflow of budget in ixgbe_xmit_zc
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Xing <[email protected]>
[ Upstream commit 4d4d9ef9dfee877d494e5418f68a1016ef08cad6 ]
Resolve the budget negative overflow which leads to returning true in ixgbe_xmit_zc even when the budget of descs are thoroughly consumed.
Before this patch, when the budget is decreased to zero and finishes sending the last allowed desc in ixgbe_xmit_zc, it will always turn back and enter into the while() statement to see if it should keep processing packets, but in the meantime it unexpectedly decreases the value again to 'unsigned int (0--)', namely, UINT_MAX. Finally, the ixgbe_xmit_zc returns true, showing 'we complete cleaning the budget'. That also means 'clean_complete = true' in ixgbe_poll.
The true theory behind this is if that budget number of descs are consumed, it implies that we might have more descs to be done. So we should return false in ixgbe_xmit_zc to tell napi poll to find another chance to start polling to handle the rest of descs. On the contrary, returning true here means job done and we know we finish all the possible descs this time and we don't intend to start a new napi poll.
It is apparently against our expectations. Please also see how ixgbe_clean_tx_irq() handles the problem: it uses do..while() statement to make sure the budget can be decreased to zero at most and the negative overflow never happens.
The patch adds 'likely' because we rarely would not hit the loop condition since the standard budget is 256.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +3 -1
@@ -392,7 +392,7 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget)dma_addr_t dma;u32 cmd_type; -while (budget-- >0 ) { +while (likely (budget)) {if (unlikely (!ixgbe_desc_unused (xdp_ring))) { work_done = false;break ;
@@ -427,6 +427,8 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget) xdp_ring->next_to_use++;if (xdp_ring->next_to_use == xdp_ring->count) xdp_ring->next_to_use =0 ; + + budget--; }if (tx_desc) {
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 636/644 igc: fix disabling L1.2 PCI-E link substate on I226 on init
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: ValdikSS <[email protected]>
[ Upstream commit 1468c1f97cf32418e34dbb40b784ed9333b9e123 ]
Device ID comparison in igc_is_device_id_i226 is performed before the ID is set, resulting in always failing check on init.
Before the patch:
* L1.2 is not disabled on init
* L1.2 is properly disabled after suspend-resume cycle
With the patch:
* L1.2 is properly disabled both on init and after suspend-resume
How to test:
Connect to the 1G link with 300+ mbit/s Internet speed, and run the download speed test, such as:
curl -o /dev/null http://speedtest.selectel.ru/1GB
Without L1.2 disabled, the speed would be no more than ~200 mbit/s. With L1.2 disabled, the speed would reach 1 gbit/s.
Note: it's required that the latency between your host and the remote be around 3-5 ms, the test inside LAN (<1 ms latency) won't trigger the issue.
--- drivers/net/ethernet/intel/igc/igc_main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +7 -7
@@ -6549,6 +6549,13 @@ static int igc_probe(struct pci_dev *pdev, adapter->port_num = hw->bus.func; adapter->msg_enable =netif_msg_init (debug,DEFAULT_MSG_ENABLE ); +/* PCI config space info */ + hw->vendor_id = pdev->vendor; + hw->device_id = pdev->device; + hw->revision_id = pdev->revision; + hw->subsystem_vendor_id = pdev->subsystem_vendor; + hw->subsystem_device_id = pdev->subsystem_device; +/* Disable ASPM L1.2 on I226 devices to avoid packet loss */ if (igc_is_device_id_i226 (hw))pci_disable_link_state (pdev,PCIE_LINK_STATE_L1_2 );
@@ -6573,13 +6580,6 @@ static int igc_probe(struct pci_dev *pdev, netdev->mem_start =pci_resource_start (pdev,0 ); netdev->mem_end =pci_resource_end (pdev,0 ); -/* PCI config space info */ - hw->vendor_id = pdev->vendor; - hw->device_id = pdev->device; - hw->revision_id = pdev->revision; - hw->subsystem_vendor_id = pdev->subsystem_vendor; - hw->subsystem_device_id = pdev->subsystem_device; -/* Copy the default MAC and PHY function pointers */ memcpy (&hw->mac.ops, ei->mac_ops,sizeof (hw->mac.ops));memcpy (&hw->phy.ops, ei->phy_ops,sizeof (hw->phy.ops));
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 637/644 net/sched: Make cake_enqueue return NET_XMIT_CN when past buffer_limit
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Liu <[email protected]>
[ Upstream commit 15de71d06a400f7fdc15bf377a2552b0ec437cf5 ]
The following setup can trigger a WARNING in htb_activate due to the condition: !cl->leaf.q->q.qlen
tc qdisc del dev lo root
tc qdisc add dev lo root handle 1: htb default 1
tc class add dev lo parent 1: classid 1:1 \
htb rate 64bit
tc qdisc add dev lo parent 1:1 handle f: \
cake memlimit 1b
ping -I lo -f -c1 -s64 -W0.001 127.0.0.1
This is because the low memlimit leads to a low buffer_limit, which causes packet dropping. However, cake_enqueue still returns NET_XMIT_SUCCESS, causing htb_enqueue to call htb_activate with an empty child qdisc. We should return NET_XMIT_CN when packets are dropped from the same tin and flow.
I do not believe return value of NET_XMIT_CN is necessary for packet drops in the case of ack filtering, as that is meant to optimize performance, not to signal congestion.
--- net/sched/sch_cake.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/sched/sch_cake.c +12 -2
@@ -1761,7 +1761,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,ktime_t now =ktime_get ();struct cake_tin_data *b;struct cake_flow *flow; -u32 idx; +u32 idx, tin;/* choose flow to insert into */ idx =cake_classify (sch, &b, skb, q->flow_mode, &ret);
@@ -1771,6 +1771,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,__qdisc_drop (skb, to_free);return ret; } + tin = (u32)(b - q->tins); idx--; flow = &b->flows[idx];
@@ -1938,13 +1939,22 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, q->buffer_max_used = q->buffer_used;if (q->buffer_used > q->buffer_limit) { +bool same_flow = false;u32 dropped =0 ; +u32 drop_id;while (q->buffer_used > q->buffer_limit) { dropped++; -cake_drop (sch, to_free); + drop_id =cake_drop (sch, to_free); + +if ((drop_id >>16 ) == tin && + (drop_id &0xFFFF ) == idx) + same_flow = true; } b->drop_overlimit += dropped; + +if (same_flow) +return NET_XMIT_CN ; }return NET_XMIT_SUCCESS ; }
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 638/644 net/sched: Remove unnecessary WARNING condition for empty child qdisc in htb_activate
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Liu <[email protected]>
[ Upstream commit 2c2192e5f9c7c2892fe2363244d1387f62710d83 ]
The WARN_ON trigger based on !cl->leaf.q->q.qlen is unnecessary in htb_activate. htb_dequeue_tree already accounts for that scenario.
--- net/sched/sch_htb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_htb.c +1 -1
@@ -589,7 +589,7 @@ htb_change_class_mode(struct htb_sched *q, struct htb_class *cl, s64 *diff)*/ static inline void htb_activate (struct htb_sched *q,struct htb_class *cl) { -WARN_ON (cl->level || !cl->leaf.q || !cl->leaf.q->q.qlen); +WARN_ON (cl->level || !cl->leaf.q);if (!cl->prio_activity) { cl->prio_activity =1 << cl->prio;
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 639/644 bonding: update LACP activity flag after setting lacp_active
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit b64d035f77b1f02ab449393342264b44950a75ae ]
The port's actor_oper_port_state activity flag should be updated immediately after changing the lacp_active option to reflect the current mode correctly.
--- drivers/net/bonding/bond_3ad.c | 25 +++++++++++++++++++++++++ drivers/net/bonding/bond_options.c | 1 + include/net/bond_3ad.h | 1 + 3 files changed, 27 insertions(+)
drivers/net/bonding/bond_3ad.c +25 -0
@@ -2730,6 +2730,31 @@ void bond_3ad_update_lacp_rate(struct bonding *bond)spin_unlock_bh (&bond->mode_lock); } +/** +* bond_3ad_update_lacp_active - change the lacp active +* @bond: bonding struct +* +* Update actor_oper_port_state when lacp_active is modified. +*/ +void bond_3ad_update_lacp_active (struct bonding *bond) +{ +struct port *port =NULL ; +struct list_head *iter; +struct slave *slave; +int lacp_active; + + lacp_active = bond->params.lacp_active; +spin_lock_bh (&bond->mode_lock); +bond_for_each_slave (bond, slave, iter) { + port = &(SLAVE_AD_INFO (slave)->port); +if (lacp_active) + port->actor_oper_port_state |=LACP_STATE_LACP_ACTIVITY ; +else + port->actor_oper_port_state &= ~LACP_STATE_LACP_ACTIVITY ; + } +spin_unlock_bh (&bond->mode_lock); +} +size_t bond_3ad_stats_size (void ) { return nla_total_size_64bit(sizeof(u64)) + /* BOND_3AD_STAT_LACPDU_RX */
drivers/net/bonding/bond_options.c +1 -0
@@ -1390,6 +1390,7 @@ static int bond_option_lacp_active_set(struct bonding *bond,netdev_dbg (bond->dev,"Setting LACP active to %s (%llu)\n" , newval->string, newval->value); bond->params.lacp_active = newval->value; +bond_3ad_update_lacp_active (bond);return 0 ; }
include/net/bond_3ad.h +1 -0
@@ -303,6 +303,7 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,int bond_3ad_set_carrier (struct bonding *bond);void bond_3ad_update_lacp_active (struct bonding *bond);void bond_3ad_update_lacp_rate (struct bonding *bond); +void bond_3ad_update_lacp_active (struct bonding *bond);void bond_3ad_update_ad_actor_settings (struct bonding *bond);int bond_3ad_stats_fill (struct sk_buff *skb,struct bond_3ad_stats *stats);size_t bond_3ad_stats_size (void );
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 640/644 ALSA: usb-audio: Use correct sub-type for UAC3 feature unit validation
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 8410fe81093ff231e964891e215b624dabb734b0 ]
The entry of the validators table for UAC3 feature unit is defined with a wrong sub-type UAC_FEATURE (= 0x06) while it should have been UAC3_FEATURE (= 0x07). This patch corrects the entry value.
--- sound/usb/validate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/validate.c +1 -1
@@ -285,7 +285,7 @@ static const struct usb_desc_validator audio_validators[] = {/* UAC_VERSION_3, UAC3_EXTENDED_TERMINAL: not implemented yet */ FUNC (UAC_VERSION_3 ,UAC3_MIXER_UNIT , validate_mixer_unit),FUNC (UAC_VERSION_3 ,UAC3_SELECTOR_UNIT , validate_selector_unit), -FUNC (UAC_VERSION_3 ,UAC_FEATURE_UNIT , validate_uac3_feature_unit), +FUNC (UAC_VERSION_3 ,UAC3_FEATURE_UNIT , validate_uac3_feature_unit),/* UAC_VERSION_3, UAC3_EFFECT_UNIT: not implemented yet */ FUNC (UAC_VERSION_3 ,UAC3_PROCESSING_UNIT , validate_processing_unit), FUNC(UAC_VERSION_3, UAC3_EXTENSION_UNIT, validate_processing_unit),
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 641/644 s390/hypfs: Avoid unnecessary ioctl registration in debugfs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Oberparleiter <[email protected]>
[ Upstream commit fec7bdfe7f8694a0c39e6c3ec026ff61ca1058b9 ]
Currently, hypfs registers ioctl callbacks for all debugfs files, despite only one file requiring them. This leads to unintended exposure of unused interfaces to user space and can trigger side effects such as restricted access when kernel lockdown is enabled.
Restrict ioctl registration to only those files that implement ioctl functionality to avoid interface clutter and unnecessary access restrictions.
--- arch/s390/hypfs/hypfs_dbfs.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
arch/s390/hypfs/hypfs_dbfs.c +11 -7
@@ -64,24 +64,28 @@ static long dbfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)long rc;mutex_lock (&df->lock); -if (df->unlocked_ioctl) - rc = df->unlocked_ioctl (file, cmd, arg); -else - rc = -ENOTTY ; + rc = df->unlocked_ioctl (file, cmd, arg);mutex_unlock (&df->lock);return rc; } -static const struct file_operations dbfs_ops = { +static const struct file_operations dbfs_ops_ioctl = { .read = dbfs_read, .llseek = no_llseek, .unlocked_ioctl = dbfs_ioctl, }; +static const struct file_operations dbfs_ops = { + .read = dbfs_read, +}; +void hypfs_dbfs_create_file (struct hypfs_dbfs_file *df) { - df->dentry =debugfs_create_file (df->name,0400 , dbfs_dir, df, - &dbfs_ops); +const struct file_operations *fops = &dbfs_ops; + +if (df->unlocked_ioctl) + fops = &dbfs_ops_ioctl; + df->dentry =debugfs_create_file (df->name,0400 , dbfs_dir, df, fops);mutex_init (&df->lock); }
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 642/644 s390/hypfs: Enable limited access during lockdown
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Oberparleiter <[email protected]>
[ Upstream commit 3868f910440c47cd5d158776be4ba4e2186beda7 ]
When kernel lockdown is active, debugfs_locked_down() blocks access to hypfs files that register ioctl callbacks, even if the ioctl interface is not required for a function. This unnecessarily breaks userspace tools that only rely on read operations.
Resolve this by registering a minimal set of file operations during lockdown, avoiding ioctl registration and preserving access for affected tooling.
Note that this change restores hypfs functionality when lockdown is active from early boot (e.g. via lockdown=integrity kernel parameter), but does not apply to scenarios where lockdown is enabled dynamically while Linux is running.
--- arch/s390/hypfs/hypfs_dbfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/s390/hypfs/hypfs_dbfs.c +2 -1
@@ -6,6 +6,7 @@* Author(s): Michael Holzheu <[email protected]> */ +#include <linux/security.h> #include <linux/slab.h> #include "hypfs.h"
@@ -83,7 +84,7 @@ void hypfs_dbfs_create_file(struct hypfs_dbfs_file *df) {const struct file_operations *fops = &dbfs_ops; -if (df->unlocked_ioctl) +if (df->unlocked_ioctl && !security_locked_down (LOCKDOWN_DEBUGFS )) fops = &dbfs_ops_ioctl; df->dentry =debugfs_create_file (df->name,0400 , dbfs_dir, df, fops);mutex_init (&df->lock);
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 643/644 netfilter: nf_reject: dont leak dst refcount for loopback packets
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 91a79b792204313153e1bdbbe5acbfc28903b3a5 ]
recent patches to add a WARN() when replacing skb dst entry found an old bug:
WARNING: include/linux/skbuff.h:1165 skb_dst_check_unset include/linux/skbuff.h:1164 [inline] WARNING: include/linux/skbuff.h:1165 skb_dst_set include/linux/skbuff.h:1210 [inline] WARNING: include/linux/skbuff.h:1165 nf_reject_fill_skb_dst+0x2a4/0x330 net/ipv4/netfilter/nf_reject_ipv4.c:234 [..] Call Trace: nf_send_unreach+0x17b/0x6e0 net/ipv4/netfilter/nf_reject_ipv4.c:325 nft_reject_inet_eval+0x4bc/0x690 net/netfilter/nft_reject_inet.c:27 expr_call_ops_eval net/netfilter/nf_tables_core.c:237 [inline] ..
This is because blamed commit forgot about loopback packets. Such packets already have a dst_entry attached, even at PRE_ROUTING stage.
Instead of checking hook just check if the skb already has a route attached to it.
--- net/ipv4/netfilter/nf_reject_ipv4.c | 6 ++---- net/ipv6/netfilter/nf_reject_ipv6.c | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-)
net/ipv4/netfilter/nf_reject_ipv4.c +2 -4
@@ -247,8 +247,7 @@ void nf_send_reset(struct net *net, struct sock *sk, struct sk_buff *oldskb,if (!oth)return ; -if ((hook ==NF_INET_PRE_ROUTING || hook ==NF_INET_INGRESS ) && -nf_reject_fill_skb_dst (oldskb) <0 ) +if (!skb_dst (oldskb) &&nf_reject_fill_skb_dst (oldskb) <0 )return ;if (skb_rtable (oldskb)->rt_flags & (RTCF_BROADCAST |RTCF_MULTICAST ))
@@ -317,8 +316,7 @@ void nf_send_unreach(struct sk_buff *skb_in, int code, int hook)if (iph->frag_off &htons (IP_OFFSET ))return ; -if ((hook ==NF_INET_PRE_ROUTING || hook ==NF_INET_INGRESS ) && -nf_reject_fill_skb_dst (skb_in) <0 ) +if (!skb_dst (skb_in) &&nf_reject_fill_skb_dst (skb_in) <0 )return ;if (skb_csum_unnecessary (skb_in) || !nf_reject_verify_csum (proto)) {
net/ipv6/netfilter/nf_reject_ipv6.c +2 -3
@@ -295,7 +295,7 @@ void nf_send_reset6(struct net *net, struct sock *sk, struct sk_buff *oldskb, fl6.fl6_sport = otcph->dest; fl6.fl6_dport = otcph->source; -if (hook ==NF_INET_PRE_ROUTING || hook ==NF_INET_INGRESS ) { +if (!skb_dst (oldskb)) {nf_ip6_route (net, &dst,flowi6_to_flowi (&fl6), false);if (!dst)return ;
@@ -394,8 +394,7 @@ void nf_send_unreach6(struct net *net, struct sk_buff *skb_in,if (hooknum ==NF_INET_LOCAL_OUT && skb_in->dev ==NULL ) skb_in->dev = net->loopback_dev; -if ((hooknum ==NF_INET_PRE_ROUTING || hooknum ==NF_INET_INGRESS ) && -nf_reject6_fill_skb_dst (skb_in) <0 ) +if (!skb_dst (skb_in) &&nf_reject6_fill_skb_dst (skb_in) <0 )return ;icmpv6_send (skb_in,ICMPV6_DEST_UNREACH , code,0 );
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 644/644 wifi: mac80211: check basic rates validity in sta_link_apply_parameters
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Lobanov <[email protected]>
commit 16ee3ea8faef8ff042acc15867a6c458c573de61 upstream.
When userspace sets supported rates for a new station via NL80211_CMD_NEW_STATION, it might send a list that's empty or contains only invalid values. Currently, we process these values in sta_link_apply_parameters() without checking the result of ieee80211_parse_bitrates(), which can lead to an empty rates bitmap.
A similar issue was addressed for NL80211_CMD_SET_BSS in commit ce04abc3fcc6 ("wifi: mac80211: check basic rates validity"). This patch applies the same approach in sta_link_apply_parameters() for NL80211_CMD_NEW_STATION, ensuring there is at least one valid rate by inspecting the result of ieee80211_parse_bitrates().
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
[ Summary of conflict resolutions:
- Function ieee80211_parse_bitrates() takes channel width as its first parameter in mainline kernel version. In v5.15 the function takes the whole chandef struct as its first parameter.
- The same function takes link station parameters as its last parameter, and in v5.15 they are in a struct called sta, instead of a struct called link_sta. ]
--- net/mac80211/cfg.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
net/mac80211/cfg.c +7 -6
@@ -1658,12 +1658,13 @@ static int sta_apply_parameters(struct ireturn ret; } -if (params->supported_rates && params->supported_rates_len) { -ieee80211_parse_bitrates (&sdata->vif.bss_conf.chandef, - sband, params->supported_rates, - params->supported_rates_len, - &sta->sta.supp_rates[sband->band]); - } +if (params->supported_rates && + params->supported_rates_len && + !ieee80211_parse_bitrates (&sdata->vif.bss_conf.chandef, + sband, params->supported_rates, + params->supported_rates_len, + &sta->sta.supp_rates[sband->band])) +return -EINVAL ;if (params->ht_capa) ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.190 release. There are 644 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 28 Aug 2025 11:08:21 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.190-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.190 release. There are 644 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 28 Aug 2025 11:08:21 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.190-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.15:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
105 tests: 105 pass, 0 failLinux version: 5.15.190-rc1-ge09f9302f92d
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra186-p3509-0000+p3636-0001, tegra194-p2972-0000,
tegra194-p3509-0000+p3668-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
Upstream commit:9e30ecf23b1b ("net: ipv4: fix incorrect MTU in broadcast routes")
introduces a regression which breaks IPv4 broadcast, which stops WOL working (breaking my CI system), among other things:
https://lore.kernel.org/regressions/[email protected]
Mainline fix pending.
# Librecast Test Results
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 5.15.190-rc1-00645-ge09f9302f92d #48 SMP Tue Aug 26 11:48:25 -00 2025 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.190 release. There are 644 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 28 Aug 2025 11:08:21 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.190-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro's test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.15.190-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: e09f9302f92d6e366e40ce66054adc57d2bada85
* git describe: v5.15.189-645-ge09f9302f92d
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.15.y/build/v5.15.189-645-ge09f9302f92d
## Test Regressions (compared to v5.15.187-81-gd21affcc10e6)
## Metric Regressions (compared to v5.15.187-81-gd21affcc10e6)
## Test Fixes (compared to v5.15.187-81-gd21affcc10e6)
## Metric Fixes (compared to v5.15.187-81-gd21affcc10e6)
## Test result summary
total: 52799, pass: 43384, fail: 2145, skip: 6975, xfail: 295
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 101 total, 101 passed, 0 failed
* arm64: 28 total, 28 passed, 0 failed
* i386: 18 total, 18 passed, 0 failed
* mips: 22 total, 22 passed, 0 failed
* parisc: 3 total, 3 passed, 0 failed
* powerpc: 22 total, 22 passed, 0 failed
* riscv: 8 total, 8 passed, 0 failed
* s390: 9 total, 9 passed, 0 failed
* sh: 10 total, 10 passed, 0 failed
* sparc: 6 total, 6 passed, 0 failed
* x86_64: 24 total, 24 passed, 0 failed
## Test suites summary
* boot
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-exec
* kselftest-fpu
* kselftest-futex
* kselftest-intel_pstate
* kselftest-kcmp
* kselftest-livepatch
* kselftest-membarrier
* kselftest-mincore
* kselftest-mm
* kselftest-mqueue
* kselftest-net
* kselftest-net-mptcp
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-x86
* kunit
* kvm-unit-tests
* lava
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-build-clang
* log-parser-build-gcc
* log-parser-test
* ltp-capability
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.190 release. There are 644 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 28 Aug 2025 11:08:21 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.190-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.190 release. There are 644 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 28 Aug 2025 11:08:21 +0000. Anything received after that time might be too late.
Quoted 6 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/
patch-5.15.190-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.
No issues were seen on x86_64 and aarch64 platforms with our testing.
Quoted 3 lines
thanks,
greg k-h