summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)Author
6 daysUSB: serial: metro-usb: drop redundant initialisationsJohan Hovold
Three functions are initialising their return value variables at declaration only to later assign them unconditionally. Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: metro-usb: fix unthrottle raceJohan Hovold
If the completion handler races with unthrottle() both functions may try to resubmit the same interrupt-in urb, but at most one will succeed. Fix the unthrottle logic using a throttle-requested flag so that only one attempt to resubmit the urb is made to avoid logging an error. Fixes: 43d186fe992d ("USB: serial: add metro-usb driver to the tree") Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: metro-usb: replace unnecessary atomic allocationJohan Hovold
The unthrottle callback is allowed to sleep so pass the correct GFP flag to usb_submit_urb() to avoid unnecessary atomic allocations. Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: fix oob port dev_printk()Johan Hovold
The OOB port is not registered with driver core and does not have a name. Use the USB interface with dev_printk() that may involve the OOB port to avoid log entries with no driver and a "null" device name. Fixes: f9dfbebb8b39 ("USB: serial: digi_acceleport.c: remove dbg() usage") Fixes: 194343d9364e ("USB: remove use of err() in drivers/usb/serial") Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysIB/mlx4: delete allocated id_map_entry while sending REJPraveen Kumar Kannoju
The mlx4 CM paravirtualization layer rewrites a VF's local communication ID to a PF-visible ID when CM MADs are sent from the VF. For messages that start or advance a connection from the VF side, such as REQ, REP, MRA and SIDR_REQ, mlx4_ib_multiplex_cm_handler() allocates an id_map_entry when no existing mapping is found. A REJ is different because it is a terminal response to an already known exchange. It should either find an existing id_map_entry, rewrite the local communication ID, and schedule that entry for deletion, or it should pass through unchanged when no mapping exists. Some REJ messages, such as rejects for an inbound REQ before an MRA or REP was sent, do not have an id_map_entry because their local_comm_id is zero. Timeout REJ messages are handled in the initial lookup branch, but a lookup miss there must not fall through to id_map_alloc(); such a miss means there is no existing mapping to translate or delete for the REJ. Commit 227a0e142e37 ("IB/mlx4: Add support for REJ due to timeout") added the timeout REJ case to the initial branch so an outgoing timeout REJ could reuse the id_map_entry that was created when the VF's REQ was multiplexed. Reusing that entry is the useful part: it rewrites the timeout REJ local_comm_id to the same PF-visible ID that was sent in the REQ. If the lookup misses, allocating a new id_map_entry does not help because the peer has never seen that new PF-visible ID, and REJ is not starting a new exchange. Keep timeout REJ handling in the initial lookup branch, but return before allocation if no mapping is found. Handle the other REJ cases with the same lookup-only behavior. When a mapping is found, translate the local communication ID and schedule delayed deletion, as is already done for DREQ and for received REJ in the demux path. When no mapping is found, keep the existing pass-through behavior. Signed-off-by: Praveen Kumar Kannoju <praveen.kannoju@oracle.com> Link: https://patch.msgid.link/20260615171759.557425-1-praveen.kannoju@oracle.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
6 daysaccel/ivpu: Fix wrong register read in LNL failure diagnosticsKarol Wachowski
diagnose_failure_lnl() read VPU_HW_BTRS_MTL_INTERRUPT_STAT instead of VPU_HW_BTRS_LNL_INTERRUPT_STAT, which on LNL and newer parts is a different register with a different bit layout, so failure diagnostics decoded the wrong register and reported a bogus error cause. Read the LNL interrupt status register instead. Fixes: 8a27ad81f7d3 ("accel/ivpu: Split IP and buttress code") Reviewed-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com> Link: https://patch.msgid.link/20260710101331.1899505-1-karol.wachowski@linux.intel.com
6 daysUSB: serial: digi_acceleport: clean up inb command submissionJohan Hovold
Clean up the inb command handling a bit by removing an unnecessary line break and moving the assignment operator before breaking another long expression. Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: clean up write completionJohan Hovold
Clean up the write completion handler by adding a temporary variable for the transfer buffer and using the pre-existing urb pointer while dropping some redundant casts. Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: clean up xfer buf length expressionJohan Hovold
Add the missing space around operators in transfer-buffer length expressions to make the code more readable. Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: drop unused in-buf defineJohan Hovold
Drop the in-buf size define which has not been used since the port buffers were removed by commit 5fea2a4dabdf ("USB: digi_acceleport further buffer clean up"). Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: stop OOB I/O when not in useJohan Hovold
The driver submits the OOB read urb on first open of a port and does not stop it until the device is disconnected. Add an open counter and submit the urb on first open and stop it on last close to avoid wasting resources (e.g. power) when the device is not in use. Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: drop redundant driver data sanity checksJohan Hovold
The urb context pointer does not change while an urb is in flight so there is never a need to check for NULL on completion. The port driver data is not freed until the port is unbound at which point all I/O for that port has been stopped (and I/O is no longer started for a port that has not yet been probed). The device driver data is not freed until after the driver has been unbound and at which point all I/O has also ceased. Drop the redundant, overly defensive (and still incomplete) sanity checks from the completion callbacks. Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: clean up declarations and whitespaceJohan Hovold
Clean up the driver by moving some declarations to approximate reverse xmas style and removing some stray newlines (and adding a few for readability). While at it, also replace two spaces before tabs in the driver structs. Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: add oob port helperJohan Hovold
Add a helper function for retrieving the OOB port to replace two convoluted expressions. Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: always stop write urb on closeJohan Hovold
Explicitly stop the write urb on close() also if the device is being unbound instead of relying on core to do it after returning. Note that the dp_write_urb_in_use flag is cleared by the completion handler. Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: drop unused wait queueJohan Hovold
Drop the close wait queue which has not been used since commit 335f8514f200 ("tty: Bring the usb tty port structure into more use"). Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: fix port registration orderJohan Hovold
The driver submits the read urbs for all ports when the first port is opened, which could happen before the other ports have been probed and their private data set up. If such an urb completes before the port has been probed, the completion handler will not resubmit it, thus preventing any further reads. Fix the ordering issue by not submitting the port read urbs until the port is opened. This also avoids wasting resources (e.g. power) when ports are not in use. Note that the port write urbs are already stopped on close (unless unbinding, but they are also stopped by core on disconnect). Fixes: fb44ff854e14 ("USB: digi_acceleport: fix port-data memory leak") Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysUSB: serial: digi_acceleport: do not log stopping of urbs as errorsJohan Hovold
Stopping an urb is not an error and should not be logged as such. Demote the dev_err() in the read bulk completion handler to dev_dbg() when an urb is being unlinked on disconnect. Note that this will become more of an issue when the urbs are stopped every time a port is closed. This issue was flagged by Sashiko when reviewing the upcoming change. Link: https://sashiko.dev/#/patchset/20260623150826.314727-1-johan%40kernel.org?part=2 Signed-off-by: Johan Hovold <johan@kernel.org>
6 daysata: pata_mpc52xx: Remove redundant dev_err()Pan Chuang
Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in devm_request_*_irq()"), devm_request_irq() automatically logs detailed error messages on failure. Remove the now-redundant driver-specific dev_err() call. Signed-off-by: Pan Chuang <panchuang@vivo.com> Reviewed-by: Hannes Reinecke <hare@kernel.org> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
6 daysiommu/dma: simplify dma_iova_destroy() and drop the free_iova helperHonglei Huang
dma_iova_destroy() frees the IOVA space through __iommu_dma_iova_unlink() using a "free_iova" boolean, which duplicates the IOVA free logic in dma_iova_free(). And it frees using the unmapped @mapped_len, which for a partially linked reservation is smaller than the reserved size. This results in a benign waste as pointed out by Robin, not a leak. So this is a cleanup, not a fix. Drop the duplicated free path. Fold __iommu_dma_iova_unlink into dma_iova_unlink and remove the free_iova parameter so it only unmaps. dma_iova_destroy then unlinks the mapped range if mapped_len is set and unconditionally calls dma_iova_free, which frees the whole reservation via dma_iova_size. The freed size now always matches the reserved size, and destroy reads as unlink then free. Note that dma_iova_destroy() no longer routes the free through the flush queue; teardown now unmaps synchronously and frees directly, matching dma_iova_free(). No functional change intended for callers. Suggested-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Honglei Huang <honghuan@amd.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Link: https://lore.kernel.org/r/20260703033729.455358-1-honghuan@amd.com
6 daysMerge branches 'next/clk' and 'next/dt64' into for-nextKrzysztof Kozlowski
6 daysstaging: rtl8723bs: wrap long line over 100 charactersPablo Vallespín Aranguren
Wrap the dequeue_xmitframes_to_sleeping_queue() function declaration to fix line exceeding 100 characters. This fixes the following checkpatch.pl check: - CHECK: line length of 126 exceeds 100 columns. Signed-off-by: Pablo Vallespín Aranguren <pablopva014@gmail.com> Link: https://patch.msgid.link/alPVQEAdoUFjHiJo@ThinkPad-P15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 dayspinctrl: samsung: Add Exynos8855 pinctrl configurationAlim Akhtar
Add pinctrl configuration for Exynos8855. The bank type macros are reused from EXYNOS850 and GS101 SoC. Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com> Reviewed-by: Peter Griffin <peter.griffin@linaro.org> Link: https://patch.msgid.link/20260627171228.2687857-4-alim.akhtar@samsung.com Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
6 daysclk: samsung: exynos990: Fix PERIS gate clock parentsDenzeel Oliva
Correct eight PERIS gate clock parents to match the hardware clock tree and reorder the GIC mux parents so mout_peris_bus_user is the default source. Signed-off-by: Denzeel Oliva <wachiturroxd150@gmail.com> Reviewed-by: Peter Griffin <peter.griffin@linaro.org> Link: https://patch.msgid.link/20260613-exynos990-peris-fix-v3-v3-3-2b230db78ae4@gmail.com Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
6 daysclk: samsung: exynos990: Add PERIS TMU_SUB_PCLK gateDenzeel Oliva
Add the missing CLK_GOUT_PERIS_TMU_SUB_PCLK gate clock for the Thermal Management Unit sub-block and update CLKS_NR_PERIS accordingly. Signed-off-by: Denzeel Oliva <wachiturroxd150@gmail.com> Reviewed-by: Peter Griffin <peter.griffin@linaro.org> Link: https://patch.msgid.link/20260613-exynos990-peris-fix-v3-v3-2-2b230db78ae4@gmail.com Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
6 dayscrypto: keembay - add missing MODULE_DEVICE_TABLE()Pengpeng Hou
The driver has an OF match table wired to .of_match_table, but does not export the table with MODULE_DEVICE_TABLE(). Add the missing MODULE_DEVICE_TABLE(of, ...) entry so module alias information is generated for OF based module autoloading. This is a source-level fix. It does not claim dynamic hardware reproduction; the evidence is the driver-owned match table, its use by the platform driver, and the missing module alias publication. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 dayscrypto: ixp4xx - add missing MODULE_DEVICE_TABLE()Pengpeng Hou
The driver has an OF match table wired to .of_match_table, but does not export the table with MODULE_DEVICE_TABLE(). Add the missing MODULE_DEVICE_TABLE(of, ...) entry so module alias information is generated for OF based module autoloading. This is a source-level fix. It does not claim dynamic hardware reproduction; the evidence is the driver-owned match table, its use by the platform driver, and the missing module alias publication. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Reviewed-by: Linus Walleij <linusw@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 daysMerge 7.2-rc3 into tty-nextGreg Kroah-Hartman
We need the tty/serial fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysusb: gadget: printer: fix infinite loop in printer_read()Melbin K Mathew
printer_read() uses the same variable for the requested copy size and the number of bytes actually copied to user space. copy_to_user() returns the number of bytes not copied, so when it fails to copy anything, the computed copied length becomes zero. In that case len, buf, current_rx_bytes and current_rx_buf are left unchanged. If RX data is available and the user buffer remains unwritable, the read loop can repeat indefinitely. Track the copied length separately and return -EFAULT, or the number of bytes already copied, if an iteration makes no progress. Fixes: b185f01a9ab7 ("usb: gadget: printer: factor out f_printer") Cc: stable <stable@kernel.org> Reviewed-by: Peter Chen <peter.chen@kernel.org> Signed-off-by: Melbin K Mathew <mlbnkm1@gmail.com> Link: https://patch.msgid.link/20260709205622.55700-1-mlbnkm1@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysusb: gadget: f_midi: cancel pending IN work before freeing the midi objectFan Wu
The f_midi driver embeds a work item (midi->work) whose handler, f_midi_in_work(), dereferences the enclosing struct f_midi through container_of(). This work is armed from two sites: f_midi_complete(), on a normal IN-endpoint completion, and f_midi_in_trigger(), on an ALSA rawmidi output-stream start. Neither f_midi_disable() nor f_midi_unbind() cancels midi->work. f_midi_disable() only disables the endpoints and drains the in_req_fifo; it does not synchronize the work item, and the sound card is released asynchronously to the final free of the midi object. The midi object is reference-counted (midi->free_ref) and is freed in f_midi_free() only once both the usb_function reference and the rawmidi private_data reference have been dropped. In f_midi_unbind(), f_midi_disable() runs before the sound card is released, so while the USB endpoints are already disabled the rawmidi device is still usable by an open substream. A concurrent userspace write on such a substream can reach f_midi_in_trigger() and queue midi->work again after f_midi_disable() has returned. A work item armed this way may still be pending when the last reference drops and f_midi_free() proceeds to kfree(midi), letting f_midi_in_work() dereference the struct after it has been freed, a use-after-free. For this reason cancelling midi->work in f_midi_disable() would not be sufficient: the ALSA trigger path can rearm the work after disable() returns. Cancelling at the refcount-zero free site is the boundary after which neither arming source can survive, because by then both references that keep the midi object alive have been dropped: the USB endpoints are already disabled and the rawmidi device has been released. Fix this by calling cancel_work_sync(&midi->work) in the refcount-zero block of f_midi_free(), before the embedded work_struct is freed along with the rest of the structure. opts->lock is a sleeping mutex, so calling cancel_work_sync() under it is permitted, and the handler takes midi->transmit_lock rather than opts->lock, so no self-deadlock can occur while it waits for a running instance of the work to finish. This issue was found by an in-house static analysis tool. Fixes: 8653d71ce3763 ("usb/gadget: f_midi: Replace tasklet with work") Cc: stable <stable@kernel.org> Assisted-by: Codex:gpt-5.5 Signed-off-by: Fan Wu <fanwu01@zju.edu.cn> Link: https://patch.msgid.link/20260709150717.399083-1-fanwu01@zju.edu.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysusb: gadget: udc: bdc: free IRQ and drain func_wake_notify before teardownFan Wu
The Broadcom BDC UDC driver registers its IRQ handler with devm_request_irq() in bdc_udc_init(), so the IRQ is released by devm only after bdc_remove() returns. devm releases resources in reverse LIFO order, but bdc_remove() runs bdc_udc_exit() and bdc_hw_exit() -> bdc_mem_free() manually before returning: bdc_udc_exit() tears down individual endpoint objects via bdc_free_ep(), while bdc_hw_exit() -> bdc_mem_free() frees and NULLs the DMA-coherent status-report ring (bdc->srr.sr_bds) and kfree()s bdc->bdc_ep_array. Both happen while the IRQ handler (bdc_udc_interrupt, requested with IRQF_SHARED) remains deliverable in the window up to the post-remove devm free_irq(). On receipt of a shared interrupt in that window, bdc_udc_interrupt() dereferences bdc->srr.sr_bds[bdc->srr.dqp_index] (NULL or freed DMA) and dispatches sr_handler callbacks that index into bdc_ep_array, causing a NULL-deref or use-after-free. The same window affects the delayed_work bdc->func_wake_notify, which is armed from the IRQ handler via bdc_sr_uspc() -> handle_link_state_change() -> schedule_delayed_work() and may self-rearm from its own callback bdc_func_wake_timer(). No cancel exists anywhere in the driver, so a queued work item that fires after bdc_remove() returns and the bdc structure is devm-freed dereferences freed memory. Replace devm_request_irq() with request_irq() and add an explicit free_irq(bdc->irq, bdc) in bdc_remove(). Clear BDC_GIE before free_irq() to stop the device from asserting interrupts, then free_irq() drains any in-flight handler, then cancel_delayed_work_sync() drains the func_wake_notify delayed work. This ordering ensures the IRQ handler and delayed work cannot interfere with the subsequent endpoint and DMA teardown in bdc_udc_exit() and bdc_hw_exit(). Wire the matching free_irq() into the bdc_udc_init() error path so the IRQ is released on probe failure, and route the bdc_init_ep() failure through err0 instead of returning directly. This issue was found by an in-house static analysis tool. Fixes: efed421a94e6 ("usb: gadget: Add UDC driver for Broadcom USB3.0 device controller IP BDC") Cc: stable <stable@kernel.org> Assisted-by: Codex:gpt-5.5 Signed-off-by: Fan Wu <fanwu01@zju.edu.cn> Link: https://patch.msgid.link/20260709020904.502611-1-fanwu01@zju.edu.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysusb: typec: ucsi: Fix race condition and ordering in port unregistrationAndrei Kuchynski
A synchronization issue exists during port unregistration where pending partner work items can race against workqueue destruction, leading to use-after-free conditions: cros_ec_ucsi cros_ec_ucsi.3.auto: error -ETIMEDOUT: PPM init failed BUG: kernel NULL pointer dereference, address: 0000000000000000 RIP: 0010:__queue_work+0x83/0x4a0 Call Trace: <IRQ> __cfi_delayed_work_timer_fn+0x10/0x10 run_timer_softirq+0x3b6/0xbd0 sched_clock_cpu+0xc/0x110 irq_exit_rcu+0x18d/0x330 fred_sysvec_apic_timer_interrupt+0x5e/0x80 Fix this by ensuring strict ordering and proper serialization during teardown: 1. Move ucsi_unregister_partner() to the beginning of the teardown sequence and protect it under the connector mutex lock. 2. Ensure all pending partner tasks are explicitly flushed and finished before the workqueue is destroyed. 3. Switch from mod_delayed_work() to a cancel_delayed_work() and queue_delayed_work() sequence. This guarantees that items currently marked as pending won't be scheduled an additional time, preventing a double release of resources which leads to the following crash: Oops: general protection fault, probably for non-canonical address 0xdead000000000122: 0000 [#1] SMP NOPTI Workqueue: cros_ec_ucsi.3.auto-con2 ucsi_poll_worker RIP: 0010:ucsi_poll_worker+0x65/0x1e0 Call Trace: <TASK> process_scheduled_works+0x218/0x6d0 worker_thread+0x188/0x3f0 __cfi_worker_thread+0x10/0x10 kthread+0x226/0x2a0 To ensure these rules are applied identically across both the normal teardown and the ucsi_init() error paths, consolidate the cleanup logic into a new helper, ucsi_unregister_port(). Cc: stable <stable@kernel.org> Fixes: b9aa02ca39a4 ("usb: typec: ucsi: Add polling mechanism for partner tasks like alt mode checking") Fixes: b13abcb7ddd8 ("usb: typec: ucsi: Fix NULL pointer access") Fixes: fac4b8633fd6 ("usb: ucsi: Ensure connector delayed work items are flushed") Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org> Reviewed-by: Benson Leung <bleung@chromium.org> Link: https://patch.msgid.link/20260707141736.1635698-1-akuchynski@chromium.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysusb: gadget: f_ncm: validate datagram bounds in ncm_unwrap_ntb()Sonali Pradhan
When unpacking host-supplied NTBs, ncm_unwrap_ntb() checks datagram length against frame_max but does not verify that the datagram fits within the declared block length. Additionally, when decoding multiple NTBs from a single socket buffer, subsequent block lengths are not checked against the actual remaining buffer data. With these checks missing, a malicious USB host can specify datagram offsets and lengths that point beyond the block, or supply secondary NTB headers declaring lengths larger than the buffer. skb_put_data() then copies adjacent kernel memory from skb_shared_info into the network skb. Fix this by verifying that sufficient buffer space remains for the NTB header before parsing, handling zero-length block declarations, ensuring that block lengths never exceed the remaining buffer space, and verifying that each datagram payload stays strictly within the block boundary. Fixes: 427694cfaafa ("usb: gadget: ncm: Handle decoding of multiple NTB's in unwrap call") Fixes: 2b74b0a04d3e ("USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb()") Cc: stable <stable@kernel.org> Assisted-by: Jetski:Gemini-2.5-Pro Signed-off-by: Sonali Pradhan <sonalipradhan@google.com> Link: https://patch.msgid.link/20260703083725.1903850-1-sonalipradhan@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysUSB: gadget: fsl-udc: drop misleading unbind sanity checkJohan Hovold
The UDC pointer is set on successful probe and will never be NULL when the driver is later unbound so drop the misleading sanity check (and confused error message). Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260702141536.90887-5-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysUSB: gadget: fsl-udc: fix dev_printk() deviceJohan Hovold
A change replacing custom printk() macros with dev_printk() incorrectly used the gadget struct device instead of the controller struct device (including for messages printed before the gadget device name has been initialised). Switch to using the controller platform device with dev_printk() so that the controller device and driver names are included in log messages as expected. Fixes: 6025f20f16c2 ("usb: gadget: fsl-udc: Replace custom log wrappers by dev_{err,warn,dbg,vdbg}") Cc: stable <stable@kernel.org> Cc: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20260702141536.90887-4-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysUSB: gadget: snps-udc: fix device name leak on probe failureJohan Hovold
The gadget device name is set by UDC core when registering the gadget and must not be set before to avoid leaking the name in intermediate error paths (e.g. when detecting an older chip revision). Fixes: 12ad0fcaf2fb ("usb: gadget: amd5536udc: let udc-core manage gadget->dev") Cc: stable <stable@kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260702141536.90887-3-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysUSB: gadget: fsl-udc: fix device name leak on probe failureJohan Hovold
The gadget device name is set by UDC core when registering the gadget and must not be set before to avoid leaking the name in intermediate error paths (e.g. on dma pool creation failure). Fixes: eab35c4e6d95 ("usb: gadget: fsl_udc_core: let udc-core manage gadget->dev") Cc: stable <stable@kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260702141536.90887-2-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysusb: xhci-pci: Limit VIA VL805 DMA addressing to 36 bitsXincheng Zhang
The VIA VL805/806 xHCI controller advertises AC64, but fails to handle DMA addresses at or above 0x1000000000. On systems with large amounts of RAM, this can cause USB device failures when the controller is given DMA addresses beyond its usable address width. Do not use XHCI_NO_64BIT_SUPPORT for this controller. That quirk clears the cached AC64 capability and limits DMA to 32 bits, causing unnecessary bouncing for addresses between 4GiB and 64GiB and hiding the controller's real AC64 capability from code that may need to distinguish register access width from usable DMA address width. Track the usable DMA address width separately from the AC64 capability. Initialize the generic xhci->dma_mask_bits field to 64 and let PCI quirks reduce it for controllers with narrower DMA support. Set VIA VL805/806 to 36 bits so the DMA API only hands it addresses in the range it can handle while keeping HCCPARAMS1.AC64 visible. Cc: stable <stable@kernel.org> Signed-off-by: Xincheng Zhang <zhangxincheng@ultrarisc.com> Link: https://patch.msgid.link/20260630-xhci-via-dma-fix-v3-1-690dcb8cf75a@ultrarisc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysusb: gadget: uvc: clamp SEND_RESPONSE length to the response bufferMuhammad Bilal
uvc_send_response() builds the UVC control response from a user-supplied struct uvc_request_data: req->length = min_t(unsigned int, uvc->event_length, data->length); ... memcpy(req->buf, data->data, req->length); req->length is clamped to uvc->event_length, which is taken from the host control request wLength (up to UVC_MAX_REQUEST_SIZE, 64), and to data->length, which comes from the UVCIOC_SEND_RESPONSE ioctl and is only checked for being negative. The source buffer data->data is only 60 bytes, so a response with uvc->event_length and data->length both greater than 60 makes memcpy() read past the end of data->data. Clamp req->length to sizeof(data->data) as well. Fixes: a5eaaa1f33e7 ("usb: gadget: uvc: use capped length value") Cc: stable <stable@kernel.org> Signed-off-by: Muhammad Bilal <meatuni001@gmail.com> Link: https://patch.msgid.link/20260629195004.148405-1-meatuni001@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysusb: gadget: f_tcm: synchronize delayed set_alt with teardownCen Zhang
The f_tcm set_alt() path defers endpoint setup to a work item and completes the delayed status response from process context. The delayed work uses f_tcm private state and may complete the setup request after disconnect or function teardown has already moved on. Cancel and drain the delayed set_alt work when the function is unbound or freed. For disable paths, which are reached under the composite device lock, use a small state machine and a non-sleeping cancellation path instead of cancel_work_sync(). If the work is already running, mark it cancelled and let the worker own the cleanup; otherwise tcm_disable() can cancel the queued work and clean up immediately. Also serialize the final delayed-status completion with the cancellation check while holding the composite device lock. This prevents a disconnect from clearing delayed_status while the worker is about to complete the control request. Validation reproduced this kernel report: BUG: KASAN: slab-use-after-free in tcm_delayed_set_alt+0x6c/0xef0 Call Trace: <TASK> dump_stack_lvl+0x66/0xa0 print_report+0xce/0x630 ? tcm_delayed_set_alt+0x6c/0xef0 ? srso_alias_return_thunk+0x5/0xfbef5 ? __virt_addr_valid+0x188/0x320 ? tcm_delayed_set_alt+0x6c/0xef0 kasan_report+0xe0/0x110 ? tcm_delayed_set_alt+0x6c/0xef0 tcm_delayed_set_alt+0x6c/0xef0 ? __pfx_tcm_delayed_set_alt+0x10/0x10 ? process_one_work+0x4cb/0xb90 ? rcu_is_watching+0x20/0x50 ? tcm_delayed_set_alt+0x9/0xef0 process_one_work+0x4d7/0xb90 ? __pfx_process_one_work+0x10/0x10 ? srso_alias_return_thunk+0x5/0xfbef5 ? __list_add_valid_or_report+0x37/0xf0 ? __pfx_tcm_delayed_set_alt+0x10/0x10 ? srso_alias_return_thunk+0x5/0xfbef5 worker_thread+0x2d8/0x570 ? __pfx_worker_thread+0x10/0x10 kthread+0x1ad/0x1f0 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x3c9/0x540 ? __pfx_ret_from_fork+0x10/0x10 ? srso_alias_return_thunk+0x5/0xfbef5 ? __switch_to+0x2e9/0x730 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> Allocated by task 544: kasan_save_stack+0x33/0x60 kasan_save_track+0x14/0x30 __kasan_kmalloc+0x8f/0xa0 tcm_alloc+0x68/0x180 usb_get_function+0x36/0x60 config_usb_cfg_link+0x125/0x1b0 configfs_symlink+0x322/0x890 vfs_symlink+0xc2/0x270 filename_symlinkat+0x295/0x2f0 __x64_sys_symlinkat+0x62/0x90 do_syscall_64+0x115/0x6a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 661: kasan_save_stack+0x33/0x60 kasan_save_track+0x14/0x30 kasan_save_free_info+0x3b/0x60 __kasan_slab_free+0x43/0x70 kfree+0x2f9/0x530 config_usb_cfg_unlink+0x173/0x1e0 configfs_unlink+0x1fa/0x340 vfs_unlink+0x15c/0x510 filename_unlinkat+0x2ba/0x450 __x64_sys_unlinkat+0x63/0x90 do_syscall_64+0x115/0x6a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f Fixes: c52661d60f63 ("usb-gadget: Initial merge of target module for UASP + BOT") Cc: stable <stable@kernel.org> Assisted-by: Codex:gpt-5.5 Signed-off-by: Cen Zhang <zzzccc427@gmail.com> Link: https://patch.msgid.link/20260627104153.3822495-1-zzzccc427@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysusb: udc: pxa: fix error handlingArnd Bergmann
As Dan Carpenter points out, my recent change makes subtle changes to the error handling that were not intended. Move the warning print up so it does not get skipped in case of an error, but handle -EPROBE_DEFER properly now. Change the devm_gpiod_get() to the _optional variant, which is in line with the intended behavior and the DT binding, though this did not work previously. Reported-by: Dan Carpenter <error27@gmail.com> Link: https://lore.kernel.org/linux-usb/ag6-xhfFjb5NpXQz@stanley.mountain/ Fixes: 25bd55f46032 ("usb: udc: pxa: remove unused platform_data") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20260526104810.3906090-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysMerge 7.2-rc3 into usb-nextGreg Kroah-Hartman
We need the USB fixes in here as well to build on top of. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysata: libata-eh: make ata_eh_qc_complete() and ata_eh_qc_retry() staticDamien Le Moal
The functions ata_eh_qc_complete() and ata_eh_qc_retry() are used only in libata-eh.c. So remove the declaration of these functions from include/linux/libata.h and define them as static. While at it, add a missing blank line between variable declaration and code in these two functions. No functional changes intended. Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
6 daysMerge 7.2-rc3 into staging-nextGreg Kroah-Hartman
We need the staging fixes in here, and it resolves a merge conflict in: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 daysPCI: imx6: Add 'skip_pwrctrl_off' flag supportSherry Sun
Use 'dw_pcie_rp->skip_pwrctrl_off' to avoid powering off devices during suspend to preserve wakeup capability of the devices and also not to power on the devices in the init path. This allows controller power-off to be skipped when some devices (e.g. M.2 Key E cards without auxiliary power) need to support PCIe L2 link state and wake-up mechanisms. Signed-off-by: Sherry Sun <sherry.sun@nxp.com> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260713023435.235765-3-sherry.sun@oss.nxp.com
6 daysata: libata-scsi: add support for the REMOVE ELEMENT AND MODIFY ZONES commandDamien Le Moal
Define the translation for the REMOVE ELEMENT AND MODIFY ZONES command (SERVICE ACTION IN command with service action SAI_REMOVE_ELEMENT_AND_MODIFY_ZONES) into the ATA command ATA_CMD_REMOVE_ELEMENT_AND_MODIFY_ZONES with the new function ata_scsi_remove_element_and_modify_zones_xlat() The array of supported commands ata_supported_cmds is modified to add a new entry for this command. ata_scsi_cmd_is_supported() is also modify to correctly handle this new entry depending on the target device flag ATA_DFLAG_DEPOP being set, and the target device being a ZAC zoned device. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
6 daysata: libata-scsi: add support for the RESTORE ELEMENTS AND REBUILD commandDamien Le Moal
Define the translation for the RESTORE ELEMENTS AND REBUILD command (SERVICE ACTION IN command with service action SAI_RESTORE_ELEMENTS_AND_REBUILD) into the ATA command ATA_CMD_RESTORE_ELEMENTS_AND_REBUILD with the new function ata_scsi_restore_elements_and_rebuild_xlat() The array of supported commands ata_supported_cmds is modified to add a new entry for this command. ata_scsi_cmd_is_supported() is also modify to correctly handle this new entry depending on the target device flag ATA_DFLAG_DEPOP_RESTORE being set. The ATA command completion is handled using the function ata_scsi_depop_ua_cap_changed_complete() so that on a successful completion, a UNIT ATTENTION with the additional sense code set to CAPACITY DATA HAS CHANGED is raised. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
6 daysata: libata-scsi: add support for the REMOVE ELEMENT AND TRUNCATE commandDamien Le Moal
Define the translation for the REMOVE ELEMENT AND TRUNCATE command (SERVICE ACTION IN command with service action SAI_REMOVE_ELEMENT_AND_TRUNCATE) into the ATA command ATA_CMD_REMOVE_ELEMENT_AND_TRUNCATE with the new function ata_scsi_remove_element_and_truncate_xlat() The array of supported commands ata_supported_cmds is modified to add a new entry for this command. ata_scsi_cmd_is_supported() is also modify to correctly handle this new entry depending on the target device flag ATA_DFLAG_DEPOP being set. The ATA command completion is handled using the function ata_scsi_depop_ua_cap_changed_complete() so that on a successful completion, a UNIT ATTENTION with the additional sense code set to CAPACITY DATA HAS CHANGED is raised. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
6 daysata: libata-scsi: add support for the GET PHYSICAL ELEMENT STATUS commandDamien Le Moal
Define the translation for the GET PHYSICAL ELEMENT STATUS command (SERVICE ACTION IN command with service action SAI_GET_PHYSICAL_ELEMENT_STATUS) into the ATA command ATA_CMD_GET_PHYS_ELEMENT_STATUS with the new function ata_scsi_get_phys_element_status_xlat(). The reply of this function also needs translation from little endian to big endian. This is done with the completion callback ata_scsi_get_phys_element_status_complete(). The array of supported commands ata_supported_cmds is modified to add a new entry for this command. ata_scsi_cmd_is_supported() is also modified to correctly handle this new entry depending on the target device flag ATA_DFLAG_DEPOP being set. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
6 daysata: libata-core: detect support for depopulation capabilitiesDamien Le Moal
Introduce the device flags ATA_DFLAG_DEPOP to indicate support by a device for the basic commands of the storage element depopulation feature set, that is, the GET PHYSICAL ELEMENT STATUS and REMOVE ELEMENT AND TRUNCATE commands. The device flag ATA_DFLAG_DEPOP_RESTORE flag is introduced to indicate support for the RESTORE ELEMENTS AND REBUILD command. Both flags are obtained from the command support bits of the qword at bytes 152 to 159 of the supported capabilities log page. For ZAC devices, the device flag ATA_DFLAG_DEPOP_MODIFY is introduced to indicate support for the REMOVE ELEMENT AND MODIFY ZONES command. This support is indicated by the REMOVE ELEMENT AND MODIFY ZONES SUPPORTED bit in the qword at byte 8 to 15 of the zoned device information log page. The function ata_dev_config_depop() is introduced to set these flags based on the content of the supported capabilities log and zoned device information log. As per the ACS specifications, NCQ autosense support is also mandatory if these flags are set. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>