5.10.235-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 149/462 usb: xhci: Add timeout argument in address_device USB HCD callback
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hardik Gajjar <[email protected]>
[ Upstream commit a769154c7cac037914ba375ae88aae55b2c853e0 ]
- The HCD address_device callback now accepts a user-defined timeout value in milliseconds, providing better control over command execution times.
- The default timeout value for the address_device command has been set to 5000 ms, aligning with the USB 3.2 specification. However, this timeout can be adjusted as needed.
- The xhci_setup_device function has been updated to accept the timeout value, allowing it to specify the maximum wait time for the command operation to complete.
- The hub driver has also been updated to accommodate the newly added timeout parameter during the SET_ADDRESS request.
Stable-dep-of: 1e0a19912adb ("usb: xhci: Fix NULL pointer dereference on certain command aborts")
--- drivers/usb/core/hub.c | 2 +- drivers/usb/host/xhci-mem.c | 2 ++ drivers/usb/host/xhci-ring.c | 11 ++++++----- drivers/usb/host/xhci.c | 23 ++++++++++++++++------- drivers/usb/host/xhci.h | 9 +++++++-- include/linux/usb/hcd.h | 5 +++-- 6 files changed, 35 insertions(+), 17 deletions(-)
drivers/usb/core/hub.c +1 -1
@@ -4662,7 +4662,7 @@ static int hub_set_address(struct usb_device *udev, int devnum)if (udev->state !=USB_STATE_DEFAULT )return -EINVAL ;if (hcd->driver->address_device) - retval = hcd->driver->address_device (hcd, udev); + retval = hcd->driver->address_device (hcd, udev,USB_CTRL_SET_TIMEOUT );else retval = usb_control_msg(udev, usb_sndaddr0pipe(), USB_REQ_SET_ADDRESS, 0, devnum, 0,
drivers/usb/host/xhci-mem.c +2 -0
@@ -1779,6 +1779,8 @@ struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, } command->status =0 ; +/* set default timeout to 5000 ms */ + command->timeout_ms =XHCI_CMD_DEFAULT_TIMEOUT ;INIT_LIST_HEAD (&command->cmd_list);return command; }
drivers/usb/host/xhci-ring.c +6 -5
@@ -288,9 +288,10 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci)readl (&xhci->dba->doorbell[0 ]); } -static bool xhci_mod_cmd_timer (struct xhci_hcd *xhci,unsigned long delay) +static bool xhci_mod_cmd_timer (struct xhci_hcd *xhci) { -return mod_delayed_work (system_wq, &xhci->cmd_timer, delay); +return mod_delayed_work (system_wq, &xhci->cmd_timer, +msecs_to_jiffies (xhci->current_cmd->timeout_ms)); }static struct xhci_command *xhci_next_queued_cmd (struct xhci_hcd *xhci)
@@ -334,7 +335,7 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) && !(xhci->xhc_state &XHCI_STATE_DYING )) { xhci->current_cmd = cur_cmd; -xhci_mod_cmd_timer (xhci,XHCI_CMD_DEFAULT_TIMEOUT ); +xhci_mod_cmd_timer (xhci);xhci_ring_cmd_db (xhci); } }
@@ -1687,7 +1688,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,if (!list_is_singular (&xhci->cmd_list)) { xhci->current_cmd =list_first_entry (&cmd->cmd_list, struct xhci_command, cmd_list); -xhci_mod_cmd_timer (xhci,XHCI_CMD_DEFAULT_TIMEOUT ); +xhci_mod_cmd_timer (xhci); }else if (xhci->current_cmd == cmd) { xhci->current_cmd =NULL ; }
@@ -4203,7 +4204,7 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd,/* if there are no other commands queued we start the timeout timer */ if (list_empty (&xhci->cmd_list)) { xhci->current_cmd = cmd; -xhci_mod_cmd_timer (xhci,XHCI_CMD_DEFAULT_TIMEOUT ); +xhci_mod_cmd_timer (xhci); }list_add_tail (&cmd->cmd_list, &xhci->cmd_list);
drivers/usb/host/xhci.c +16 -7
@@ -4116,12 +4116,18 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)return 0 ; } -/* -* Issue an Address Device command and optionally send a corresponding -* SetAddress request to the device. +/** +* xhci_setup_device - issues an Address Device command to assign a unique +* USB bus address. +* @hcd: USB host controller data structure. +* @udev: USB dev structure representing the connected device. +* @setup: Enum specifying setup mode: address only or with context. +* @timeout_ms: Max wait time (ms) for the command operation to complete. +* +* Return: 0 if successful; otherwise, negative error code. */ static int xhci_setup_device (struct usb_hcd *hcd,struct usb_device *udev, -enum xhci_setup_dev setup) +enum xhci_setup_dev setup,unsigned int timeout_ms) {const char *act = setup ==SETUP_CONTEXT_ONLY ?"context" :"address" ;unsigned long flags;
@@ -4178,6 +4184,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, } command->in_ctx = virt_dev->in_ctx; + command->timeout_ms = timeout_ms; slot_ctx =xhci_get_slot_ctx (xhci, virt_dev->in_ctx); ctrl_ctx =xhci_get_input_control_ctx (virt_dev->in_ctx);
@@ -4306,14 +4313,16 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,return ret; } -static int xhci_address_device (struct usb_hcd *hcd,struct usb_device *udev) +static int xhci_address_device (struct usb_hcd *hcd,struct usb_device *udev, +unsigned int timeout_ms) { -return xhci_setup_device (hcd, udev,SETUP_CONTEXT_ADDRESS ); +return xhci_setup_device (hcd, udev,SETUP_CONTEXT_ADDRESS , timeout_ms); }static int xhci_enable_device (struct usb_hcd *hcd,struct usb_device *udev) { -return xhci_setup_device (hcd, udev,SETUP_CONTEXT_ONLY ); +return xhci_setup_device (hcd, udev,SETUP_CONTEXT_ONLY , +XHCI_CMD_DEFAULT_TIMEOUT ); }/*
drivers/usb/host/xhci.h +7 -2
@@ -815,6 +815,8 @@ struct xhci_command {struct completion *completion;union xhci_trb *command_trb;struct list_head cmd_list; +/* xHCI command response timeout in milliseconds */ +unsigned int timeout_ms; };/* drop context bitmasks */
@@ -1558,8 +1560,11 @@ struct xhci_td {unsigned int num_trbs; }; -/* xHCI command default timeout value */ -#define XHCI_CMD_DEFAULT_TIMEOUT (5 * HZ) +/* +* xHCI command default timeout value in milliseconds. +* USB 3.2 spec, section 9.2.6.1 +*/ +#define XHCI_CMD_DEFAULT_TIMEOUT 5000/* command descriptor */ struct xhci_cd {
include/linux/usb/hcd.h +3 -2
@@ -385,8 +385,9 @@ struct hc_driver {* or bandwidth constraints. */ void (*reset_bandwidth)(struct usb_hcd *,struct usb_device *); -/* Returns the hardware-chosen device address */ -int (*address_device)(struct usb_hcd *,struct usb_device *udev); +/* Set the hardware-chosen device address */ +int (*address_device)(struct usb_hcd *,struct usb_device *udev, +unsigned int timeout_ms);/* prepares the hardware to send commands to the device */ int (*enable_device)(struct usb_hcd *,struct usb_device *udev);/* Notifies the HCD after a hub descriptor is fetched.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 150/462 usb: xhci: Fix NULL pointer dereference on certain command aborts
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
[ Upstream commit 1e0a19912adb68a4b2b74fd77001c96cd83eb073 ]
If a command is queued to the final usable TRB of a ring segment, the enqueue pointer is advanced to the subsequent link TRB and no further. If the command is later aborted, when the abort completion is handled the dequeue pointer is advanced to the first TRB of the next segment.
If no further commands are queued, xhci_handle_stopped_cmd_ring() sees the ring pointers unequal and assumes that there is a pending command, so it calls xhci_mod_cmd_timer() which crashes if cur_cmd was NULL.
Don't attempt timer setup if cur_cmd is NULL. The subsequent doorbell ring likely is unnecessary too, but it's harmless. Leave it alone.
This is probably Bug 219532, but no confirmation has been received.
The issue has been independently reproduced and confirmed fixed using a USB MCU programmed to NAK the Status stage of SET_ADDRESS forever. Everything continued working normally after several prevented crashes.
--- drivers/usb/host/xhci-ring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +2 -1
@@ -335,7 +335,8 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) && !(xhci->xhc_state &XHCI_STATE_DYING )) { xhci->current_cmd = cur_cmd; -xhci_mod_cmd_timer (xhci); +if (cur_cmd) +xhci_mod_cmd_timer (xhci);xhci_ring_cmd_db (xhci); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 151/462 nvme: handle connectivity loss in nvme_set_queue_count
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit 294b2b7516fd06a8dd82e4a6118f318ec521e706 ]
When the set feature attempts fails with any NVME status code set in nvme_set_queue_count, the function still report success. Though the numbers of queues set to 0. This is done to support controllers in degraded state (the admin queue is still up and running but no IO queues).
Though there is an exception. When nvme_set_features reports an host path error, nvme_set_queue_count should propagate this error as the connectivity is lost, which means also the admin queue is not working anymore.
--- drivers/nvme/host/core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +7 -1
@@ -1491,7 +1491,13 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count) status =nvme_set_features (ctrl,NVME_FEAT_NUM_QUEUES , q_count,NULL ,0 , &result); -if (status <0 ) + +/* +* It's either a kernel error or the host observed a connection +* lost. In either case it's not possible communicate with the +* controller and thus enter the error code path. +*/ +if (status <0 || status ==NVME_SC_HOST_PATH_ERROR )return status;/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 152/462 firmware: iscsi_ibft: fix ISCSI_IBFT Kconfig entry
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prasad Pandit <[email protected]>
[ Upstream commit e1e17a1715982201034024863efbf238bee2bdf9 ]
Fix ISCSI_IBFT Kconfig entry, replace tab with a space character.
--- drivers/firmware/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/Kconfig +1 -1
@@ -171,7 +171,7 @@ config ISCSI_IBFT select ISCSI_BOOT_SYSFS select ISCSI_IBFT_FIND if X86 depends on ACPI && SCSI && SCSI_LOWLEVEL - default n + default n help This option enables support for detection and exposing of iSCSI Boot Firmware Table (iBFT) via sysfs to userspace. If you wish to
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 153/462 gpu: drm_dp_cec: fix broken CEC adapter properties check
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit 6daaae5ff7f3b23a2dacc9c387ff3d4f95b67cad ]
If the hotplug detect of a display is low for longer than one second (configurable through drm_dp_cec_unregister_delay), then the CEC adapter is unregistered since we assume the display was disconnected. If the HPD went low for less than one second, then we check if the properties of the CEC adapter have changed, since that indicates that we actually switch to new hardware and we have to unregister the old CEC device and register a new one.
Unfortunately, the test for changed properties was written poorly, and after a new CEC capability was added to the CEC core code the test always returned true (i.e. the properties had changed).
As a result the CEC device was unregistered and re-registered for every HPD toggle. If the CEC remote controller integration was also enabled (CONFIG_MEDIA_CEC_RC was set), then the corresponding input device was also unregistered and re-registered. As a result the input device in /sys would keep incrementing its number, e.g.:
/sys/devices/pci0000:00/0000:00:08.1/0000:e7:00.0/rc/rc0/input20
Since short HPD toggles are common, the number could over time get into the thousands.
While not a serious issue (i.e. nothing crashes), it is not intended to work that way.
This patch changes the test so that it only checks for the single CEC capability that can actually change, and it ignores any other capabilities, so this is now safe as well if new caps are added in the future.
With the changed test the bit under #ifndef CONFIG_MEDIA_CEC_RC can be dropped as well, so that's a nice cleanup.
--- drivers/gpu/drm/drm_dp_cec.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_dp_cec.c +3 -11
@@ -310,16 +310,6 @@ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid)if (!aux->transfer)return ; -#ifndef CONFIG_MEDIA_CEC_RC -/* -* CEC_CAP_RC is part of CEC_CAP_DEFAULTS, but it is stripped by -* cec_allocate_adapter() if CONFIG_MEDIA_CEC_RC is undefined. -* -* Do this here as well to ensure the tests against cec_caps are -* correct. -*/ - cec_caps &= ~CEC_CAP_RC ; -#endif cancel_delayed_work_sync (&aux->cec.unregister_work);mutex_lock (&aux->cec.lock);
@@ -336,7 +326,9 @@ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) num_las =CEC_MAX_LOG_ADDRS ;if (aux->cec.adap) { -if (aux->cec.adap->capabilities == cec_caps && +/* Check if the adapter properties have changed */ +if ((aux->cec.adap->capabilities &CEC_CAP_MONITOR_ALL ) == + (cec_caps &CEC_CAP_MONITOR_ALL ) && aux->cec.adap->available_log_addrs == num_las) {/* Unchanged, so just set the phys addr */ cec_s_phys_addr_from_edid (aux->cec.adap, edid);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 154/462 tg3: Disable tg3 PCIe AER on system reboot
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lenny Szubowicz <[email protected]>
[ Upstream commit e0efe83ed325277bb70f9435d4d9fc70bebdcca8 ]
Disable PCIe AER on the tg3 device on system reboot on a limited list of Dell PowerEdge systems. This prevents a fatal PCIe AER event on the tg3 device during the ACPI _PTS (prepare to sleep) method for S5 on those systems. The _PTS is invoked by acpi_enter_sleep_state_prep() as part of the kernel's reboot sequence as a result of commit 38f34dba806a ("PM: ACPI: reboot: Reinstate S5 for reboot").
There was an earlier fix for this problem by commit 2ca1c94ce0b6 ("tg3: Disable tg3 device on system reboot to avoid triggering AER"). But it was discovered that this earlier fix caused a reboot hang when some Dell PowerEdge servers were booted via ipxe. To address this reboot hang, the earlier fix was essentially reverted by commit 9fc3bc764334 ("tg3: power down device only on SYSTEM_POWER_OFF"). This re-exposed the tg3 PCIe AER on reboot problem.
This fix is not an ideal solution because the root cause of the AER is in system firmware. Instead, it's a targeted work-around in the tg3 driver.
Note also that the PCIe AER must be disabled on the tg3 device even if the system is configured to use "firmware first" error handling.
V3:
- Fix sparse warning on improper comparison of pdev->current_state
- Adhere to netdev comment style
--- drivers/net/ethernet/broadcom/tg3.c | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
drivers/net/ethernet/broadcom/tg3.c +58 -0
@@ -55,6 +55,7 @@#include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> #include <linux/crc32poly.h> +#include <linux/dmi.h> #include <net/checksum.h> #include <net/ip.h>
@@ -18184,6 +18185,50 @@ static int tg3_resume(struct device *device) static SIMPLE_DEV_PM_OPS(tg3_pm_ops, tg3_suspend, tg3_resume); +/* Systems where ACPI _PTS (Prepare To Sleep) S5 will result in a fatal +* PCIe AER event on the tg3 device if the tg3 device is not, or cannot +* be, powered down. +*/ +static const struct dmi_system_id tg3_restart_aer_quirk_table[] = { + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R440" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R540" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R640" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R650" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R740" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R750" ), + }, + }, + {} +}; +static void tg3_shutdown (struct pci_dev *pdev) {struct net_device *dev =pci_get_drvdata (pdev);
@@ -18200,6 +18245,19 @@ static void tg3_shutdown(struct pci_dev *pdev)if (system_state ==SYSTEM_POWER_OFF )tg3_power_down (tp); +else if (system_state ==SYSTEM_RESTART && +dmi_first_match (tg3_restart_aer_quirk_table) && + pdev->current_state != PCI_D3cold && + pdev->current_state !=PCI_UNKNOWN ) { +/* Disable PCIe AER on the tg3 to avoid a fatal +* error during this system restart. +*/ +pcie_capability_clear_word (pdev,PCI_EXP_DEVCTL , +PCI_EXP_DEVCTL_CERE | +PCI_EXP_DEVCTL_NFERE | +PCI_EXP_DEVCTL_FERE | +PCI_EXP_DEVCTL_URRE ); + }rtnl_unlock ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 155/462 udp: gso: do not drop small packets when PMTU reduces
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yan Zhai <[email protected]>
[ Upstream commit 235174b2bed88501fda689c113c55737f99332d8 ]
Commit 4094871db1d6 ("udp: only do GSO if # of segs > 1") avoided GSO for small packets. But the kernel currently dismisses GSO requests only after checking MTU/PMTU on gso_size. This means any packets, regardless of their payload sizes, could be dropped when PMTU becomes smaller than requested gso_size. We encountered this issue in production and it caused a reliability problem that new QUIC connection cannot be established before PMTU cache expired, while non GSO sockets still worked fine at the same time.
Ideally, do not check any GSO related constraints when payload size is smaller than requested gso_size, and return EMSGSIZE instead of EINVAL on MTU/PMTU check failure to be more specific on the error cause.
--- net/ipv4/udp.c | 4 ++-- net/ipv6/udp.c | 4 ++-- tools/testing/selftests/net/udpgso.c | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-)
net/ipv4/udp.c +2 -2
@@ -923,9 +923,9 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,const int hlen =skb_network_header_len (skb) +sizeof (struct udphdr ); -if (hlen + cork->gso_size > cork->fragsize) { +if (hlen +min (datalen, cork->gso_size) > cork->fragsize) {kfree_skb (skb); -return -EINVAL ; +return -EMSGSIZE ; }if (datalen > cork->gso_size *UDP_MAX_SEGMENTS ) {kfree_skb (skb);
net/ipv6/udp.c +2 -2
@@ -1210,9 +1210,9 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,const int hlen =skb_network_header_len (skb) +sizeof (struct udphdr ); -if (hlen + cork->gso_size > cork->fragsize) { +if (hlen +min (datalen, cork->gso_size) > cork->fragsize) {kfree_skb (skb); -return -EINVAL ; +return -EMSGSIZE ; }if (datalen > cork->gso_size *UDP_MAX_SEGMENTS ) {kfree_skb (skb);
tools/testing/selftests/net/udpgso.c +26 -0
@@ -94,6 +94,19 @@ struct testcase testcases_v4[] = { .gso_len = CONST_MSS_V4, .r_num_mss = 1, }, + { + /* datalen <= MSS < gso_len: will fall back to no GSO */ + .tlen = CONST_MSS_V4, + .gso_len = CONST_MSS_V4 + 1, + .r_num_mss = 0, + .r_len_last = CONST_MSS_V4, + }, + { + /* MSS < datalen < gso_len: fail */ + .tlen = CONST_MSS_V4 + 1, + .gso_len = CONST_MSS_V4 + 2, + .tfail = true, + }, { /* send a single MSS + 1B */ .tlen = CONST_MSS_V4 + 1,
@@ -197,6 +210,19 @@ struct testcase testcases_v6[] = { .gso_len = CONST_MSS_V6, .r_num_mss = 1, }, + { + /* datalen <= MSS < gso_len: will fall back to no GSO */ + .tlen = CONST_MSS_V6, + .gso_len = CONST_MSS_V6 + 1, + .r_num_mss = 0, + .r_len_last = CONST_MSS_V6, + }, + { + /* MSS < datalen < gso_len: fail */ + .tlen = CONST_MSS_V6 + 1, + .gso_len = CONST_MSS_V6 + 2, + .tfail = true + }, { /* send a single MSS + 1B */ .tlen = CONST_MSS_V6 + 1,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 156/462 gpio: pca953x: Improve interrupt support
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Tomlinson <[email protected]>
[ Upstream commit d6179f6c6204f9932aed3a7a2100b4a295dfed9d ]
The GPIO drivers with latch interrupt support (typically types starting with PCAL) have interrupt status registers to determine which particular inputs have caused an interrupt. Unfortunately there is no atomic operation to read these registers and clear the interrupt. Clearing the interrupt is done by reading the input registers.
The code was reading the interrupt status registers, and then reading the input registers. If an input changed between these two events it was lost.
The solution in this patch is to revert to the non-latch version of code, i.e. remembering the previous input status, and looking for the changes. This system results in no more I2C transfers, so is no slower. The latch property of the device still means interrupts will still be noticed if the input changes back to its initial state.
--- drivers/gpio/gpio-pca953x.c | 19 ------------------- 1 file changed, 19 deletions(-)
drivers/gpio/gpio-pca953x.c +0 -19
@@ -732,25 +732,6 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pendinDECLARE_BITMAP (trigger,MAX_LINE );int ret; -if (chip->driver_data &PCA_PCAL ) { -/* Read the current interrupt status from the device */ - ret =pca953x_read_regs (chip,PCAL953X_INT_STAT , trigger); -if (ret) -return false; - -/* Check latched inputs and clear interrupt status */ - ret =pca953x_read_regs (chip, chip->regs->input, cur_stat); -if (ret) -return false; - -/* Apply filter for rising/falling edge selection */ -bitmap_replace (new_stat, chip->irq_trig_fall, chip->irq_trig_raise, cur_stat, gc->ngpio); - -bitmap_and (pending, new_stat, trigger, gc->ngpio); - -return !bitmap_empty (pending, gc->ngpio); - } - ret =pca953x_read_regs (chip, chip->regs->input, cur_stat);if (ret)return false;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 157/462 net: atlantic: fix warning during hot unplug
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Moroni <[email protected]>
[ Upstream commit 028676bb189ed6d1b550a0fc570a9d695b6acfd3 ]
Firmware deinitialization performs MMIO accesses which are not necessary if the device has already been removed. In some cases, these accesses happen via readx_poll_timeout_atomic which ends up timing out, resulting in a warning at hw_atl2_utils_fw.c:112:
[ 104.595913] Call Trace: [ 104.595915] <TASK> [ 104.595918] ? show_regs+0x6c/0x80 [ 104.595923] ? __warn+0x8d/0x150 [ 104.595925] ? aq_a2_fw_deinit+0xcf/0xe0 [atlantic] [ 104.595934] ? report_bug+0x182/0x1b0 [ 104.595938] ? handle_bug+0x6e/0xb0 [ 104.595940] ? exc_invalid_op+0x18/0x80 [ 104.595942] ? asm_exc_invalid_op+0x1b/0x20 [ 104.595944] ? aq_a2_fw_deinit+0xcf/0xe0 [atlantic] [ 104.595952] ? aq_a2_fw_deinit+0xcf/0xe0 [atlantic] [ 104.595959] aq_nic_deinit.part.0+0xbd/0xf0 [atlantic] [ 104.595964] aq_nic_deinit+0x17/0x30 [atlantic] [ 104.595970] aq_ndev_close+0x2b/0x40 [atlantic] [ 104.595975] __dev_close_many+0xad/0x160 [ 104.595978] dev_close_many+0x99/0x170 [ 104.595979] unregister_netdevice_many_notify+0x18b/0xb20 [ 104.595981] ? __call_rcu_common+0xcd/0x700 [ 104.595984] unregister_netdevice_queue+0xc6/0x110 [ 104.595986] unregister_netdev+0x1c/0x30 [ 104.595988] aq_pci_remove+0xb1/0xc0 [atlantic]
Fix this by skipping firmware deinitialization altogether if the PCI device is no longer present.
Tested with an AQC113 attached via Thunderbolt by performing repeated unplug cycles while traffic was running via iperf.
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +3 -1
@@ -1294,7 +1294,9 @@ void aq_nic_deinit(struct aq_nic_s *self, bool link_down)aq_ptp_ring_free (self);aq_ptp_free (self); -if (likely (self->aq_fw_ops->deinit) && link_down) { +/* May be invoked during hot unplug. */ +if (pci_device_is_present (self->pdev) && +likely (self->aq_fw_ops->deinit) && link_down) {mutex_lock (&self->fwreq_mutex); self->aq_fw_ops->deinit (self->aq_hw);mutex_unlock (&self->fwreq_mutex);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 158/462 net: rose: lock the socket in rose_bind()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a1300691aed9ee852b0a9192e29e2bdc2411a7e6 ]
syzbot reported a soft lockup in rose_loopback_timer(), with a repro calling bind() from multiple threads.
rose_bind() must lock the socket to avoid this issue.
--- net/rose/af_rose.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
net/rose/af_rose.c +16 -8
@@ -700,11 +700,9 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)struct net_device *dev;ax25_address *source;ax25_uid_assoc *user; +int err = -EINVAL ;int n; -if (!sock_flag (sk,SOCK_ZAPPED )) -return -EINVAL ; -if (addr_len !=sizeof (struct sockaddr_rose ) && addr_len !=sizeof (struct full_sockaddr_rose ))return -EINVAL ;
@@ -717,8 +715,15 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)if ((unsigned int ) addr->srose_ndigis >ROSE_MAX_DIGIS )return -EINVAL ; -if ((dev =rose_dev_get (&addr->srose_addr)) ==NULL ) -return -EADDRNOTAVAIL ; +lock_sock (sk); + +if (!sock_flag (sk,SOCK_ZAPPED )) + goto out_release; + + err = -EADDRNOTAVAIL ; + dev =rose_dev_get (&addr->srose_addr); +if (!dev) + goto out_release; source = &addr->srose_call;
@@ -729,7 +734,8 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) }else {if (ax25_uid_policy && !capable (CAP_NET_BIND_SERVICE )) {dev_put (dev); -return -EACCES ; + err = -EACCES ; + goto out_release; } rose->source_call = *source; }
@@ -751,8 +757,10 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)rose_insert_socket (sk);sock_reset_flag (sk,SOCK_ZAPPED ); - -return 0 ; + err =0 ; +out_release: +release_sock (sk); +return err; }static int rose_connect (struct socket *sock,struct sockaddr *uaddr,int addr_len,int flags)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 159/462 x86/xen: fix xen_hypercall_hvm() to not clobber %rbx
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit 98a5cfd2320966f40fe049a9855f8787f0126825 ]
xen_hypercall_hvm(), which is used when running as a Xen PVH guest at most only once during early boot, is clobbering %rbx. Depending on whether the caller relies on %rbx to be preserved across the call or not, this clobbering might result in an early crash of the system.
This can be avoided by using an already saved register instead of %rbx.
--- arch/x86/xen/xen-head.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/xen/xen-head.S +2 -2
@@ -115,8 +115,8 @@ SYM_FUNC_START(xen_hypercall_hvm) pop %ebx pop %eax #else - lea xen_hypercall_amd(%rip), %rbx - cmp %rax, %rbx + lea xen_hypercall_amd(%rip), %rcx + cmp %rax, %rcx #ifdef CONFIG_FRAME_POINTER pop %rax /* Dummy pop. */ #endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 160/462 x86/xen: add FRAME_END to xen_hypercall_hvm()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit 0bd797b801bd8ee06c822844e20d73aaea0878dd ]
xen_hypercall_hvm() is missing a FRAME_END at the end, add it.
--- arch/x86/xen/xen-head.S | 1 + 1 file changed, 1 insertion(+)
arch/x86/xen/xen-head.S +1 -0
@@ -130,6 +130,7 @@ SYM_FUNC_START(xen_hypercall_hvm) pop %rcx pop %rax #endif + FRAME_END /* Use correct hypercall function. */ jz xen_hypercall_amd jmp xen_hypercall_intel
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 161/462 netem: Update sch->q.qlen before qdisc_tree_reduce_backlog()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 638ba5089324796c2ee49af10427459c2de35f71 ]
qdisc_tree_reduce_backlog() notifies parent qdisc only if child qdisc becomes empty, therefore we need to reduce the backlog of the child qdisc before calling it. Otherwise it would miss the opportunity to call cops->qlen_notify(), in the case of DRR, it resulted in UAF since DRR uses ->qlen_notify() to maintain its active list.
--- net/sched/sch_netem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_netem.c +1 -1
@@ -739,9 +739,9 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)if (err !=NET_XMIT_SUCCESS ) {if (net_xmit_drop_count (err))qdisc_qstats_drop (sch); -qdisc_tree_reduce_backlog (sch,1 , pkt_len); sch->qstats.backlog -= pkt_len; sch->q.qlen--; +qdisc_tree_reduce_backlog (sch,1 , pkt_len); } goto tfifo_dequeue; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 162/462 tun: revert fix group permission check
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
[ Upstream commit a70c7b3cbc0688016810bb2e0b9b8a0d6a530045 ]
This reverts commit 3ca459eaba1bf96a8c7878de84fa8872259a01e3.
The blamed commit caused a regression when neither tun->owner nor tun->group is set. This is intended to be allowed, but now requires CAP_NET_ADMIN.
Discussion in the referenced thread pointed out that the original issue that prompted this patch can be resolved in userspace.
The relaxed access control may also make a device accessible when it previously wasn't, while existing users may depend on it to not be.
This is a clean pure git revert, except for fixing the indentation on the gid_valid line that checkpatch correctly flagged.
--- drivers/net/tun.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/net/tun.c +5 -9
@@ -586,18 +586,14 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb,return ret; } -static inline bool tun_capable (struct tun_struct *tun) +static inline bool tun_not_capable (struct tun_struct *tun) {const struct cred *cred =current_cred ();struct net *net =dev_net (tun->dev); -if (ns_capable (net->user_ns,CAP_NET_ADMIN )) -return 1 ; -if (uid_valid (tun->owner) &&uid_eq (cred->euid, tun->owner)) -return 1 ; -if (gid_valid (tun->group) &&in_egroup_p (tun->group)) -return 1 ; -return 0 ; +return ((uid_valid (tun->owner) && !uid_eq (cred->euid, tun->owner)) || + (gid_valid (tun->group) && !in_egroup_p (tun->group))) && + !ns_capable (net->user_ns,CAP_NET_ADMIN ); }static void tun_set_real_num_queues (struct tun_struct *tun)
@@ -2776,7 +2772,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) !!(tun->flags & IFF_MULTI_QUEUE))return -EINVAL ; -if (!tun_capable (tun)) +if (tun_not_capable (tun))return -EPERM ; err =security_tun_dev_open (tun->security);if (err <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 163/462 cpufreq: s3c64xx: Fix compilation warning
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
commit 43855ac61483cb914f060851535ea753c094b3e0 upstream.
The driver generates following warning when regulator support isn't enabled in the kernel. Fix it.
drivers/cpufreq/s3c64xx-cpufreq.c: In function 's3c64xx_cpufreq_set_target':
Quoted 1 line
Quoted 1 line
drivers/cpufreq/s3c64xx-cpufreq.c:55:22: warning: variable 'old_freq' set but not used [-Wunused-but-set-variable]
55 | unsigned int old_freq, new_freq;
| ^~~~~~~~Quoted 1 line
Quoted 1 line
drivers/cpufreq/s3c64xx-cpufreq.c:54:30: warning: variable 'dvfs' set but not used [-Wunused-but-set-variable]
54 | struct s3c64xx_dvfs *dvfs;
| ^~~~--- drivers/cpufreq/s3c64xx-cpufreq.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/cpufreq/s3c64xx-cpufreq.c +7 -4
@@ -24,6 +24,7 @@ struct s3c64xx_dvfs {unsigned int vddarm_max; }; +#ifdef CONFIG_REGULATOR static struct s3c64xx_dvfs s3c64xx_dvfs_table[] = { [0 ] = {1000000 ,1150000 }, [1] = { 1050000, 1150000 },
@@ -31,6 +32,7 @@ static struct s3c64xx_dvfs s3c64xx_dvfs_ [3] = { 1200000, 1350000 }, [4] = { 1300000, 1350000 }, }; +#endif static struct cpufreq_frequency_table s3c64xx_freq_table[] = { {0 ,0 ,66000 },
@@ -51,15 +53,16 @@ static struct cpufreq_frequency_table s3 static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) { - struct s3c64xx_dvfs *dvfs; - unsigned int old_freq, new_freq; + unsigned int new_freq = s3c64xx_freq_table[index].frequency; int ret; +#ifdef CONFIG_REGULATOR + struct s3c64xx_dvfs *dvfs; + unsigned int old_freq; + old_freq = clk_get_rate(policy->clk) / 1000; - new_freq = s3c64xx_freq_table[index].frequency; dvfs = &s3c64xx_dvfs_table[s3c64xx_freq_table[index].driver_data]; -#ifdef CONFIG_REGULATOR if (vddarm && new_freq > old_freq) { ret = regulator_set_voltage(vddarm, dvfs->vddarm_min,
Greg Kroah-Hartman
maintainerPATCH 164/462 leds: lp8860: Write full EEPROM, not only half of it
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
commit 0d2e820a86793595e2a776855d04701109e46663 upstream.
I struggle to explain dividing an ARRAY_SIZE() by the size of an element once again. As the latter equals to 2, only the half of EEPROM was ever written. Drop the unexplainable division and write full ARRAY_SIZE().
--- drivers/leds/leds-lp8860.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-lp8860.c +1 -1
@@ -267,7 +267,7 @@ static int lp8860_init(struct lp8860_led goto out; } - reg_count =ARRAY_SIZE (lp8860_eeprom_disp_regs) /sizeof (lp8860_eeprom_disp_regs[0 ]); + reg_count =ARRAY_SIZE (lp8860_eeprom_disp_regs);for (i =0 ; i < reg_count; i++) { ret = regmap_write(led->eeprom_regmap, lp8860_eeprom_disp_regs[i].reg,
Greg Kroah-Hartman
maintainerPATCH 165/462 drm/modeset: Handle tiled displays in pan_display_atomic.
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maarten Lankhorst <[email protected]>
commit f4a9dd57e549a17a7dac1c1defec26abd7e5c2d4 upstream.
Tiled displays have a different x/y offset to begin with. Instead of attempting to remember this, just apply a delta instead.
This fixes the first tile being duplicated on other tiles when vt switching.
--- drivers/gpu/drm/drm_fb_helper.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +8 -6
@@ -1380,14 +1380,14 @@ int drm_fb_helper_set_par(struct fb_info }EXPORT_SYMBOL (drm_fb_helper_set_par); -static void pan_set (struct drm_fb_helper *fb_helper,int x,int y) +static void pan_set (struct drm_fb_helper *fb_helper,int dx,int dy) {struct drm_mode_set *mode_set;mutex_lock (&fb_helper->client.modeset_mutex);drm_client_for_each_modeset (mode_set, &fb_helper->client) { - mode_set->x = x; - mode_set->y = y; + mode_set->x += dx; + mode_set->y += dy; }mutex_unlock (&fb_helper->client.modeset_mutex); }
@@ -1396,16 +1396,18 @@ static int pan_display_atomic(struct fb_ struct fb_info *info) {struct drm_fb_helper *fb_helper = info->par; -int ret; +int ret, dx, dy; -pan_set (fb_helper, var->xoffset, var->yoffset); + dx = var->xoffset - info->var.xoffset; + dy = var->yoffset - info->var.yoffset; +pan_set (fb_helper, dx, dy); ret =drm_client_modeset_commit_locked (&fb_helper->client);if (!ret) { info->var.xoffset = var->xoffset; info->var.yoffset = var->yoffset; }else -pan_set (fb_helper, info->var.xoffset, info->var.yoffset); +pan_set (fb_helper, -dx, -dy);return ret; }
Greg Kroah-Hartman
maintainerPATCH 166/462 s390/futex: Fix FUTEX_OP_ANDN implementation
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit 26701574cee6777f867f89b4a5c667817e1ee0dd upstream.
The futex operation FUTEX_OP_ANDN is supposed to implement
*(int *)UADDR2 &= ~OPARG;
The s390 implementation just implements an AND instead of ANDN. Add the missing bitwise not operation to oparg to fix this.
This is broken since nearly 19 years, so it looks like user space is not making use of this operation.
--- arch/s390/include/asm/futex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/futex.h +1 -1
@@ -45,7 +45,7 @@ static inline int arch_futex_atomic_op_ibreak ;case FUTEX_OP_ANDN :__futex_atomic_op ("lr %2,%1\nnr %2,%5\n" , - ret, oldval, newval, uaddr, oparg); + ret, oldval, newval, uaddr, ~oparg);break ;case FUTEX_OP_XOR : __futex_atomic_op("lr %2,%1\nxr %2,%5\n",
Greg Kroah-Hartman
maintainerPATCH 167/462 m68k: vga: Fix I/O defines
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 53036937a101b5faeaf98e7438555fa854a1a844 upstream.
Including m68k's <asm/raw_io.h> in vga.h on nommu platforms results in conflicting defines with io_no.h for various I/O macros from the __raw_read and __raw_write families. An example error is
In file included from arch/m68k/include/asm/vga.h:12,
from include/video/vga.h:22, from include/linux/vgaarb.h:34, from drivers/video/aperture.c:12:
Quoted 1 line
Quoted 1 line
arch/m68k/include/asm/raw_io.h:39: warning: "__raw_readb" redefined
39 | #define __raw_readb in_8
|
In file included from arch/m68k/include/asm/io.h:6,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:17,
from ./arch/m68k/include/generated/asm/hardirq.h:1,
from include/linux/hardirq.h:11,
from include/linux/interrupt.h:11,
from include/linux/trace_recursion.h:5,
from include/linux/ftrace.h:10,
from include/linux/kprobes.h:28,
from include/linux/kgdb.h:19,
from include/linux/fb.h:6,
from drivers/video/aperture.c:5:
arch/m68k/include/asm/io_no.h:16: note: this is the location of the previous definition
16 | #define __raw_readb(addr) \
|Include <asm/io.h>, which avoids raw_io.h on nommu platforms. Also change the defined values of some of the read/write symbols in vga.h to __raw_read/__raw_write as the raw_in/raw_out symbols are not generally available.
--- arch/m68k/include/asm/vga.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/m68k/include/asm/vga.h +4 -4
@@ -9,7 +9,7 @@*/ #ifndef CONFIG_PCI -#include <asm/raw_io.h> +#include <asm/io.h> #include <asm/kmap.h> /*
@@ -29,9 +29,9 @@#define inw_p (port) 0#define outb_p (port, val) do { } while (0)#define outw (port, val) do { } while (0) -#define readb raw_inb -#define writeb raw_outb -#define writew raw_outw +#define readb __raw_readb +#define writeb __raw_writeb +#define writew __raw_writew#endif /* CONFIG_PCI */ #endif /* _ASM_M68K_VGA_H */
Greg Kroah-Hartman
maintainerPATCH 168/462 binfmt_flat: Fix integer overflow bug on 32 bit systems
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 55cf2f4b945f6a6416cc2524ba740b83cc9af25a upstream.
Most of these sizes and counts are capped at 256MB so the math doesn't result in an integer overflow. The "relocs" count needs to be checked as well. Otherwise on 32bit systems the calculation of "full_data" could be wrong.
full_data = data_len + relocs * sizeof(unsigned long);
--- fs/binfmt_flat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/binfmt_flat.c +1 -1
@@ -534,7 +534,7 @@ static int load_flat_file(struct linux_b* 28 bits (256 MB) is way more than reasonable in this case. * If some top bits are set we have probable binary corruption. */ -if ((text_len | data_len | bss_len | stack_len | full_data) >>28 ) { +if ((text_len | data_len | bss_len | stack_len | relocs | full_data) >>28 ) {pr_err ("bad header\n" ); ret = -ENOEXEC ; goto err;
Greg Kroah-Hartman
maintainerPATCH 169/462 arm64: dts: rockchip: increase gmac rx_delay on rk3399-puma
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakob Unterwurzacher <[email protected]>
commit 9d241b06802c6c2176ae7aa4f9f17f8a577ed337 upstream.
During mass manufacturing, we noticed the mmc_rx_crc_error counter, as reported by "ethtool -S eth0 | grep mmc_rx_crc_error", to increase above zero during nuttcp speedtests. Most of the time, this did not affect the achieved speed, but it prompted this investigation.
Cycling through the rx_delay range on six boards (see table below) of various ages shows that there is a large good region from 0x12 to 0x35 where we see zero crc errors on all tested boards.
The old rx_delay value (0x10) seems to have always been on the edge for the KSZ9031RNX that is usually placed on Puma.
Choose "rx_delay = 0x23" to put us smack in the middle of the good region. This works fine as well with the KSZ9131RNX PHY that was used for a small number of boards during the COVID chip shortages.
Board S/N PHY rx_delay good region --------- --- -------------------- Puma TT0069903 KSZ9031RNX 0x11 0x35 Puma TT0157733 KSZ9031RNX 0x11 0x35 Puma TT0681551 KSZ9031RNX 0x12 0x37 Puma TT0681156 KSZ9031RNX 0x10 0x38 Puma 17496030079 KSZ9031RNX 0x10 0x37 (Puma v1.2 from 2017) Puma TT0681720 KSZ9131RNX 0x02 0x39 (alternative PHY used in very few boards) Intersection of good regions = 0x12 0x35 Middle of good region = 0x23
--- arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi +1 -1
@@ -176,7 +176,7 @@ snps,reset-active-low; snps,reset-delays-us = <0 10000 50000>; tx_delay = <0x10>; - rx_delay = <0x10>; + rx_delay = <0x23>; status = "okay"; };
Greg Kroah-Hartman
maintainerPATCH 170/462 KVM: Explicitly verify target vCPU is online in kvm_get_vcpu()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 1e7381f3617d14b3c11da80ff5f8a93ab14cfc46 upstream.
Explicitly verify the target vCPU is fully online _prior_ to clamping the index in kvm_get_vcpu(). If the index is "bad", the nospec clamping will generate '0', i.e. KVM will return vCPU0 instead of NULL.
In practice, the bug is unlikely to cause problems, as it will only come into play if userspace or the guest is buggy or misbehaving, e.g. KVM may send interrupts to vCPU0 instead of dropping them on the floor.
However, returning vCPU0 when it shouldn't exist per online_vcpus is problematic now that KVM uses an xarray for the vCPUs array, as KVM needs to insert into the xarray before publishing the vCPU to userspace (see commit c5b077549136 ("KVM: Convert the kvm->vcpus array to a xarray")), i.e. before vCPU creation is guaranteed to succeed.
As a result, incorrectly providing access to vCPU0 will trigger a use-after-free if vCPU0 is dereferenced and kvm_vm_ioctl_create_vcpu() bails out of vCPU creation due to an error and frees vCPU0. Commit afb2acb2e3a3 ("KVM: Fix vcpu_array[0] races") papered over that issue, but in doing so introduced an unsolvable teardown conundrum. Preventing accesses to vCPU0 before it's fully online will allow reverting commit afb2acb2e3a3, without re-introducing the vcpu_array[0] UAF race.
--- include/linux/kvm_host.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/linux/kvm_host.h +9 -0
@@ -575,6 +575,15 @@ static inline struct kvm_io_bus *kvm_getstatic inline struct kvm_vcpu *kvm_get_vcpu (struct kvm *kvm,int i) {int num_vcpus =atomic_read (&kvm->online_vcpus); + +/* +* Explicitly verify the target vCPU is online, as the anti-speculation +* logic only limits the CPU's ability to speculate, e.g. given a "bad" +* index, clamping the index to 0 would return vCPU0, not NULL. +*/ +if (i >= num_vcpus) +return NULL ; + i =array_index_nospec (i, num_vcpus);/* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu. */
Greg Kroah-Hartman
maintainerPATCH 171/462 KVM: s390: vsie: fix some corner-cases when grabbing vsie pages
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 5f230f41fdd9e799f43a699348dc572bca7159aa upstream.
We try to reuse the same vsie page when re-executing the vsie with a given SCB address. The result is that we use the same shadow SCB -- residing in the vsie page -- and can avoid flushing the TLB when re-running the vsie on a CPU.
So, when we allocate a fresh vsie page, or when we reuse a vsie page for a different SCB address -- reusing the shadow SCB in different context -- we set ihcpu=0xffff to trigger the flush.
However, after we looked up the SCB address in the radix tree, but before we grabbed the vsie page by raising the refcount to 2, someone could reuse the vsie page for a different SCB address, adjusting page->index and the radix tree. In that case, we would be reusing the vsie page with a wrong page->index.
Another corner case is that we might set the SCB address for a vsie page, but fail the insertion into the radix tree. Whoever would reuse that page would remove the corresponding radix tree entry -- which might now be a valid entry pointing at another page, resulting in the wrong vsie page getting removed from the radix tree.
Let's handle such races better, by validating that the SCB address of a vsie page didn't change after we grabbed it (not reuse for a different SCB; the alternative would be performing another tree lookup), and by setting the SCB address to invalid until the insertion in the tree succeeded (SCB addresses are aligned to 512, so ULONG_MAX is invalid).
These scenarios are rare, the effects a bit unclear, and these issues were only found by code inspection. Let's CC stable to be safe.
Message-ID: <[email protected]>
--- arch/s390/kvm/vsie.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
arch/s390/kvm/vsie.c +19 -6
@@ -1316,8 +1316,14 @@ static struct vsie_page *get_vsie_page(s page =radix_tree_lookup (&kvm->arch.vsie.addr_to_page, addr >>9 );rcu_read_unlock ();if (page) { -if (page_ref_inc_return (page) ==2 ) -return page_to_virt (page); +if (page_ref_inc_return (page) ==2 ) { +if (page->index == addr) +return page_to_virt (page); +/* +* We raced with someone reusing + putting this vsie +* page before we grabbed it. +*/ + }page_ref_dec (page); }
@@ -1347,15 +1353,20 @@ static struct vsie_page *get_vsie_page(s kvm->arch.vsie.next++; kvm->arch.vsie.next %= nr_vcpus; } -radix_tree_delete (&kvm->arch.vsie.addr_to_page, page->index >>9 ); +if (page->index !=ULONG_MAX ) +radix_tree_delete (&kvm->arch.vsie.addr_to_page, + page->index >>9 ); } - page->index = addr; -/* double use of the same address */ +/* Mark it as invalid until it resides in the tree. */ + page->index =ULONG_MAX ; + +/* Double use of the same address or allocation failure. */ if (radix_tree_insert (&kvm->arch.vsie.addr_to_page, addr >>9 , page)) {page_ref_dec (page);mutex_unlock (&kvm->arch.vsie.mutex);return NULL ; } + page->index = addr;mutex_unlock (&kvm->arch.vsie.mutex); vsie_page =page_to_virt (page);
@@ -1448,7 +1459,9 @@ void kvm_s390_vsie_destroy(struct kvm *k vsie_page =page_to_virt (page);release_gmap_shadow (vsie_page);/* free the radix tree entry */ -radix_tree_delete (&kvm->arch.vsie.addr_to_page, page->index >>9 ); +if (page->index !=ULONG_MAX ) +radix_tree_delete (&kvm->arch.vsie.addr_to_page, + page->index >>9 );__free_page (page); } kvm->arch.vsie.page_count =0 ;
Greg Kroah-Hartman
maintainerPATCH 172/462 drm/komeda: Add check for komeda_get_layer_fourcc_list()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
commit 79fc672a092d93a7eac24fe20a571d4efd8fa5a4 upstream.
Add check for the return value of komeda_get_layer_fourcc_list() to catch the potential exception.
--- drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c +4 -0
@@ -160,6 +160,10 @@ static int komeda_wb_connector_add(struc formats =komeda_get_layer_fourcc_list (&mdev->fmt_tbl, kwb_conn->wb_layer->layer_type, &n_formats); +if (!formats) { +kfree (kwb_conn); +return -ENOMEM ; + } err = drm_writeback_connector_init(&kms->base, wb_conn, &komeda_wb_connector_funcs,
Greg Kroah-Hartman
maintainerPATCH 173/462 Bluetooth: L2CAP: handle NULL sock pointer in l2cap_sock_alloc
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 5f397409f8ee5bc82901eeaf799e1cbc4f8edcf1 upstream.
A NULL sock pointer is passed into l2cap_sock_alloc() when it is called from l2cap_sock_new_connection_cb() and the error handling paths should also be aware of it.
Seemingly a more elegant solution would be to swap bt_sock_alloc() and l2cap_chan_create() calls since they are not interdependent to that moment but then l2cap_chan_create() adds the soon to be deallocated and still dummy-initialized channel to the global list accessible by many L2CAP paths. The channel would be removed from the list in short period of time but be a bit more straight-forward here and just check for NULL instead of changing the order of function calls.
Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool.
--- net/bluetooth/l2cap_sock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_sock.c +2 -1
@@ -1864,7 +1864,8 @@ static struct sock *l2cap_sock_alloc(str chan =l2cap_chan_create ();if (!chan) {sk_free (sk); - sock->sk =NULL ; +if (sock) + sock->sk =NULL ;return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 174/462 Bluetooth: L2CAP: accept zero as a special value for MTU auto-selection
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 5c61419e02033eaf01733d66e2fcd4044808f482 upstream.
One of the possible ways to enable the input MTU auto-selection for L2CAP connections is supposed to be through passing a special "0" value for it as a socket option. Commit [1] added one of those into avdtp. However, it simply wouldn't work because the kernel still treats the specified value as invalid and denies the setting attempt. Recorded BlueZ logs include the following:
bluetoothd[496]: profiles/audio/avdtp.c:l2cap_connect() setsockopt(L2CAP_OPTIONS): Invalid argument (22)
[1]: https://github.com/bluez/bluez/commit/ae5be371a9f53fed33d2b34748a95a5498fd4b77
Found by Linux Verification Center (linuxtesting.org).
--- net/bluetooth/l2cap_sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/l2cap_sock.c +2 -2
@@ -727,12 +727,12 @@ static bool l2cap_valid_mtu(struct l2cap {switch (chan->scid) {case L2CAP_CID_ATT : -if (mtu <L2CAP_LE_MIN_MTU ) +if (mtu && mtu <L2CAP_LE_MIN_MTU )return false;break ;default : -if (mtu <L2CAP_DEFAULT_MIN_MTU ) +if (mtu && mtu <L2CAP_DEFAULT_MIN_MTU )return false; }
Greg Kroah-Hartman
maintainerPATCH 175/462 clk: sunxi-ng: a100: enable MMC clock reparenting
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cody Eksal <[email protected]>
commit 16414720045de30945b8d14b7907e0cbf81a4b49 upstream.
While testing the MMC nodes proposed in [1], it was noted that mmc0/1 would fail to initialize, with "mmc: fatal err update clk timeout" in the kernel logs. A closer look at the clock definitions showed that the MMC MPs had the "CLK_SET_RATE_NO_REPARENT" flag set. No reason was given for adding this flag in the first place, and its original purpose is unknown, but it doesn't seem to make sense and results in severe limitations to MMC speeds. Thus, remove this flag from the 3 MMC MPs.
[1] https://msgid.link/[email protected]
--- drivers/clk/sunxi-ng/ccu-sun50i-a100.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/sunxi-ng/ccu-sun50i-a100.c +3 -3
@@ -437,7 +437,7 @@ static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDI24 ,2 ,/* mux */ BIT (31 ),/* gate */ 2 ,/* post-div */ - CLK_SET_RATE_NO_REPARENT); + 0); static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc1_clk, "mmc1", mmc_parents, 0x834, 0, 4, /* M */
@@ -445,7 +445,7 @@ static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDI24 ,2 ,/* mux */ BIT (31 ),/* gate */ 2 ,/* post-div */ - CLK_SET_RATE_NO_REPARENT); + 0); static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc2_clk, "mmc2", mmc_parents, 0x838, 0, 4, /* M */
@@ -453,7 +453,7 @@ static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDI24 ,2 ,/* mux */ BIT (31 ),/* gate */ 2 ,/* post-div */ - CLK_SET_RATE_NO_REPARENT); + 0); static SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb3", 0x84c, BIT(0), 0); static SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb3", 0x84c, BIT(1), 0);
Greg Kroah-Hartman
maintainerPATCH 176/462 clk: qcom: clk-alpha-pll: fix alpha mode configuration
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
commit 33f1722eb86e45320a3dd7b3d42f6593a1d595c2 upstream.
Commit c45ae598fc16 ("clk: qcom: support for alpha mode configuration") added support for configuring alpha mode, but it seems that the feature was never working in practice.
The value of the alpha_{en,mode}_mask members of the configuration gets added to the value parameter passed to the regmap_update_bits() function, however the same values are not getting applied to the bitmask. As the result, the respective bits in the USER_CTL register are never modifed which leads to improper configuration of several PLLs.
The following table shows the PLL configurations where the 'alpha_en_mask' member is set and which are passed as a parameter for the clk_alpha_pll_configure() function. In the table the 'expected rate' column shows the rate the PLL should run at with the given configuration, and the 'real rate' column shows the rate the PLL runs at actually. The real rates has been verified on hardwareOn IPQ* platforms, on other platforms, those are computed values only.
file pll expected rate real rate dispcc-qcm2290.c disp_cc_pll0 768.0 MHz 768.0 MHz dispcc-sm6115.c disp_cc_pll0 768.0 MHz 768.0 MHz gcc-ipq5018.c ubi32_pll 1000.0 MHz != 984.0 MHz gcc-ipq6018.c nss_crypto_pll 1200.0 MHz 1200.0 MHz gcc-ipq6018.c ubi32_pll 1497.6 MHz != 1488.0 MHz gcc-ipq8074.c nss_crypto_pll 1200.0 MHz != 1190.4 MHz gcc-qcm2290.c gpll11 532.0 MHz != 518.4 MHz gcc-qcm2290.c gpll8 533.2 MHz != 518.4 MHz gcc-qcs404.c gpll3 921.6 MHz 921.6 MHz gcc-sm6115.c gpll11 600.0 MHz != 595.2 MHz gcc-sm6115.c gpll8 800.0 MHz != 787.2 MHz gpucc-sdm660.c gpu_cc_pll0 800.0 MHz != 787.2 MHz gpucc-sdm660.c gpu_cc_pll1 740.0 MHz != 729.6 MHz gpucc-sm6115.c gpu_cc_pll0 1200.0 MHz != 1190.4 MHz gpucc-sm6115.c gpu_cc_pll1 640.0 MHz != 633.6 MHz gpucc-sm6125.c gpu_pll0 1020.0 MHz != 1017.6 MHz gpucc-sm6125.c gpu_pll1 930.0 MHz != 921.6 MHz mmcc-sdm660.c mmpll8 930.0 MHz != 921.6 MHz mmcc-sdm660.c mmpll5 825.0 MHz != 806.4 MHz
As it can be seen from the above, there are several PLLs which are configured incorrectly.
Change the code to apply both 'alpha_en_mask' and 'alpha_mode_mask' values to the bitmask in order to configure the alpha mode correctly.
Applying the 'alpha_en_mask' fixes the initial rate of the PLLs showed in the table above. Since the 'alpha_mode_mask' is not used by any driver currently, that part of the change causes no functional changes.
--- drivers/clk/qcom/clk-alpha-pll.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/qcom/clk-alpha-pll.c +2 -0
@@ -240,6 +240,8 @@ void clk_alpha_pll_configure(struct clk_ mask |= config->pre_div_mask; mask |= config->post_div_mask; mask |= config->vco_mask; + mask |= config->alpha_en_mask; + mask |= config->alpha_mode_mask;regmap_update_bits (regmap,PLL_USER_CTL (pll), mask, val);
Greg Kroah-Hartman
maintainerPATCH 177/462 clk: qcom: clk-rpmh: prevent integer overflow in recalc_rate
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anastasia Belova <[email protected]>
commit 89aa5925d201b90a48416784831916ca203658f9 upstream.
aggr_state and unit fields are u32. The result of their multiplication may not fit in this type.
Add explicit casting to prevent overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/clk/qcom/clk-rpmh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/clk-rpmh.c +1 -1
@@ -331,7 +331,7 @@ static unsigned long clk_rpmh_bcm_recalc {struct clk_rpmh *c =to_clk_rpmh (hw); -return c->aggr_state * c->unit; +return (unsigned long )c->aggr_state * c->unit; }static const struct clk_ops clk_rpmh_bcm_ops = {
Greg Kroah-Hartman
maintainerPATCH 178/462 blk-cgroup: Fix class @block_classs subsystem refcount leakage
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit d1248436cbef1f924c04255367ff4845ccd9025e upstream.
blkcg_fill_root_iostats() iterates over @block_class's devices by class_dev_iter_(init|next)(), but does not end iterating with class_dev_iter_exit(), so causes the class's subsystem refcount leakage.
Fix by ending the iterating with class_dev_iter_exit().
--- block/blk-cgroup.c | 1 + 1 file changed, 1 insertion(+)
block/blk-cgroup.c +1 -0
@@ -851,6 +851,7 @@ static void blkcg_fill_root_iostats(void }disk_put_part (part); } +class_dev_iter_exit (&iter); }static int blkcg_print_stat (struct seq_file *sf,void *v)
Greg Kroah-Hartman
maintainerPATCH 179/462 efi: libstub: Use -std=gnu11 to fix build with GCC 15
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 8ba14d9f490aef9fd535c04e9e62e1169eb7a055 upstream.
GCC 15 changed the default C standard version to C23, which should not have impacted the kernel because it requests the gnu11 standard via '-std=' in the main Makefile. However, the EFI libstub Makefile uses its own set of KBUILD_CFLAGS for x86 without a '-std=' value (i.e., using the default), resulting in errors from the kernel's definitions of bool, true, and false in stddef.h, which are reserved keywords under C23.
./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
11 | false = 0,
./include/linux/types.h:35:33: error: two or more data types in declaration specifiers
35 | typedef _Bool bool;
Set '-std=gnu11' in the x86 cflags to resolve the error and consistently use the same C standard version for the entire kernel. All other architectures reuse KBUILD_CFLAGS from the rest of the kernel, so this issue is not visible for them.
--- drivers/firmware/efi/libstub/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/libstub/Makefile +1 -1
@@ -7,7 +7,7 @@ # cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small -cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \ +cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -std=gnu11 \ -fPIC -fno-strict-aliasing -mno-red-zone \ -mno-mmx -mno-sse -fshort-wchar \ -Wno-pointer-sign \
Greg Kroah-Hartman
maintainerPATCH 180/462 perf bench: Fix undefined behavior in cmpworker()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
commit 62892e77b8a64b9dc0e1da75980aa145347b6820 upstream.
The comparison function cmpworker() violates the C standard's requirements for qsort() comparison functions, which mandate symmetry and transitivity:
Symmetry: If x < y, then y > x.
Transitivity: If x < y and y < z, then x < z.
In its current implementation, cmpworker() incorrectly returns 0 when w1->tid < w2->tid, which breaks both symmetry and transitivity. This violation causes undefined behavior, potentially leading to issues such as memory corruption in glibc [1].
Fix the issue by returning -1 when w1->tid < w2->tid, ensuring compliance with the C standard and preventing undefined behavior.
--- tools/perf/bench/epoll-wait.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/bench/epoll-wait.c +6 -1
@@ -407,7 +407,12 @@ static int cmpworker(const void *p1, construct worker *w1 = (struct worker *) p1;struct worker *w2 = (struct worker *) p2; -return w1->tid > w2->tid; + +if (w1->tid > w2->tid) +return 1 ; +if (w1->tid < w2->tid) +return -1 ; +return 0 ; }int bench_epoll_wait (int argc,const char **argv)
Greg Kroah-Hartman
maintainerPATCH 181/462 of: Correct child specifier used as input of the 2nd nexus node
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit e4c00c9b1f70cd11792ff5b825899a6ee0234a62 upstream.
API of_parse_phandle_with_args_map() will use wrong input for nexus node Nexus_2 as shown below:
Node_1 Nexus_1 Nexus_2
&Nexus_1,arg_1 -> arg_1,&Nexus_2,arg_2' -> &Nexus_2,arg_2 -> arg_2,...
map-pass-thru=<...>
Nexus_1's output arg_2 should be used as input of Nexus_2, but the API wrongly uses arg_2' instead which != arg_2 due to Nexus_1's map-pass-thru.
Fix by always making @match_array point to @initial_match_array into which to store nexus output.
--- drivers/of/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/base.c +1 -1
@@ -1659,7 +1659,6 @@ int of_parse_phandle_with_args_map(const* specifier into the out_args structure, keeping the * bits specified in <list>-map-pass-thru. */ - match_array = map - new_size;for (i =0 ; i < new_size; i++) {__be32 val = *(map - new_size + i);
@@ -1668,6 +1667,7 @@ int of_parse_phandle_with_args_map(const val |=cpu_to_be32 (out_args->args[i]) & pass[i]; } + initial_match_array[i] = val; out_args->args[i] =be32_to_cpu (val); } out_args->args_count = list_size = new_size;
Greg Kroah-Hartman
maintainerPATCH 182/462 of: Fix of_find_node_opts_by_path() handling of alias+path+options
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit b9e58c934c56aa35b0fb436d9afd86ef326bae0e upstream.
of_find_node_opts_by_path() fails to find OF device node when its @path parameter have pattern below:
"alias-name/node-name-1/.../node-name-N:options".
The reason is that alias name length calculated by the API is wrong, as explained by example below:
"testcase-alias/phandle-tests/consumer-a:testaliasoption".
^ ^ ^ 0 14 39
The right length of alias 'testcase-alias' is 14, but the result worked out by the API is 39 which is obvious wrong.
Fix by using index of either '/' or ':' as the length who comes earlier.
--- drivers/of/base.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/of/base.c +3 -3
@@ -926,10 +926,10 @@ struct device_node *of_find_node_opts_by/* The path could begin with an alias */ if (*path !='/' ) {int len; -const char *p = separator; +const char *p =strchrnul (path,'/' ); -if (!p) - p =strchrnul (path,'/' ); +if (separator && separator < p) + p = separator; len = p - path;/* of_aliases must not be NULL */
Greg Kroah-Hartman
maintainerPATCH 183/462 of: reserved-memory: Fix using wrong number of cells to get property alignment
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 267b21d0bef8e67dbe6c591c9991444e58237ec9 upstream.
According to DT spec, size of property 'alignment' is based on parent node’s #size-cells property.
But __reserved_mem_alloc_size() wrongly uses @dt_root_addr_cells to get the property obviously.
Fix by using @dt_root_size_cells instead of @dt_root_addr_cells.
--- drivers/of/of_reserved_mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/of/of_reserved_mem.c +2 -2
@@ -94,12 +94,12 @@ static int __init __reserved_mem_alloc_s prop =of_get_flat_dt_prop (node,"alignment" , &len);if (prop) { -if (len != dt_root_addr_cells *sizeof (__be32)) { +if (len != dt_root_size_cells *sizeof (__be32)) {pr_err ("invalid alignment property in '%s' node.\n" , uname);return -EINVAL ; } - align =dt_mem_next_cell (dt_root_addr_cells, &prop); + align =dt_mem_next_cell (dt_root_size_cells, &prop); } nomap =of_get_flat_dt_prop (node,"no-map" ,NULL ) !=NULL ;
Greg Kroah-Hartman
maintainerPATCH 184/462 HID: hid-sensor-hub: dont use stale platform-data on remove
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
commit 8a5b38c3fd709e8acd2bfdedf66c25e6af759576 upstream.
The hid-sensor-hub creates the individual device structs and transfers them to the created mfd platform-devices via the platform_data in the mfd_cell.
Before e651a1da442a ("HID: hid-sensor-hub: Allow parallel synchronous reads") the sensor-hub was managing access centrally, with one "completion" in the hub's data structure, which needed to be finished on removal at the latest.
The mentioned commit then moved this central management to each hid sensor device, resulting on a completion in each struct hid_sensor_hub_device. The remove procedure was adapted to go through all sensor devices and finish any pending "completion".
What this didn't take into account was, platform_device_add_data() that is used by mfd_add{_hotplug}_devices() does a kmemdup on the submitted platform-data. So the data the platform-device gets is a copy of the original data, meaning that the device worked on a different completion than what sensor_hub_remove() currently wants to access.
To fix that, use device_for_each_child() to go through each child-device similar to how mfd_remove_devices() unregisters the devices later and with that get the live platform_data to finalize the correct completion.
--- drivers/hid/hid-sensor-hub.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/hid/hid-sensor-hub.c +14 -7
@@ -730,23 +730,30 @@ err_stop_hw:return ret; } +static int sensor_hub_finalize_pending_fn (struct device *dev,void *data) +{ +struct hid_sensor_hub_device *hsdev = dev->platform_data; + +if (hsdev->pending.status) +complete (&hsdev->pending.ready); + +return 0 ; +} +static void sensor_hub_remove (struct hid_device *hdev) {struct sensor_hub_data *data =hid_get_drvdata (hdev);unsigned long flags; -int i;hid_dbg (hdev," hardware removed\n" );hid_hw_close (hdev);hid_hw_stop (hdev); +spin_lock_irqsave (&data->lock, flags); -for (i =0 ; i < data->hid_sensor_client_cnt; ++i) { -struct hid_sensor_hub_device *hsdev = - data->hid_sensor_hub_client_devs[i].platform_data; -if (hsdev->pending.status) -complete (&hsdev->pending.ready); - } +device_for_each_child (&hdev->dev,NULL , + sensor_hub_finalize_pending_fn);spin_unlock_irqrestore (&data->lock, flags); +mfd_remove_devices (&hdev->dev);mutex_destroy (&data->mutex); }
Greg Kroah-Hartman
maintainerPATCH 185/462 wifi: rtlwifi: rtl8821ae: Fix media status report
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
commit 66ef0289ac99e155d206ddaa0fdfad09ae3cd007 upstream.
RTL8821AE is stuck transmitting at the lowest rate allowed by the rate mask. This is because the firmware doesn't know the device is connected to a network.
Fix the macros SET_H2CCMD_MSRRPT_PARM_OPMODE and SET_H2CCMD_MSRRPT_PARM_MACID_IND to work on the first byte of __cmd, not the second. Now the firmware is correctly notified when the device is connected to a network and it activates the rate control.
Before (MCS3):
[ 5] 0.00-1.00 sec 12.5 MBytes 105 Mbits/sec 0 339 KBytes [ 5] 1.00-2.00 sec 10.6 MBytes 89.1 Mbits/sec 0 339 KBytes [ 5] 2.00-3.00 sec 10.6 MBytes 89.1 Mbits/sec 0 386 KBytes [ 5] 3.00-4.00 sec 10.6 MBytes 89.1 Mbits/sec 0 386 KBytes [ 5] 4.00-5.00 sec 10.2 MBytes 86.0 Mbits/sec 0 427 KBytes
After (MCS9):
[ 5] 0.00-1.00 sec 33.9 MBytes 284 Mbits/sec 0 771 KBytes [ 5] 1.00-2.00 sec 31.6 MBytes 265 Mbits/sec 0 865 KBytes [ 5] 2.00-3.00 sec 29.9 MBytes 251 Mbits/sec 0 963 KBytes [ 5] 3.00-4.00 sec 28.2 MBytes 237 Mbits/sec 0 963 KBytes [ 5] 4.00-5.00 sec 26.8 MBytes 224 Mbits/sec 0 963 KBytes
--- drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h +2 -2
@@ -197,9 +197,9 @@ enum rtl8821a_h2c_cmd {/* _MEDIA_STATUS_RPT_PARM_CMD1 */ #define SET_H2CCMD_MSRRPT_PARM_OPMODE (__cmd, __value) \ - u8p_replace_bits(__cmd + 1, __value, BIT(0)) + u8p_replace_bits(__cmd, __value, BIT(0))#define SET_H2CCMD_MSRRPT_PARM_MACID_IND (__cmd, __value) \ - u8p_replace_bits(__cmd + 1, __value, BIT(1)) + u8p_replace_bits(__cmd, __value, BIT(1))/* AP_OFFLOAD */ #define SET_H2CCMD_AP_OFFLOAD_ON (__cmd, __value) \
Greg Kroah-Hartman
maintainerPATCH 186/462 wifi: brcmfmac: fix NULL pointer dereference in brcmf_txfinalize()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Hamer <[email protected]>
commit 68abd0c4ebf24cd499841a488b97a6873d5efabb upstream.
On removal of the device or unloading of the kernel module a potential NULL pointer dereference occurs.
The following sequence deletes the interface:
brcmf_detach()
brcmf_remove_interface()
brcmf_del_if()Inside the brcmf_del_if() function the drvr->if2bss[ifidx] is updated to BRCMF_BSSIDX_INVALID (-1) if the bsscfgidx matches.
After brcmf_remove_interface() call the brcmf_proto_detach() function is called providing the following sequence:
brcmf_detach()
brcmf_proto_detach()
brcmf_proto_msgbuf_detach()
brcmf_flowring_detach()
brcmf_msgbuf_delete_flowring()
brcmf_msgbuf_remove_flowring()
brcmf_flowring_delete()
brcmf_get_ifp()
brcmf_txfinalize()Since brcmf_get_ip() can and actually will return NULL in this case the call to brcmf_txfinalize() will result in a NULL pointer dereference inside brcmf_txfinalize() when trying to update ifp->ndev->stats.tx_errors.
This will only happen if a flowring still has an skb.
Although the NULL pointer dereference has only been seen when trying to update the tx statistic, all other uses of the ifp pointer have been guarded as well with an early return if ifp is NULL.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +5 -0
@@ -545,6 +545,11 @@ void brcmf_txfinalize(struct brcmf_if *istruct ethhdr *eh;u16 type; +if (!ifp) { +brcmu_pkt_buf_free_skb (txp); +return ; + } + eh = (struct ethhdr *)(txp->data); type =ntohs (eh->h_proto);
Greg Kroah-Hartman
maintainerPATCH 187/462 usb: gadget: f_tcm: Translate error to sense
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 98fa00fd3ae43b857b4976984a135483d89d9281 upstream.
When respond with check_condition error status, clear from_transport input so the target layer can translate the sense reason reported by f_tcm.
--- drivers/usb/gadget/function/f_tcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_tcm.c +2 -2
@@ -1067,7 +1067,7 @@ static void usbg_cmd_work(struct work_st out:transport_send_check_condition_and_sense (se_cmd, -TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); +TCM_UNSUPPORTED_SCSI_OPCODE ,0 ); } static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu,
@@ -1197,7 +1197,7 @@ static void bot_cmd_work(struct work_str out:transport_send_check_condition_and_sense (se_cmd, -TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); +TCM_UNSUPPORTED_SCSI_OPCODE ,0 ); } static int bot_submit_command(struct f_uas *fu,
Greg Kroah-Hartman
maintainerPATCH 188/462 usb: gadget: f_tcm: Decrement command ref count on cleanup
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 3b2a52e88ab0c9469eaadd4d4c8f57d072477820 upstream.
We submitted the command with TARGET_SCF_ACK_KREF, which requires acknowledgment of command completion. If the command fails, make sure to decrement the ref count.
--- drivers/usb/gadget/function/f_tcm.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/function/f_tcm.c +1 -0
@@ -973,6 +973,7 @@ static void usbg_data_write_cmpl(structreturn ; cleanup: +target_put_sess_cmd (se_cmd);transport_generic_free_cmd (&cmd->se_cmd,0 ); }
Greg Kroah-Hartman
maintainerPATCH 189/462 usb: gadget: f_tcm: ep_autoconfig with fullspeed endpoint
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 25224c1f07d31c261d04dfbc705a7a0f314a825d upstream.
Match usb endpoint using fullspeed endpoint descriptor to make sure the wMaxPacketSize for fullspeed descriptors is automatically configured.
--- drivers/usb/gadget/function/f_tcm.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
drivers/usb/gadget/function/f_tcm.c +13 -17
@@ -2021,43 +2021,39 @@ static int tcm_bind(struct usb_configura bot_intf_desc.bInterfaceNumber = iface; uasp_intf_desc.bInterfaceNumber = iface; fu->iface = iface; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_bi_desc, - &uasp_bi_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_bi_desc);if (!ep) goto ep_fail; fu->ep_in = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_bo_desc, - &uasp_bo_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_bo_desc);if (!ep) goto ep_fail; fu->ep_out = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_status_desc, - &uasp_status_in_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_status_desc);if (!ep) goto ep_fail; fu->ep_status = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_cmd_desc, - &uasp_cmd_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_cmd_desc);if (!ep) goto ep_fail; fu->ep_cmd = ep;/* Assume endpoint addresses are the same for both speeds */ - uasp_bi_desc.bEndpointAddress = uasp_ss_bi_desc.bEndpointAddress; - uasp_bo_desc.bEndpointAddress = uasp_ss_bo_desc.bEndpointAddress; + uasp_bi_desc.bEndpointAddress = uasp_fs_bi_desc.bEndpointAddress; + uasp_bo_desc.bEndpointAddress = uasp_fs_bo_desc.bEndpointAddress; uasp_status_desc.bEndpointAddress = - uasp_ss_status_desc.bEndpointAddress; - uasp_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; + uasp_fs_status_desc.bEndpointAddress; + uasp_cmd_desc.bEndpointAddress = uasp_fs_cmd_desc.bEndpointAddress; - uasp_fs_bi_desc.bEndpointAddress = uasp_ss_bi_desc.bEndpointAddress; - uasp_fs_bo_desc.bEndpointAddress = uasp_ss_bo_desc.bEndpointAddress; - uasp_fs_status_desc.bEndpointAddress = - uasp_ss_status_desc.bEndpointAddress; - uasp_fs_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; + uasp_ss_bi_desc.bEndpointAddress = uasp_fs_bi_desc.bEndpointAddress; + uasp_ss_bo_desc.bEndpointAddress = uasp_fs_bo_desc.bEndpointAddress; + uasp_ss_status_desc.bEndpointAddress = + uasp_fs_status_desc.bEndpointAddress; + uasp_ss_cmd_desc.bEndpointAddress = uasp_fs_cmd_desc.bEndpointAddress; ret = usb_assign_descriptors(f, uasp_fs_function_desc, uasp_hs_function_desc, uasp_ss_function_desc,
Greg Kroah-Hartman
maintainerPATCH 190/462 usb: gadget: f_tcm: Dont prepare BOT write request twice
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 94d9bf671ae314cacc2d7bf96bd233b4abc7cede upstream.
The duplicate kmalloc here is causing memory leak. The request preparation in bot_send_write_request is also done in usbg_prepare_w_request. Remove the duplicate work.
--- drivers/usb/gadget/function/f_tcm.c | 17 ----------------- 1 file changed, 17 deletions(-)
drivers/usb/gadget/function/f_tcm.c +0 -17
@@ -245,7 +245,6 @@ static int bot_send_write_request(struct {struct f_uas *fu = cmd->fu;struct se_cmd *se_cmd = &cmd->se_cmd; -struct usb_gadget *gadget =fuas_to_gadget (fu);int ret;init_completion (&cmd->write_complete);
@@ -256,22 +255,6 @@ static int bot_send_write_request(structreturn -EINVAL ; } -if (!gadget->sg_supported) { - cmd->data_buf =kmalloc (se_cmd->data_length,GFP_KERNEL ); -if (!cmd->data_buf) -return -ENOMEM ; - - fu->bot_req_out->buf = cmd->data_buf; - }else { - fu->bot_req_out->buf =NULL ; - fu->bot_req_out->num_sgs = se_cmd->t_data_nents; - fu->bot_req_out->sg = se_cmd->t_data_sg; - } - - fu->bot_req_out->complete = usbg_data_write_cmpl; - fu->bot_req_out->length = se_cmd->data_length; - fu->bot_req_out->context = cmd; - ret =usbg_prepare_w_request (cmd, fu->bot_req_out);if (ret) goto cleanup;
Greg Kroah-Hartman
maintainerPATCH 191/462 soc: qcom: socinfo: Avoid out of bounds read of serial number
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 22cf4fae6660b6e1a583a41cbf84e3046ca9ccd0 upstream.
On MSM8916 devices, the serial number exposed in sysfs is constant and does not change across individual devices. It's always:
db410c:/sys/devices/soc0$ cat serial_number 2644893864
The firmware used on MSM8916 exposes SOCINFO_VERSION(0, 8), which does not have support for the serial_num field in the socinfo struct. There is an existing check to avoid exposing the serial number in that case, but it's not correct: When checking the item_size returned by SMEM, we need to make sure the *end* of the serial_num is within bounds, instead of comparing with the *start* offset. The serial_number currently exposed on MSM8916 devices is just an out of bounds read of whatever comes after the socinfo struct in SMEM.
Fix this by changing offsetof() to offsetofend(), so that the size of the field is also taken into account.
--- drivers/soc/qcom/socinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/socinfo.c +1 -1
@@ -510,7 +510,7 @@ static int qcom_socinfo_probe(struct plaif (!qs->attr.soc_id || !qs->attr.revision)return -ENOMEM ; -if (offsetof(struct socinfo , serial_num) <= item_size) { + if (offsetofend(struct socinfo, serial_num) <= item_size) { qs->attr.serial_number =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%u" ,le32_to_cpu (info->serial_num));
Greg Kroah-Hartman
maintainerPATCH 192/462 serial: sh-sci: Drop __initdata macro for port_cfg
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit eaeee4225dba30bef4d424bdf134a07b7f423e8b upstream.
The port_cfg object is used by serial_console_write(), which serves as the write function for the earlycon device. Marking port_cfg as __initdata causes it to be freed after kernel initialization, resulting in earlycon becoming unavailable thereafter. Remove the __initdata macro from port_cfg to resolve this issue.
--- drivers/tty/serial/sh-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sh-sci.c +1 -1
@@ -3455,7 +3455,7 @@ sh_early_platform_init_buffer("earlyprin early_serial_buf, ARRAY_SIZE(early_serial_buf));#endif #ifdef CONFIG_SERIAL_SH_SCI_EARLYCON -static struct plat_sci_port port_cfg__initdata ; +static struct plat_sci_port port_cfg;static int __init early_console_setup (struct earlycon_device *device,int type)
Greg Kroah-Hartman
maintainerPATCH 193/462 serial: sh-sci: Do not probe the serial port if its slot in sci_ports[] is in use
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 9f7dea875cc7f9c1a56a5c688290634a59cd1420 upstream.
In the sh-sci driver, sci_ports[0] is used by earlycon. If the earlycon is still active when sci_probe() is called and the new serial port is supposed to map to sci_ports[0], return -EBUSY to prevent breaking the earlycon.
This situation should occurs in debug scenarios, and users should be aware of the potential conflict.
--- drivers/tty/serial/sh-sci.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/tty/serial/sh-sci.c +23 -0
@@ -164,6 +164,7 @@ struct sci_port {static struct sci_port sci_ports[SCI_NPORTS ];static unsigned long sci_ports_in_use;static struct uart_driver sci_uart_driver; +static bool sci_uart_earlycon;static inline struct sci_port *to_sci_port (struct uart_port *uart)
@@ -3343,6 +3344,7 @@ static int sci_probe_single(struct platfstatic int sci_probe (struct platform_device *dev) {struct plat_sci_port *p; +struct resource *res;struct sci_port *sp;unsigned int dev_id;int ret;
@@ -3372,6 +3374,26 @@ static int sci_probe(struct platform_dev } sp = &sci_ports[dev_id]; + +/* +* In case: +* - the probed port alias is zero (as the one used by earlycon), and +* - the earlycon is still active (e.g., "earlycon keep_bootcon" in +* bootargs) +* +* defer the probe of this serial. This is a debug scenario and the user +* must be aware of it. +* +* Except when the probed port is the same as the earlycon port. +*/ + + res =platform_get_resource (dev,IORESOURCE_MEM ,0 ); +if (!res) +return -ENODEV ; + +if (sci_uart_earlycon && sp == &sci_ports[0 ] && sp->port.mapbase != res->start) +return dev_err_probe (&dev->dev, -EBUSY ,"sci_port[0] is used by earlycon!\n" ); +platform_set_drvdata (dev, sp); ret =sci_probe_single (dev, dev_id, p, sp);
@@ -3470,6 +3492,7 @@ static int __init early_console_setup(st port_cfg.type = type; sci_ports[0 ].cfg = &port_cfg; sci_ports[0 ].params =sci_probe_regmap (&port_cfg); + sci_uart_earlycon = true; port_cfg.scscr =sci_serial_in (&sci_ports[0 ].port,SCSCR );sci_serial_out (&sci_ports[0 ].port,SCSCR ,SCSCR_RE |SCSCR_TE | port_cfg.scscr);
Greg Kroah-Hartman
maintainerPATCH 194/462 powerpc/pseries/eeh: Fix get PE state translation
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Narayana Murty N <[email protected]>
commit 11b93559000c686ad7e5ab0547e76f21cc143844 upstream.
The PE Reset State "0" returned by RTAS calls "ibm_read_slot_reset_[state|state2]" indicates that the reset is deactivated and the PE is in a state where MMIO and DMA are allowed. However, the current implementation of "pseries_eeh_get_state()" does not reflect this, causing drivers to incorrectly assume that MMIO and DMA operations cannot be resumed.
The userspace drivers as a part of EEH recovery using VFIO ioctls fail to detect when the recovery process is complete. The VFIO_EEH_PE_GET_STATE ioctl does not report the expected EEH_PE_STATE_NORMAL state, preventing userspace drivers from functioning properly on pseries systems.
The patch addresses this issue by updating 'pseries_eeh_get_state()' to include "EEH_STATE_MMIO_ENABLED" and "EEH_STATE_DMA_ENABLED" in the result mask for PE Reset State "0". This ensures correct state reporting to the callers, aligning the behavior with the PAPR specification and fixing the bug in EEH recovery for VFIO user workflows.
--- arch/powerpc/platforms/pseries/eeh_pseries.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/eeh_pseries.c +4 -2
@@ -578,8 +578,10 @@ static int pseries_eeh_get_state(structswitch (rets[0 ]) {case 0 : - result =EEH_STATE_MMIO_ACTIVE | -EEH_STATE_DMA_ACTIVE ; + result =EEH_STATE_MMIO_ACTIVE | +EEH_STATE_DMA_ACTIVE | +EEH_STATE_MMIO_ENABLED | +EEH_STATE_DMA_ENABLED ;break ;case 1 : result = EEH_STATE_RESET_ACTIVE |
Greg Kroah-Hartman
maintainerPATCH 195/462 dm-crypt: dont update io->sector after kcryptd_crypt_write_io_submit()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
commit 9fdbbdbbc92b1474a87b89f8b964892a63734492 upstream.
The updates of io->sector are the leftovers when dm-crypt allocated pages for partial write request. However, since commit cf2f1abfbd0db ("dm crypt: don't allocate pages for a partial request"), there is no partial request anymore.
After the introduction of write request rb-tree, the updates of io->sectors may interfere the insertion procedure, because ->sectors of these write requests which have already been added in the rb-tree may be changed during the insertion of new write request.
Fix it by removing these buggy updates of io->sectors. Considering these updates only effect the write request rb-tree, the commit which introduces the write request rb-tree is used as the fix tag.
--- drivers/md/dm-crypt.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/md/dm-crypt.c +3 -11
@@ -2015,7 +2015,6 @@ static void kcryptd_crypt_write_continuestruct crypt_config *cc = io->cc;struct convert_context *ctx = &io->ctx;int crypt_finished; -sector_t sector = io->sector;blk_status_t r;wait_for_completion (&ctx->restart);
@@ -2032,10 +2031,8 @@ static void kcryptd_crypt_write_continue }/* Encryption was already finished, submit io now */ -if (crypt_finished) { +if (crypt_finished)kcryptd_crypt_write_io_submit (io,0 ); - io->sector = sector; - }crypt_dec_pending (io); }
@@ -2046,14 +2043,13 @@ static void kcryptd_crypt_write_convert(struct convert_context *ctx = &io->ctx;struct bio *clone;int crypt_finished; -sector_t sector = io->sector;blk_status_t r;/* * Prevent io from disappearing until this function completes. */ crypt_inc_pending (io); -crypt_convert_init (cc, ctx,NULL , io->base_bio, sector); +crypt_convert_init (cc, ctx,NULL , io->base_bio, io->sector); clone =crypt_alloc_buffer (io, io->base_bio->bi_iter.bi_size);if (unlikely (!clone)) {
@@ -2070,8 +2066,6 @@ static void kcryptd_crypt_write_convert( io->ctx.iter_in = clone->bi_iter; } - sector +=bio_sectors (clone); -crypt_inc_pending (io); r =crypt_convert (cc, ctx,test_bit (DM_CRYPT_NO_WRITE_WORKQUEUE , &cc->flags), true);
@@ -2095,10 +2089,8 @@ static void kcryptd_crypt_write_convert( }/* Encryption was already finished, submit io now */ -if (crypt_finished) { +if (crypt_finished)kcryptd_crypt_write_io_submit (io,0 ); - io->sector = sector; - } dec:crypt_dec_pending (io);
Greg Kroah-Hartman
maintainerPATCH 196/462 dm-crypt: track tag_offset in convert_context
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
commit 8b8f8037765757861f899ed3a2bfb34525b5c065 upstream.
dm-crypt uses tag_offset to index the integrity metadata for each crypt sector. When the initial crypt_convert() returns BLK_STS_DEV_RESOURCE, dm-crypt will try to continue the crypt/decrypt procedure in a kworker. However, it resets tag_offset as zero instead of using the tag_offset related with current sector. It may return unexpected data when using random IV or return unexpected integrity related error.
Fix the problem by tracking tag_offset in per-IO convert_context. Therefore, when the crypt/decrypt procedure continues in a kworker, it could use the next tag_offset saved in convert_context.
--- drivers/md/dm-crypt.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/md/dm-crypt.c +7 -6
@@ -52,6 +52,7 @@ struct convert_context {struct bio *bio_out;struct bvec_iter iter_out;atomic_t cc_pending; +unsigned int tag_offset;u64 cc_sector;union {struct skcipher_request *req;
@@ -1218,6 +1219,7 @@ static void crypt_convert_init(struct crif (bio_out) ctx->iter_out = bio_out->bi_iter; ctx->cc_sector = sector + cc->iv_offset; + ctx->tag_offset =0 ;init_completion (&ctx->restart); }
@@ -1543,7 +1545,6 @@ static void crypt_free_req(struct crypt_static blk_status_t crypt_convert (struct crypt_config *cc,struct convert_context *ctx,bool atomic,bool reset_pending) { -unsigned int tag_offset =0 ;unsigned int sector_step = cc->sector_size >>SECTOR_SHIFT ;int r;
@@ -1566,9 +1567,9 @@ static blk_status_t crypt_convert(structatomic_inc (&ctx->cc_pending);if (crypt_integrity_aead (cc)) - r =crypt_convert_block_aead (cc, ctx, ctx->r.req_aead, tag_offset); + r =crypt_convert_block_aead (cc, ctx, ctx->r.req_aead, ctx->tag_offset);else - r =crypt_convert_block_skcipher (cc, ctx, ctx->r.req, tag_offset); + r =crypt_convert_block_skcipher (cc, ctx, ctx->r.req, ctx->tag_offset);switch (r) {/*
@@ -1588,8 +1589,8 @@ static blk_status_t crypt_convert(struct* exit and continue processing in a workqueue */ ctx->r.req =NULL ; + ctx->tag_offset++; ctx->cc_sector += sector_step; - tag_offset++;return BLK_STS_DEV_RESOURCE ; } }else {
@@ -1603,8 +1604,8 @@ static blk_status_t crypt_convert(struct*/ case -EINPROGRESS : ctx->r.req =NULL ; + ctx->tag_offset++; ctx->cc_sector += sector_step; - tag_offset++;continue ;/* * The request was already processed (synchronously).
@@ -1612,7 +1613,7 @@ static blk_status_t crypt_convert(structcase 0 :atomic_dec (&ctx->cc_pending); ctx->cc_sector += sector_step; - tag_offset++; + ctx->tag_offset++;if (!atomic)cond_resched ();continue ;
Greg Kroah-Hartman
maintainerPATCH 197/462 ALSA: hda/realtek: Enable headset mic on Positivo C6400
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edson Juliano Drosdeck <[email protected]>
commit 1aec3ed2e3e1512aba15e7e790196a44efd5f0a7 upstream.
Positivo C6400 is equipped with ALC269VB, and it needs ALC269VB_FIXUP_ASUS_ZENBOOK quirk to make its headset mic work. Also must to limits the microphone boost.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9435,6 +9435,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x17aa ,0x511f ,"Thinkpad" ,ALC298_FIXUP_TPT470_DOCK ),SND_PCI_QUIRK (0x17aa ,0x9e54 ,"LENOVO NB" ,ALC269_FIXUP_LENOVO_EAPD ),SND_PCI_QUIRK (0x17aa ,0x9e56 ,"Lenovo ZhaoYang CF4620Z" ,ALC286_FIXUP_SONY_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1849 ,0x0269 ,"Positivo Master C6400" ,ALC269VB_FIXUP_ASUS_ZENBOOK ),SND_PCI_QUIRK (0x1849 ,0x1233 ,"ASRock NUC Box 1100" ,ALC233_FIXUP_NO_AUDIO_JACK ),SND_PCI_QUIRK (0x1849 ,0xa233 ,"Positivo Master C6300" ,ALC269_FIXUP_HEADSET_MIC ), SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Greg Kroah-Hartman
maintainerPATCH 198/462 scsi: qla2xxx: Move FCE Trace buffer allocation to user control
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 841df27d619ee1f5ca6473e15227b39d6136562d upstream.
Currently FCE Tracing is enabled to log additional ELS events. Instead, user will enable or disable this feature through debugfs.
Modify existing DFS knob to allow user to enable or disable this feature.
echo [1 | 0] > /sys/kernel/debug/qla2xxx/qla2xxx_??/fce cat /sys/kernel/debug/qla2xxx/qla2xxx_??/fce
--- drivers/scsi/qla2xxx/qla_def.h | 2 drivers/scsi/qla2xxx/qla_dfs.c | 124 ++++++++++++++++++++++++++++++++-------- drivers/scsi/qla2xxx/qla_gbl.h | 3 drivers/scsi/qla2xxx/qla_init.c | 28 ++++++--- 4 files changed, 126 insertions(+), 31 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +2 -0
@@ -3883,6 +3883,8 @@ struct qla_hw_data { uint32_t npiv_supported :1; uint32_t pci_channel_io_perm_failure :1; uint32_t fce_enabled :1; + uint32_t user_enabled_fce :1; + uint32_t fce_dump_buf_alloced :1; uint32_t fac_supported :1; uint32_t chip_reset_done :1;
drivers/scsi/qla2xxx/qla_dfs.c +102 -22
155 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_gbl.h +3 -0
@@ -11,6 +11,9 @@/* * Global Function Prototypes in qla_init.c source file. */ +int qla2x00_alloc_fce_trace (scsi_qla_host_t *); +void qla2x00_free_fce_trace (struct qla_hw_data *ha); +void qla_enable_fce_trace (scsi_qla_host_t *);extern int qla2x00_initialize_adapter (scsi_qla_host_t *);extern int qla2100_pci_config (struct scsi_qla_host *);
drivers/scsi/qla2xxx/qla_init.c +19 -9
@@ -2280,7 +2280,7 @@ exit:return rval; } -static void qla_enable_fce_trace (scsi_qla_host_t *vha) +void qla_enable_fce_trace (scsi_qla_host_t *vha) {int rval;struct qla_hw_data *ha = vha->hw;
@@ -3263,25 +3263,24 @@ qla24xx_chip_diag(scsi_qla_host_t *vha)return rval; } -static void -qla2x00_alloc_fce_trace (scsi_qla_host_t *vha) +int qla2x00_alloc_fce_trace (scsi_qla_host_t *vha) {dma_addr_t tc_dma;void *tc;struct qla_hw_data *ha = vha->hw;if (!IS_FWI2_CAPABLE (ha)) -return ; +return -EINVAL ;if (!IS_QLA25XX (ha) && !IS_QLA81XX (ha) && !IS_QLA83XX (ha) && !IS_QLA27XX (ha) && !IS_QLA28XX (ha)) -return ; +return -EINVAL ;if (ha->fce) {ql_dbg (ql_dbg_init, vha,0x00bd ,"%s: FCE Mem is already allocated.\n" , __func__); -return ; +return -EIO ; }/* Allocate memory for Fibre Channel Event Buffer. */
@@ -3291,7 +3290,7 @@ qla2x00_alloc_fce_trace(scsi_qla_host_tql_log (ql_log_warn, vha,0x00be ,"Unable to allocate (%d KB) for FCE.\n" ,FCE_SIZE /1024 ); -return ; +return -ENOMEM ; } ql_dbg(ql_dbg_init, vha, 0x00c0,
@@ -3300,6 +3299,16 @@ qla2x00_alloc_fce_trace(scsi_qla_host_t ha->fce_dma = tc_dma; ha->fce = tc; ha->fce_bufs =FCE_NUM_BUFFERS ; +return 0 ; +} + +void qla2x00_free_fce_trace (struct qla_hw_data *ha) +{ +if (!ha->fce) +return ; +dma_free_coherent (&ha->pdev->dev,FCE_SIZE , ha->fce, ha->fce_dma); + ha->fce =NULL ; + ha->fce_dma =0 ; } static void
@@ -3390,9 +3399,10 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vif (ha->tgt.atio_ring) mq_size += ha->tgt.atio_q_length *sizeof (request_t); -qla2x00_alloc_fce_trace (vha); -if (ha->fce) +if (ha->fce) { fce_size =sizeof (struct qla2xxx_fce_chain ) +FCE_SIZE ; + ha->flags.fce_dump_buf_alloced =1 ; + }qla2x00_alloc_eft_trace (vha);if (ha->eft) eft_size =EFT_SIZE ;
Greg Kroah-Hartman
maintainerPATCH 199/462 scsi: storvsc: Set correct data length for sending SCSI command without payload
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
commit 87c4b5e8a6b65189abd9ea5010ab308941f964a4 upstream.
In StorVSC, payload->range.len is used to indicate if this SCSI command carries payload. This data is allocated as part of the private driver data by the upper layer and may get passed to lower driver uninitialized.
For example, the SCSI error handling mid layer may send TEST_UNIT_READY or REQUEST_SENSE while reusing the buffer from a failed command. The private data section may have stale data from the previous command.
If the SCSI command doesn't carry payload, the driver may use this value as is for communicating with host, resulting in possible corruption.
Fix this by always initializing this value.
--- drivers/scsi/storvsc_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/storvsc_drv.c +1 -0
@@ -1759,6 +1759,7 @@ static int storvsc_queuecommand(struct S length =scsi_bufflen (scmnd); payload = (struct vmbus_packet_mpb_array *)&cmd_request->mpb; + payload->range.len =0 ; payload_sz =0 ;if (sg_count) {
Greg Kroah-Hartman
maintainerPATCH 200/462 kbuild: Move -Wenum-enum-conversion to W=2
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 8f6629c004b193d23612641c3607e785819e97ab upstream.
-Wenum-enum-conversion was strengthened in clang-19 to warn for C, which caused the kernel to move it to W=1 in commit 75b5ab134bb5 ("kbuild:
Move -Wenum-{compare-conditional,enum-conversion} into W=1") because there were numerous instances that would break builds with -Werror. Unfortunately, this is not a full solution, as more and more developers, subsystems, and distributors are building with W=1 as well, so they continue to see the numerous instances of this warning.
Since the move to W=1, there have not been many new instances that have appeared through various build reports and the ones that have appeared seem to be following similar existing patterns, suggesting that most instances of this warning will not be real issues. The only alternatives for silencing this warning are adding casts (which is generally seen as an ugly practice) or refactoring the enums to macro defines or a unified enum (which may be undesirable because of type safety in other parts of the code).
Move the warning to W=2, where warnings that occur frequently but may be relevant should reside.
--- scripts/Makefile.extrawarn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/Makefile.extrawarn +4 -1
@@ -37,6 +37,10 @@ KBUILD_CFLAGS += -Wno-missing-field-init KBUILD_CFLAGS += -Wno-sign-compare KBUILD_CFLAGS += -Wno-type-limits +ifdef CONFIG_CC_IS_CLANG +KBUILD_CFLAGS += -Wno-enum-enum-conversion +endif + KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1 else
@@ -54,7 +58,6 @@ KBUILD_CFLAGS += -Wno-tautological-const KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access) KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict) KBUILD_CFLAGS += -Wno-enum-compare-conditional -KBUILD_CFLAGS += -Wno-enum-enum-conversion endif endif
Greg Kroah-Hartman
maintainerPATCH 201/462 x86/boot: Use -std=gnu11 to fix build with GCC 15
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit ee2ab467bddfb2d7f68d996dbab94d7b88f8eaf7 upstream.
GCC 15 changed the default C standard version to C23, which should not have impacted the kernel because it requests the gnu11 standard via '-std=' in the main Makefile. However, the x86 compressed boot Makefile uses its own set of KBUILD_CFLAGS without a '-std=' value (i.e., using the default), resulting in errors from the kernel's definitions of bool, true, and false in stddef.h, which are reserved keywords under C23.
./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
11 | false = 0,
./include/linux/types.h:35:33: error: two or more data types in declaration specifiers
35 | typedef _Bool bool;
Set '-std=gnu11' in the x86 compressed boot Makefile to resolve the error and consistently use the same C standard version for the entire kernel.
--- arch/x86/boot/compressed/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/x86/boot/compressed/Makefile +1 -0
@@ -33,6 +33,7 @@ targets := vmlinux vmlinux.bin vmlinux.b # avoid errors with '-march=i386', and future flags may depend on the target to # be valid. KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS) +KBUILD_CFLAGS += -std=gnu11 KBUILD_CFLAGS += -fno-strict-aliasing -fPIE KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING cflags-$(CONFIG_X86_32) := -march=i386
Greg Kroah-Hartman
maintainerPATCH 202/462 iio: light: as73211: fix channel handling in only-color triggered buffer
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit ab09c6cfe01b317f515bcd944668697241a54b9d upstream.
The channel index is off by one unit if AS73211_SCAN_MASK_ALL is not set (optimized path for color channel readings), and it must be shifted instead of leaving an empty channel for the temperature when it is off.
Once the channel index is fixed, the uninitialized channel must be set to zero to avoid pushing uninitialized data.
Add available_scan_masks for all channels and only-color channels to let the IIO core demux and repack the enabled channels.
--- drivers/iio/light/as73211.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
drivers/iio/light/as73211.c +20 -4
@@ -155,6 +155,12 @@ struct as73211_data { BIT(AS73211_SCAN_INDEX_TEMP) | \ AS73211_SCAN_MASK_COLOR) +static const unsigned long as73211_scan_masks[] = { +AS73211_SCAN_MASK_COLOR , +AS73211_SCAN_MASK_ALL , +0 +}; +static const struct iio_chan_spec as73211_channels[] = { { .type =IIO_TEMP ,
@@ -603,9 +609,12 @@ static irqreturn_t as73211_trigger_handl/* AS73211 starts reading at address 2 */ ret =i2c_master_recv (data->client, - (char *)&scan.chan[1 ],3 *sizeof (scan.chan[1 ])); + (char *)&scan.chan[0 ],3 *sizeof (scan.chan[0 ]));if (ret <0 ) goto done; + +/* Avoid pushing uninitialized data */ + scan.chan[3 ] =0 ; }if (data_result) {
@@ -613,9 +622,15 @@ static irqreturn_t as73211_trigger_handl* Saturate all channels (in case of overflows). Temperature channel * is not affected by overflows. */ - scan.chan[1 ] =cpu_to_le16 (U16_MAX ); - scan.chan[2 ] =cpu_to_le16 (U16_MAX ); - scan.chan[3 ] =cpu_to_le16 (U16_MAX ); +if (*indio_dev->active_scan_mask ==AS73211_SCAN_MASK_ALL ) { + scan.chan[1 ] =cpu_to_le16 (U16_MAX ); + scan.chan[2 ] =cpu_to_le16 (U16_MAX ); + scan.chan[3 ] =cpu_to_le16 (U16_MAX ); + }else { + scan.chan[0 ] =cpu_to_le16 (U16_MAX ); + scan.chan[1 ] =cpu_to_le16 (U16_MAX ); + scan.chan[2 ] =cpu_to_le16 (U16_MAX ); + } }iio_push_to_buffers_with_timestamp (indio_dev, &scan,iio_get_time_ns (indio_dev));
@@ -685,6 +700,7 @@ static int as73211_probe(struct i2c_clie indio_dev->channels = as73211_channels; indio_dev->num_channels =ARRAY_SIZE (as73211_channels); indio_dev->modes =INDIO_DIRECT_MODE ; + indio_dev->available_scan_masks = as73211_scan_masks; ret =i2c_smbus_read_byte_data (data->client,AS73211_REG_OSR );if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 203/462 soc: qcom: smem_state: fix missing of_node_put in error path
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 70096b4990848229d0784c5e51dc3c7c072f1111 upstream.
If of_parse_phandle_with_args() succeeds, the OF node reference should be dropped, regardless of number of phandle arguments.
--- drivers/soc/qcom/smem_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soc/qcom/smem_state.c +2 -1
@@ -116,7 +116,8 @@ struct qcom_smem_state *qcom_smem_state_if (args.args_count !=1 ) {dev_err (dev,"invalid #qcom,smem-state-cells\n" ); -return ERR_PTR (-EINVAL ); + state =ERR_PTR (-EINVAL ); + goto put; } state =of_node_to_state (args.np);
Greg Kroah-Hartman
maintainerPATCH 204/462 media: mc: fix endpoint iteration
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Tanislav <[email protected]>
commit fb2bd86270cd0ad004f4c614ba4f8c63a5720e25 upstream.
When creating links from a subdev to a sink, the current logic tries to iterate over the endpoints of dev's fwnode.
This might not be correct when the subdev uses a different fwnode compared to the dev's fwnode.
If, when registering, the subdev's fwnode is not set, the code inside v4l2_async_register_subdev will set it to the dev's fwnode.
To fix this, just use the subdev's fwnode.
--- drivers/media/v4l2-core/v4l2-mc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-mc.c +1 -1
@@ -321,7 +321,7 @@ int v4l2_create_fwnode_links_to_pad(stru sink_sd =media_entity_to_v4l2_subdev (sink->entity); -fwnode_graph_for_each_endpoint (dev_fwnode (src_sd->dev), endpoint) { +fwnode_graph_for_each_endpoint (src_sd->fwnode, endpoint) {struct fwnode_handle *remote_ep;int src_idx, sink_idx, ret;struct media_pad *src;
Greg Kroah-Hartman
maintainerPATCH 205/462 media: ov5640: fix get_light_freq on auto
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Bobrowicz <[email protected]>
commit 001d3753538d26ddcbef011f5643cfff58a7f672 upstream.
Light frequency was not properly returned when in auto mode and the detected frequency was 60Hz.
--- drivers/media/i2c/ov5640.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/ov5640.c +1 -0
@@ -1380,6 +1380,7 @@ static int ov5640_get_light_freq(struct light_freq =50 ; }else {/* 60Hz */ + light_freq =60 ; } }
Greg Kroah-Hartman
maintainerPATCH 206/462 media: uvcvideo: Fix event flags in uvc_ctrl_send_events
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit c31cffd5ae2c3d7ef21d9008977a9d117ce7a64e upstream.
If there is an event that needs the V4L2_EVENT_CTRL_CH_FLAGS flag, all the following events will have that flag, regardless if they need it or not.
This is because we keep using the same variable all the time and we do not reset its original value.
--- drivers/media/usb/uvc/uvc_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +2 -2
@@ -1400,13 +1400,13 @@ static void uvc_ctrl_send_events(struct {struct uvc_control_mapping *mapping;struct uvc_control *ctrl; -u32 changes =V4L2_EVENT_CTRL_CH_VALUE ;unsigned int i;unsigned int j;for (i =0 ; i < xctrls_count; ++i) { - ctrl =uvc_find_control (handle->chain, xctrls[i].id, &mapping); +u32 changes =V4L2_EVENT_CTRL_CH_VALUE ; + ctrl =uvc_find_control (handle->chain, xctrls[i].id, &mapping);if (ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS )/* Notification will be sent from an Interrupt event. */ continue ;
Greg Kroah-Hartman
maintainerPATCH 207/462 media: uvcvideo: Remove redundant NULL assignment
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit 04d3398f66d2d31c4b8caea88f051a4257b7a161 upstream.
ctrl->handle will only be different than NULL for controls that have mappings. This is because that assignment is only done inside uvc_ctrl_set() for mapped controls.
--- drivers/media/usb/uvc/uvc_ctrl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +1 -3
@@ -1367,10 +1367,8 @@ bool uvc_ctrl_status_event_async(structstruct uvc_device *dev = chain->dev;struct uvc_ctrl_work *w = &dev->async_ctrl; -if (list_empty (&ctrl->info.mappings)) { - ctrl->handle =NULL ; +if (list_empty (&ctrl->info.mappings))return false; - } w->data = data; w->urb = urb;
Greg Kroah-Hartman
maintainerPATCH 208/462 crypto: qce - fix goto jump in error path
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit 5278275c1758a38199b43530adfc50098f4b41c7 upstream.
If qce_check_version() fails, we should jump to err_dma as we already called qce_dma_request() a couple lines before.
--- drivers/crypto/qce/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qce/core.c +1 -1
@@ -219,7 +219,7 @@ static int qce_crypto_probe(struct platf ret =qce_check_version (qce);if (ret) - goto err_clks; + goto err_dma;spin_lock_init (&qce->lock); tasklet_init(&qce->done_tasklet, qce_tasklet_req_done,
Greg Kroah-Hartman
maintainerPATCH 209/462 crypto: qce - unregister previously registered algos in error path
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit e80cf84b608725303113d6fe98bb727bf7b7a40d upstream.
If we encounter an error when registering alorithms with the crypto framework, we just bail out and don't unregister the ones we successfully registered in prior iterations of the loop.
Add code that goes back over the algos and unregisters them before returning an error from qce_register_algs().
--- drivers/crypto/qce/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/crypto/qce/core.c +7 -4
@@ -45,16 +45,19 @@ static void qce_unregister_algs(struct qstatic int qce_register_algs (struct qce_device *qce) {const struct qce_algo_ops *ops; -int i, ret = -ENODEV ; +int i, j, ret = -ENODEV ;for (i =0 ; i <ARRAY_SIZE (qce_ops); i++) { ops = qce_ops[i]; ret = ops->register_algs (qce); -if (ret) -break ; +if (ret) { +for (j = i -1 ; j >=0 ; j--) + ops->unregister_algs (qce); +return ret; + } } -return ret; +return 0 ; }static int qce_handle_request (struct crypto_async_request *async_req)
Greg Kroah-Hartman
maintainerPATCH 210/462 nvmem: qcom-spmi-sdam: Set size in struct nvmem_config
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
commit e88f516ea417c71bb3702603ac6af9e95338cfa6 upstream.
Let the nvmem core know what size the SDAM is, most notably this fixes the size of /sys/bus/nvmem/devices/spmi_sdam*/nvmem being '0' and makes user space work with that file.
~ # hexdump -C -s 64 /sys/bus/nvmem/devices/spmi_sdam2/nvmem
00000040 02 01 00 00 04 00 00 00 00 00 00 00 00 00 00 00 |................| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000080
--- drivers/nvmem/qcom-spmi-sdam.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvmem/qcom-spmi-sdam.c +1 -0
@@ -143,6 +143,7 @@ static int sdam_probe(struct platform_de sdam->sdam_config.id =NVMEM_DEVID_AUTO ; sdam->sdam_config.owner =THIS_MODULE , sdam->sdam_config.stride =1 ; + sdam->sdam_config.size = sdam->size; sdam->sdam_config.word_size =1 ; sdam->sdam_config.reg_read = sdam_read; sdam->sdam_config.reg_write = sdam_write;
Greg Kroah-Hartman
maintainerPATCH 211/462 nvmem: core: improve range check for nvmem_cell_write()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jennifer Berringer <[email protected]>
commit 31507fc2ad36e0071751a710449db19c85d82a7f upstream.
When __nvmem_cell_entry_write() is called for an nvmem cell that does not need bit shifting, it requires that the len parameter exactly matches the nvmem cell size. However, when the nvmem cell has a nonzero bit_offset, it was skipping this check.
Accepting values of len larger than the cell size results in nvmem_cell_prepare_write_buffer() trying to write past the end of a heap buffer that it allocates. Add a check to avoid that problem and instead return -EINVAL when len doesn't match the number of bits expected by the nvmem cell when bit_offset is nonzero.
This check uses cell->nbits in order to allow providing the smaller size to cells that are shifted into another byte by bit_offset. For example, a cell with nbits=8 and nonzero bit_offset would have bytes=2 but should accept a 1-byte write here, although no current callers depend on this.
--- drivers/nvmem/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvmem/core.c +2 -0
@@ -1362,6 +1362,8 @@ int nvmem_cell_write(struct nvmem_cell *return -EINVAL ;if (cell->bit_offset || cell->nbits) { +if (len !=BITS_TO_BYTES (cell->nbits) && len != cell->bytes) +return -EINVAL ; buf =nvmem_cell_prepare_write_buffer (cell, buf, len);if (IS_ERR (buf))return PTR_ERR (buf);
Greg Kroah-Hartman
maintainerPATCH 212/462 vfio/platform: check the bounds of read/write syscalls
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit ce9ff21ea89d191e477a02ad7eabf4f996b80a69 upstream.
count and offset are passed from user space and not checked, only offset is capped to 40 bits, which can be used to read/write out of bounds of the device.
--- drivers/vfio/platform/vfio_platform_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/vfio/platform/vfio_platform_common.c +10 -0
@@ -410,6 +410,11 @@ static ssize_t vfio_platform_read_mmio(s count =min_t (size_t, count, reg->size - off); +if (off >= reg->size) +return -EINVAL ; + + count =min_t (size_t, count, reg->size - off); +if (!reg->ioaddr) { reg->ioaddr =ioremap (reg->addr, reg->size);
@@ -489,6 +494,11 @@ static ssize_t vfio_platform_write_mmio(if (off >= reg->size)return -EINVAL ; + + count =min_t (size_t, count, reg->size - off); + +if (off >= reg->size) +return -EINVAL ; count =min_t (size_t, count, reg->size - off);
Greg Kroah-Hartman
maintainerPATCH 213/462 pnfs/flexfiles: retry getting layout segment for reads
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit eb3fabde15bccdf34f1c9b35a83aa4c0dacbb4ca upstream.
If ff_layout_pg_get_read()'s attempt to get a layout segment results in -EAGAIN have ff_layout_pg_init_read() retry it after sleeping.
If "softerr" mount is used, use 'io_maxretrans' to limit the number of attempts to get a layout segment.
This fixes a long-standing issue of O_DIRECT reads failing with -EAGAIN (11) when using flexfiles Client Side Mirroring (CSM).
--- fs/nfs/flexfilelayout/flexfilelayout.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
fs/nfs/flexfilelayout/flexfilelayout.c +21 -6
@@ -840,6 +840,9 @@ ff_layout_pg_init_read(struct nfs_pageiostruct nfs4_pnfs_ds *ds;u32 ds_idx; +if (NFS_SERVER (pgio->pg_inode)->flags & + (NFS_MOUNT_SOFT |NFS_MOUNT_SOFTERR )) + pgio->pg_maxretrans = io_maxretrans; retry:ff_layout_pg_check_layout (pgio, req);/* Use full layout for now */
@@ -853,6 +856,8 @@ retry:if (!pgio->pg_lseg) goto out_nolseg; } +/* Reset wb_nio, since getting layout segment was successful */ + req->wb_nio =0 ; ds =ff_layout_get_ds_for_read (pgio, &ds_idx);if (!ds) {
@@ -869,14 +874,24 @@ retry: pgm->pg_bsize = mirror->mirror_ds->ds_versions[0 ].rsize; pgio->pg_mirror_idx = ds_idx; - -if (NFS_SERVER (pgio->pg_inode)->flags & - (NFS_MOUNT_SOFT |NFS_MOUNT_SOFTERR )) - pgio->pg_maxretrans = io_maxretrans;return ; out_nolseg: -if (pgio->pg_error <0 ) -return ; +if (pgio->pg_error <0 ) { +if (pgio->pg_error != -EAGAIN ) +return ; +/* Retry getting layout segment if lower layer returned -EAGAIN */ +if (pgio->pg_maxretrans && req->wb_nio++ > pgio->pg_maxretrans) { +if (NFS_SERVER (pgio->pg_inode)->flags &NFS_MOUNT_SOFTERR ) + pgio->pg_error = -ETIMEDOUT ; +else + pgio->pg_error = -EIO ; +return ; + } + pgio->pg_error =0 ; +/* Sleep for 1 second before retrying */ +ssleep (1 ); + goto retry; + } out_mds: trace_pnfs_mds_fallback_pg_init_read(pgio->pg_inode, 0, NFS4_MAX_UINT64, IOMODE_READ,
Greg Kroah-Hartman
maintainerPATCH 214/462 ocfs2: fix incorrect CPU endianness conversion causing mount failure
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heming Zhao <[email protected]>
commit f921da2c34692dfec5f72b5ae347b1bea22bb369 upstream.
Commit 23aab037106d ("ocfs2: fix UBSAN warning in ocfs2_verify_volume()") introduced a regression bug. The blksz_bits value is already converted to CPU endian in the previous code; therefore, the code shouldn't use le32_to_cpu() anymore.
--- fs/ocfs2/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/super.c +1 -1
@@ -2350,7 +2350,7 @@ static int ocfs2_verify_volume(struct ocmlog (ML_ERROR ,"found superblock with incorrect block " "size bits: found %u, should be 9, 10, 11, or 12\n" , blksz_bits); - }else if ((1 <<le32_to_cpu (blksz_bits)) != blksz) { + }else if ((1 << blksz_bits) != blksz) {mlog (ML_ERROR ,"found superblock with incorrect block " "size: found %u, should be %u\n" ,1 << blksz_bits, blksz); } else if (le16_to_cpu(di->id2.i_super.s_major_rev_level) !=
Greg Kroah-Hartman
maintainerPATCH 215/462 ocfs2: handle a symlink read error correctly
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
commit 2b4c2094da6d84e69b843dd3317902e977bf64bd upstream.
Patch series "Convert ocfs2 to use folios".
Mark did a conversion of ocfs2 to use folios and sent it to me as a giant patch for review ;-)
So I've redone it as individual patches, and credited Mark for the patches where his code is substantially the same. It's not a bad way to do it; his patch had some bugs and my patches had some bugs. Hopefully all our bugs were different from each other. And hopefully Mark likes all the changes I made to his code!
This patch (of 23):
If we can't read the buffer, be sure to unlock the page before returning.
--- fs/ocfs2/symlink.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ocfs2/symlink.c +3 -2
@@ -66,7 +66,7 @@ static int ocfs2_fast_symlink_readpage(sif (status <0 ) {mlog_errno (status); -return status; + goto out; } fe = (struct ocfs2_dinode *) bh->b_data;
@@ -77,9 +77,10 @@ static int ocfs2_fast_symlink_readpage(smemcpy (kaddr, link, len +1 );kunmap_atomic (kaddr);SetPageUptodate (page); +out:unlock_page (page);brelse (bh); -return 0 ; +return status; }const struct address_space_operations ocfs2_fast_symlink_aops = {
Greg Kroah-Hartman
maintainerPATCH 216/462 nilfs2: fix possible int overflows in nilfs_fiemap()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
commit 6438ef381c183444f7f9d1de18f22661cba1e946 upstream.
Since nilfs_bmap_lookup_contig() in nilfs_fiemap() calculates its result by being prepared to go through potentially maxblocks == INT_MAX blocks, the value in n may experience an overflow caused by left shift of blkbits.
While it is extremely unlikely to occur, play it safe and cast right hand expression to wider type to mitigate the issue.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- fs/nilfs2/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/nilfs2/inode.c +3 -3
@@ -1263,7 +1263,7 @@ int nilfs_fiemap(struct inode *inode, stif (size) {if (phys && blkphy << blkbits == phys + size) {/* The current extent goes on */ - size += n << blkbits; + size += (u64 )n << blkbits; }else {/* Terminate the current extent */ ret = fiemap_fill_next_extent(
@@ -1276,14 +1276,14 @@ int nilfs_fiemap(struct inode *inode, st flags =FIEMAP_EXTENT_MERGED ; logical = blkoff << blkbits; phys = blkphy << blkbits; - size = n << blkbits; + size = (u64 )n << blkbits; } }else {/* Start a new extent */ flags =FIEMAP_EXTENT_MERGED ; logical = blkoff << blkbits; phys = blkphy << blkbits; - size = n << blkbits; + size = (u64 )n << blkbits; } blkoff += n; }
Greg Kroah-Hartman
maintainerPATCH 217/462 NFC: nci: Add bounds checking in nci_hci_create_pipe()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 110b43ef05342d5a11284cc8b21582b698b4ef1c upstream.
The "pipe" variable is a u8 which comes from the network. If it's more than 127, then it results in memory corruption in the caller, nci_hci_connect_gate().
--- net/nfc/nci/hci.c | 2 ++ 1 file changed, 2 insertions(+)
net/nfc/nci/hci.c +2 -0
@@ -548,6 +548,8 @@ static u8 nci_hci_create_pipe(struct ncipr_debug ("pipe created=%d\n" , pipe); +if (pipe >=NCI_HCI_MAX_PIPES ) + pipe =NCI_HCI_INVALID_PIPE ;return pipe; }
Greg Kroah-Hartman
maintainerPATCH 218/462 mtd: onenand: Fix uninitialized retlen in do_otp_read()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Stepchenko <[email protected]>
commit 70a71f8151b9879b0950668ce3ad76263261fee0 upstream.
The function do_otp_read() does not set the output parameter *retlen, which is expected to contain the number of bytes actually read. As a result, in onenand_otp_walk(), the tmp_retlen variable remains uninitialized after calling do_otp_walk() and used to change the values of the buf, len and retlen variables.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/mtd/nand/onenand/onenand_base.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/onenand/onenand_base.c +1 -0
@@ -2916,6 +2916,7 @@ static int do_otp_read(struct mtd_info * ret =ONENAND_IS_4KB_PAGE (this) ?onenand_mlc_read_ops_nolock (mtd, from, &ops) :onenand_read_ops_nolock (mtd, from, &ops); + *retlen = ops.retlen;/* Exit OTP access mode */ this->command (mtd,ONENAND_CMD_RESET ,0 ,0 );
Greg Kroah-Hartman
maintainerPATCH 219/462 misc: fastrpc: Fix registered buffer page address
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ekansh Gupta <[email protected]>
commit 6ca4ea1f88a06a04ed7b2c9c6bf9f00833b68214 upstream.
For registered buffers, fastrpc driver sends the buffer information to remote subsystem. There is a problem with current implementation where the page address is being sent with an offset leading to improper buffer address on DSP. This is leads to functional failures as DSP expects base address in page information and extracts offset information from remote arguments. Mask the offset and pass the base page address to DSP.
This issue is observed is a corner case when some buffer which is registered with fastrpc framework is passed with some offset by user and then the DSP implementation tried to read the data. As DSP expects base address and takes care of offsetting with remote arguments, passing an offsetted address will result in some unexpected data read in DSP.
All generic usecases usually pass the buffer as it is hence is problem is not usually observed. If someone tries to pass offsetted buffer and then tries to compare data at HLOS and DSP end, then the ambiguity will be observed.
--- drivers/misc/fastrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/fastrpc.c +1 -1
@@ -826,7 +826,7 @@ static int fastrpc_get_args(u32 kernel,mmap_read_lock (current->mm); vma =find_vma (current->mm, ctx->args[i].ptr);if (vma) - pages[i].addr += ctx->args[i].ptr - + pages[i].addr += (ctx->args[i].ptr &PAGE_MASK ) - vma->vm_start;mmap_read_unlock (current->mm);
Greg Kroah-Hartman
maintainerPATCH 220/462 net/ncsi: wait for the last response to Deselect Package before configuring channel
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Fertser <[email protected]>
commit 6bb194d036c6e1b329dcdff459338cdd9a54802a upstream.
The NCSI state machine as it's currently implemented assumes that transition to the next logical state is performed either explicitly by calling schedule_work(&ndp->work) to re-queue itself or implicitly after processing the predefined (ndp->pending_req_num) number of replies. Thus to avoid the configuration FSM from advancing prematurely and getting out of sync with the process it's essential to not skip waiting for a reply.
This patch makes the code wait for reception of the Deselect Package response for the last package probed before proceeding to channel configuration.
Thanks go to Potin Lai and Cosmo Chou for the initial investigation and testing.
--- net/ncsi/ncsi-manage.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
net/ncsi/ncsi-manage.c +7 -6
@@ -1345,6 +1345,12 @@ static void ncsi_probe_channel(struct nc nd->state = ncsi_dev_state_probe_package;break ;case ncsi_dev_state_probe_package: +if (ndp->package_probe_id >=8 ) { +/* Last package probed, finishing */ + ndp->flags |=NCSI_DEV_PROBED ; +break ; + } + ndp->pending_req_num =1 ; nca.type =NCSI_PKT_CMD_SP ;
@@ -1461,13 +1467,8 @@ static void ncsi_probe_channel(struct ncif (ret) goto error; -/* Probe next package */ +/* Probe next package after receiving response */ ndp->package_probe_id++; -if (ndp->package_probe_id >=8 ) { -/* Probe finished */ - ndp->flags |=NCSI_DEV_PROBED ; -break ; - } nd->state = ncsi_dev_state_probe_package; ndp->active_package =NULL ;break ;
Greg Kroah-Hartman
maintainerPATCH 221/462 ptp: Ensure info->enable callback is always set
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
commit fd53aa40e65f518453115b6f56183b0c201db26b upstream.
The ioctl and sysfs handlers unconditionally call the ->enable callback. Not all drivers implement that callback, leading to NULL dereferences. Example of affected drivers: ptp_s390.c, ptp_vclock.c and ptp_mock.c.
Instead use a dummy callback if no better was specified by the driver.
--- drivers/ptp/ptp_clock.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/ptp/ptp_clock.c +8 -0
@@ -188,6 +188,11 @@ static void ptp_clock_release(struct devkfree (ptp); } +static int ptp_enable (struct ptp_clock_info *ptp,struct ptp_clock_request *request,int on) +{ +return -EOPNOTSUPP ; +} +static void ptp_aux_kworker (struct kthread_work *work) { struct ptp_clock *ptp = container_of(work, struct ptp_clock,
@@ -233,6 +238,9 @@ struct ptp_clock *ptp_clock_register(strmutex_init (&ptp->pincfg_mux);init_waitqueue_head (&ptp->tsev_wq); +if (!ptp->info->enable) + ptp->info->enable = ptp_enable; +if (ptp->info->do_aux_work) {kthread_init_delayed_work (&ptp->aux_work, ptp_aux_kworker); ptp->kworker =kthread_create_worker (0 ,"ptp%d" , ptp->index);
Greg Kroah-Hartman
maintainerPATCH 222/462 MIPS: ftrace: Declare ftrace_get_parent_ra_addr() as static
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
commit ddd068d81445b17ac0bed084dfeb9e58b4df3ddd upstream.
Declare ftrace_get_parent_ra_addr() as static to suppress clang compiler warning that 'no previous prototype'. This function is not intended to be called from other parts.
Fix follow error with clang-19:
arch/mips/kernel/ftrace.c:251:15: error: no previous prototype for function 'ftrace_get_parent_ra_addr' [-Werror,-Wmissing-prototypes]
251 | unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
| ^arch/mips/kernel/ftrace.c:251:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
251 | unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
| ^
| static1 error generated.
--- arch/mips/kernel/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kernel/ftrace.c +1 -1
@@ -260,7 +260,7 @@ int ftrace_disable_ftrace_graph_caller(v#define S_R_SP (0xafb0 << 16)/* s{d,w} R, offset(sp) */ #define OFFSET_MASK 0xffff/* stack offset range: 0 ~ PT_SIZE */ -unsigned long ftrace_get_parent_ra_addr (unsigned long self_ra,unsigned long +static unsigned long ftrace_get_parent_ra_addr (unsigned long self_ra,unsigned long old_parent_ra,unsigned long parent_ra_addr,unsigned long fp) {unsigned long sp, ip, tmp;
Greg Kroah-Hartman
maintainerPATCH 223/462 ocfs2: check dir i_size in ocfs2_find_entry
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Yue <[email protected]>
commit b0fce54b8c0d8e5f2b4c243c803c5996e73baee8 upstream.
syz reports an out of bounds read:
==================================================================
BUG: KASAN: slab-out-of-bounds in ocfs2_match fs/ocfs2/dir.c:334 [inline] BUG: KASAN: slab-out-of-bounds in ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367 Read of size 1 at addr ffff88804d8b9982 by task syz-executor.2/14802 CPU: 0 UID: 0 PID: 14802 Comm: syz-executor.2 Not tainted 6.13.0-rc4 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Sched_ext: serialise (enabled+all), task: runnable_at=-10ms Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x229/0x350 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x164/0x530 mm/kasan/report.c:489 kasan_report+0x147/0x180 mm/kasan/report.c:602 ocfs2_match fs/ocfs2/dir.c:334 [inline] ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367 ocfs2_find_entry_id fs/ocfs2/dir.c:414 [inline] ocfs2_find_entry+0x1143/0x2db0 fs/ocfs2/dir.c:1078 ocfs2_find_files_on_disk+0x18e/0x530 fs/ocfs2/dir.c:1981 ocfs2_lookup_ino_from_name+0xb6/0x110 fs/ocfs2/dir.c:2003 ocfs2_lookup+0x30a/0xd40 fs/ocfs2/namei.c:122 lookup_open fs/namei.c:3627 [inline] open_last_lookups fs/namei.c:3748 [inline] path_openat+0x145a/0x3870 fs/namei.c:3984 do_filp_open+0xe9/0x1c0 fs/namei.c:4014 do_sys_openat2+0x135/0x1d0 fs/open.c:1402 do_sys_open fs/open.c:1417 [inline] __do_sys_openat fs/open.c:1433 [inline] __se_sys_openat fs/open.c:1428 [inline] __x64_sys_openat+0x15d/0x1c0 fs/open.c:1428 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf6/0x210 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f01076903ad Code: c3 e8 a7 2b 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89
f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f01084acfc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f01077cbf80 RCX: 00007f01076903ad
RDX: 0000000000105042 RSI: 0000000020000080 RDI: ffffffffffffff9c
RBP: 00007f01077cbf80 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000000
R13: 00007f01077cbf80 R14: 00007f010764fc90 R15: 00007f010848d000
</TASK> ==================================================================
And a general protection fault in ocfs2_prepare_dir_for_insert:
==================================================================
loop0: detected capacity change from 0 to 32768
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data mode.
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 0 UID: 0 PID: 5096 Comm: syz-executor792 Not tainted 6.11.0-rc4-syzkaller-00002-gb0da640826ba #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 RIP: 0010:ocfs2_find_dir_space_id fs/ocfs2/dir.c:3406 [inline] RIP: 0010:ocfs2_prepare_dir_for_insert+0x3309/0x5c70 fs/ocfs2/dir.c:4280 Code: 00 00 e8 2a 25 13 fe e9 ba 06 00 00 e8 20 25 13 fe e9 4f 01 00 00 e8 16 25 13 fe 49 8d 7f 08 49 8d 5f 09 48 89 f8 48 c1 e8 03 <42> 0f b6 04 20 84 c0 0f 85 bd 23 00 00 48 89 d8 48 c1 e8 03 42 0f RSP: 0018:ffffc9000af9f020 EFLAGS: 00010202 RAX: 0000000000000001 RBX: 0000000000000009 RCX: ffff88801e27a440 RDX: 0000000000000000 RSI: 0000000000000400 RDI: 0000000000000008 RBP: ffffc9000af9f830 R08: ffffffff8380395b R09: ffffffff838090a7 R10: 0000000000000002 R11: ffff88801e27a440 R12: dffffc0000000000 R13: ffff88803c660878 R14: f700000000000088 R15: 0000000000000000 FS: 000055555a677380(0000) GS:ffff888020800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000560bce569178 CR3: 000000001de5a000 CR4: 0000000000350ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ocfs2_mknod+0xcaf/0x2b40 fs/ocfs2/namei.c:292 vfs_mknod+0x36d/0x3b0 fs/namei.c:4088 do_mknodat+0x3ec/0x5b0 __do_sys_mknodat fs/namei.c:4166 [inline] __se_sys_mknodat fs/namei.c:4163 [inline] __x64_sys_mknodat+0xa7/0xc0 fs/namei.c:4163 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f2dafda3a99 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 48 89
f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe336a6658 EFLAGS: 00000246 ORIG_RAX:
0000000000000103
RAX: ffffffffffffffda RBX: 0000000000000000 RCX:00007f2dafda3a99
RDX: 00000000000021c0 RSI: 0000000020000040 RDI:00000000ffffff9c
RBP: 00007f2dafe1b5f0 R08: 0000000000004480 R09:000055555a6784c0
R10: 0000000000000103 R11: 0000000000000246 R12:00007ffe336a6680
R13: 00007ffe336a68a8 R14: 431bde82d7b634db R15:00007f2dafdec03b
</TASK> ==================================================================
The two reports are all caused invalid negative i_size of dir inode. For ocfs2, dir_inode can't be negative or zero.
Here add a check in which is called by ocfs2_check_dir_for_entry(). It fixes the second report as ocfs2_check_dir_for_entry() must be called before ocfs2_prepare_dir_for_insert(). Also set a up limit for dir with OCFS2_INLINE_DATA_FL. The i_size can't be great than blocksize.
--- fs/ocfs2/dir.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
fs/ocfs2/dir.c +21 -4
@@ -1067,26 +1067,39 @@ int ocfs2_find_entry(const char *name, i {struct buffer_head *bh;struct ocfs2_dir_entry *res_dir =NULL ; +int ret =0 ;if (ocfs2_dir_indexed (dir))return ocfs2_find_entry_dx (name, namelen, dir, lookup); +if (unlikely (i_size_read (dir) <=0 )) { + ret = -EFSCORRUPTED ; +mlog_errno (ret); + goto out; + }/* * The unindexed dir code only uses part of the lookup * structure, so there's no reason to push it down further * than this. */ -if (OCFS2_I (dir)->ip_dyn_features &OCFS2_INLINE_DATA_FL ) +if (OCFS2_I (dir)->ip_dyn_features &OCFS2_INLINE_DATA_FL ) { +if (unlikely (i_size_read (dir) > dir->i_sb->s_blocksize)) { + ret = -EFSCORRUPTED ; +mlog_errno (ret); + goto out; + } bh =ocfs2_find_entry_id (name, namelen, dir, &res_dir); -else + }else { bh =ocfs2_find_entry_el (name, namelen, dir, &res_dir); + }if (bh ==NULL )return -ENOENT ; lookup->dl_leaf_bh = bh; lookup->dl_entry = res_dir; -return 0 ; +out: +return ret; }/*
@@ -2013,6 +2026,7 @@ int ocfs2_lookup_ino_from_name(struct in* * Return 0 if the name does not exist * Return -EEXIST if the directory contains the name +* Return -EFSCORRUPTED if found corruption * * Callers should have i_mutex + a cluster lock on dir */
@@ -2026,9 +2040,12 @@ int ocfs2_check_dir_for_entry(struct inotrace_ocfs2_check_dir_for_entry ( (unsigned long long )OCFS2_I (dir)->ip_blkno, namelen, name); -if (ocfs2_find_entry (name, namelen, dir, &lookup) ==0 ) { + ret =ocfs2_find_entry (name, namelen, dir, &lookup); +if (ret ==0 ) { ret = -EEXIST ;mlog_errno (ret); + }else if (ret == -ENOENT ) { + ret =0 ; }ocfs2_free_dir_lookup_result (&lookup);
Greg Kroah-Hartman
maintainerPATCH 224/462 mptcp: prevent excessive coalescing on receive
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 56b824eb49d6258aa0bad09a406ceac3f643cdae upstream.
Currently the skb size after coalescing is only limited by the skb layout (the skb must not carry frag_list). A single coalesced skb covering several MSS can potentially fill completely the receive buffer. In such a case, the snd win will zero until the receive buffer will be empty again, affecting tput badly.
--- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
@@ -125,6 +125,7 @@ static bool mptcp_try_coalesce(struct soint delta;if (MPTCP_SKB_CB (from)->offset || + ((to->len + from->len) > (sk->sk_rcvbuf >>3 )) || !skb_try_coalesce (to, from, &fragstolen, &delta))return false;
Greg Kroah-Hartman
maintainerPATCH 225/462 nfsd: clear acl_access/acl_default after releasing them
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Lingfeng <[email protected]>
commit 7faf14a7b0366f153284db0ad3347c457ea70136 upstream.
If getting acl_default fails, acl_access and acl_default will be released simultaneously. However, acl_access will still retain a pointer pointing to the released posix_acl, which will trigger a WARNING in nfs3svc_release_getacl like this:
------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 26 PID: 3199 at lib/refcount.c:28 refcount_warn_saturate+0xb5/0x170 Modules linked in: CPU: 26 UID: 0 PID: 3199 Comm: nfsd Not tainted 6.12.0-rc6-00079-g04ae226af01f-dirty #8 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 RIP: 0010:refcount_warn_saturate+0xb5/0x170 Code: cc cc 0f b6 1d b3 20 a5 03 80 fb 01 0f 87 65 48 d8 00 83 e3 01 75 e4 48 c7 c7 c0 3b 9b 85 c6 05 97 20 a5 03 01 e8 fb 3e 30 ff <0f> 0b eb cd 0f b6 1d 8a3 RSP: 0018:ffffc90008637cd8 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff83904fde RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffff88871ed36380 RBP: ffff888158beeb40 R08: 0000000000000001 R09: fffff520010c6f56 R10: ffffc90008637ab7 R11: 0000000000000001 R12: 0000000000000001 R13: ffff888140e77400 R14: ffff888140e77408 R15: ffffffff858b42c0 FS: 0000000000000000(0000) GS:ffff88871ed00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000562384d32158 CR3: 000000055cc6a000 CR4: 00000000000006f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ? refcount_warn_saturate+0xb5/0x170 ? __warn+0xa5/0x140 ? refcount_warn_saturate+0xb5/0x170 ? report_bug+0x1b1/0x1e0 ? handle_bug+0x53/0xa0 ? exc_invalid_op+0x17/0x40 ? asm_exc_invalid_op+0x1a/0x20 ? tick_nohz_tick_stopped+0x1e/0x40 ? refcount_warn_saturate+0xb5/0x170 ? refcount_warn_saturate+0xb5/0x170 nfs3svc_release_getacl+0xc9/0xe0 svc_process_common+0x5db/0xb60 ? __pfx_svc_process_common+0x10/0x10 ? __rcu_read_unlock+0x69/0xa0 ? __pfx_nfsd_dispatch+0x10/0x10 ? svc_xprt_received+0xa1/0x120 ? xdr_init_decode+0x11d/0x190 svc_process+0x2a7/0x330 svc_handle_xprt+0x69d/0x940 svc_recv+0x180/0x2d0 nfsd+0x168/0x200 ? __pfx_nfsd+0x10/0x10 kthread+0x1a2/0x1e0 ? kthread+0xf4/0x1e0 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x34/0x60 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> Kernel panic - not syncing: kernel: panic_on_warn set ...
Clear acl_access/acl_default after posix_acl_release is called to prevent UAF from being triggered.
--- fs/nfsd/nfs2acl.c | 2 ++ fs/nfsd/nfs3acl.c | 2 ++ 2 files changed, 4 insertions(+)
fs/nfsd/nfs2acl.c +2 -0
@@ -84,6 +84,8 @@ out: fail:posix_acl_release (resp->acl_access);posix_acl_release (resp->acl_default); + resp->acl_access =NULL ; + resp->acl_default =NULL ; goto out; }
fs/nfsd/nfs3acl.c +2 -0
@@ -76,6 +76,8 @@ out: fail:posix_acl_release (resp->acl_access);posix_acl_release (resp->acl_default); + resp->acl_access =NULL ; + resp->acl_default =NULL ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 226/462 NFSD: fix hang in nfsd4_shutdown_callback
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dai Ngo <[email protected]>
commit 036ac2778f7b28885814c6fbc07e156ad1624d03 upstream.
If nfs4_client is in courtesy state then there is no point to send the callback. This causes nfsd4_shutdown_callback to hang since cl_cb_inflight is not 0. This hang lasts about 15 minutes until TCP notifies NFSD that the connection was dropped.
This patch modifies nfsd4_run_cb_work to skip the RPC call if nfs4_client is in courtesy state.
--- fs/nfsd/nfs4callback.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/nfsd/nfs4callback.c +5 -2
@@ -1410,8 +1410,11 @@ nfsd4_run_cb_work(struct work_struct *wonfsd4_process_cb_update (cb); clnt = clp->cl_cb_client; -if (!clnt) { -/* Callback channel broken, or client killed; give up: */ +if (!clnt || clp->cl_state ==NFSD4_COURTESY ) { +/* +* Callback channel broken, client killed or +* nfs4_client in courtesy state; give up. +*/ nfsd41_destroy_cb (cb);return ; }
Greg Kroah-Hartman
maintainerPATCH 227/462 HID: multitouch: Add NULL check in mt_input_configured
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Han <[email protected]>
[ Upstream commit 9b8e2220d3a052a690b1d1b23019673e612494c5 ]
devm_kasprintf() can return a NULL pointer on failure,but this returned value in mt_input_configured() is not checked. Add NULL check in mt_input_configured(), to handle kernel NULL pointer dereference error.
--- drivers/hid/hid-multitouch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +4 -1
@@ -1594,9 +1594,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)break ; } -if (suffix) +if (suffix) { hi->input->name =devm_kasprintf (&hdev->dev,GFP_KERNEL ,"%s %s" , hdev->name, suffix); +if (!hi->input->name) +return -ENOMEM ; + }return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 228/462 ndisc: ndisc_send_redirect() must use dev_get_by_index_rcu()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 48145a57d4bbe3496e8e4880b23ea6b511e6e519 ]
ndisc_send_redirect() is called under RCU protection, not RTNL.
It must use dev_get_by_index_rcu() instead of __dev_get_by_index()
--- net/ipv6/ndisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ndisc.c +1 -1
@@ -1607,7 +1607,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)bool ret;if (netif_is_l3_master (skb->dev)) { - dev =__dev_get_by_index (dev_net (skb->dev),IPCB (skb)->iif); + dev =dev_get_by_index_rcu (dev_net (skb->dev),IPCB (skb)->iif);if (!dev)return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 229/462 vrf: use RCU protection in l3mdev_l3_out()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 6d0ce46a93135d96b7fa075a94a88fe0da8e8773 ]
l3mdev_l3_out() can be called without RCU being held:
raw_sendmsg()
ip_push_pending_frames()
ip_send_skb()
ip_local_out()
__ip_local_out()
l3mdev_ip_out()Add rcu_read_lock() / rcu_read_unlock() pair to avoid a potential UAF.
--- include/net/l3mdev.h | 2 ++ 1 file changed, 2 insertions(+)
include/net/l3mdev.h +2 -0
@@ -198,10 +198,12 @@ struct sk_buff *l3mdev_l3_out(struct sock *sk, struct sk_buff *skb, u16 proto)if (netif_is_l3_slave (dev)) {struct net_device *master; +rcu_read_lock (); master =netdev_master_upper_dev_get_rcu (dev);if (master && master->l3mdev_ops->l3mdev_l3_out) skb = master->l3mdev_ops->l3mdev_l3_out (master, sk, skb, proto); +rcu_read_unlock (); }return skb;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 230/462 team: better TEAM_OPTION_TYPE_STRING validation
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5bef3ac184b5626ea62385d6b82a1992b89d7940 ]
syzbot reported following splat [1]
Make sure user-provided data contains one nul byte.
[1]
BUG: KMSAN: uninit-value in string_nocheck lib/vsprintf.c:633 [inline] BUG: KMSAN: uninit-value in string+0x3ec/0x5f0 lib/vsprintf.c:714 string_nocheck lib/vsprintf.c:633 [inline] string+0x3ec/0x5f0 lib/vsprintf.c:714 vsnprintf+0xa5d/0x1960 lib/vsprintf.c:2843 __request_module+0x252/0x9f0 kernel/module/kmod.c:149 team_mode_get drivers/net/team/team_core.c:480 [inline] team_change_mode drivers/net/team/team_core.c:607 [inline] team_mode_option_set+0x437/0x970 drivers/net/team/team_core.c:1401 team_option_set drivers/net/team/team_core.c:375 [inline] team_nl_options_set_doit+0x1339/0x1f90 drivers/net/team/team_core.c:2662 genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline] genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0x1214/0x12c0 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x375/0x650 net/netlink/af_netlink.c:2543 genl_rcv+0x40/0x60 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline] netlink_unicast+0xf52/0x1260 net/netlink/af_netlink.c:1348 netlink_sendmsg+0x10da/0x11e0 net/netlink/af_netlink.c:1892 sock_sendmsg_nosec net/socket.c:718 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:733 ____sys_sendmsg+0x877/0xb60 net/socket.c:2573 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2627 __sys_sendmsg net/socket.c:2659 [inline] __do_sys_sendmsg net/socket.c:2664 [inline] __se_sys_sendmsg net/socket.c:2662 [inline] __x64_sys_sendmsg+0x212/0x3c0 net/socket.c:2662 x64_sys_call+0x2ed6/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:47 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- drivers/net/team/team.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/team/team.c +3 -1
@@ -2664,7 +2664,9 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) ctx.data.u32_val =nla_get_u32 (attr_data);break ;case TEAM_OPTION_TYPE_STRING : -if (nla_len (attr_data) >TEAM_STRING_MAX_LEN ) { +if (nla_len (attr_data) >TEAM_STRING_MAX_LEN || + !memchr (nla_data (attr_data),'\0' , +nla_len (attr_data))) { err = -EINVAL ; goto team_put; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 231/462 arm64: cacheinfo: Avoid out-of-bounds write to cacheinfo array
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radu Rendec <[email protected]>
[ Upstream commit 875d742cf5327c93cba1f11e12b08d3cce7a88d2 ]
The loop that detects/populates cache information already has a bounds check on the array size but does not account for cache levels with separate data/instructions cache. Fix this by incrementing the index for any populated leaf (instead of any populated level).
--- arch/arm64/kernel/cacheinfo.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
arch/arm64/kernel/cacheinfo.c +7 -5
@@ -87,16 +87,18 @@ int populate_cache_leaves(unsigned int cpu)unsigned int level, idx;enum cache_type type;struct cpu_cacheinfo *this_cpu_ci =get_cpu_cacheinfo (cpu); -struct cacheinfo *this_leaf = this_cpu_ci->info_list; +struct cacheinfo *infos = this_cpu_ci->info_list;for (idx =0 , level =1 ; level <= this_cpu_ci->num_levels && - idx < this_cpu_ci->num_leaves; idx++, level++) { + idx < this_cpu_ci->num_leaves; level++) { type =get_cache_type (level);if (type ==CACHE_TYPE_SEPARATE ) { -ci_leaf_init (this_leaf++,CACHE_TYPE_DATA , level); -ci_leaf_init (this_leaf++,CACHE_TYPE_INST , level); +if (idx +1 >= this_cpu_ci->num_leaves) +break ; +ci_leaf_init (&infos[idx++],CACHE_TYPE_DATA , level); +ci_leaf_init (&infos[idx++],CACHE_TYPE_INST , level); }else { -ci_leaf_init (this_leaf++, type, level); +ci_leaf_init (&infos[idx++], type, level); } }return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 232/462 gpio: bcm-kona: Fix GPIO lock/unlock for banks above bank 0
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Weber <[email protected]>
[ Upstream commit de1d0d160f64ee76df1d364d521b2faf465a091c ]
The GPIO lock/unlock functions clear/write a bit to the relevant register for each bank. However, due to an oversight the bit that was being written was based on the total GPIO number, not the index of the GPIO within the relevant bank, causing it to fail for any GPIO above 32 (thus any GPIO for banks above bank 0).
Fix lock/unlock for these banks by using the correct bit.
--- drivers/gpio/gpio-bcm-kona.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpio/gpio-bcm-kona.c +4 -2
@@ -93,11 +93,12 @@ static void bcm_kona_gpio_lock_gpio(struct bcm_kona_gpio *kona_gpio,u32 val;unsigned long flags;int bank_id =GPIO_BANK (gpio); +int bit =GPIO_BIT (gpio);raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val |=BIT (gpio); + val |=BIT (bit);bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val);raw_spin_unlock_irqrestore (&kona_gpio->lock, flags);
@@ -109,11 +110,12 @@ static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,u32 val;unsigned long flags;int bank_id =GPIO_BANK (gpio); +int bit =GPIO_BIT (gpio);raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val &= ~BIT (gpio); + val &= ~BIT (bit);bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val);raw_spin_unlock_irqrestore (&kona_gpio->lock, flags);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 233/462 gpio: bcm-kona: Make sure GPIO bits are unlocked when requesting IRQ
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Weber <[email protected]>
[ Upstream commit 57f5db77a915cc29461a679a6bcae7097967be1a ]
The settings for all GPIOs are locked by default in bcm_kona_gpio_reset. The settings for a GPIO are unlocked when requesting it as a GPIO, but not when requesting it as an interrupt, causing the IRQ settings to not get applied.
Fix this by making sure to unlock the right bits when an IRQ is requested. To avoid a situation where an IRQ being released causes a lock despite the same GPIO being used by a GPIO request or vice versa, add an unlock counter and only lock if it reaches 0.
--- drivers/gpio/gpio-bcm-kona.c | 67 +++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 12 deletions(-)
drivers/gpio/gpio-bcm-kona.c +55 -12
@@ -76,6 +76,22 @@ struct bcm_kona_gpio {struct bcm_kona_gpio_bank {int id;int irq; +/* +* Used to keep track of lock/unlock operations for each GPIO in the +* bank. +* +* All GPIOs are locked by default (see bcm_kona_gpio_reset), and the +* unlock count for all GPIOs is 0 by default. Each unlock increments +* the counter, and each lock decrements the counter. +* +* The lock function only locks the GPIO once its unlock counter is +* down to 0. This is necessary because the GPIO is unlocked in two +* places in this driver: once for requested GPIOs, and once for +* requested IRQs. Since it is possible for a GPIO to be requested +* as both a GPIO and an IRQ, we need to ensure that we don't lock it +* too early. +*/ +u8 gpio_unlock_count[GPIO_PER_BANK ];/* Used in the interrupt handler */ struct bcm_kona_gpio *kona_gpio; };
@@ -94,14 +110,23 @@ static void bcm_kona_gpio_lock_gpio(struct bcm_kona_gpio *kona_gpio,unsigned long flags;int bank_id =GPIO_BANK (gpio);int bit =GPIO_BIT (gpio); +struct bcm_kona_gpio_bank *bank = &kona_gpio->banks[bank_id]; -raw_spin_lock_irqsave (&kona_gpio->lock, flags); +if (bank->gpio_unlock_count[bit] ==0 ) { +dev_err (kona_gpio->gpio_chip.parent, +"Unbalanced locks for GPIO %u\n" , gpio); +return ; + } - val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val |=BIT (bit); -bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); +if (--bank->gpio_unlock_count[bit] ==0 ) { +raw_spin_lock_irqsave (&kona_gpio->lock, flags); -raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); + val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); + val |=BIT (bit); +bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); + +raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); + } } static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,
@@ -111,14 +136,19 @@ static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,unsigned long flags;int bank_id =GPIO_BANK (gpio);int bit =GPIO_BIT (gpio); +struct bcm_kona_gpio_bank *bank = &kona_gpio->banks[bank_id]; -raw_spin_lock_irqsave (&kona_gpio->lock, flags); +if (bank->gpio_unlock_count[bit] ==0 ) { +raw_spin_lock_irqsave (&kona_gpio->lock, flags); - val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val &= ~BIT (bit); -bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); + val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); + val &= ~BIT (bit); +bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); -raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); +raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); + } + + ++bank->gpio_unlock_count[bit]; }static int bcm_kona_gpio_get_dir (struct gpio_chip *chip,unsigned gpio)
@@ -369,6 +399,7 @@ static void bcm_kona_gpio_irq_mask(struct irq_data *d) kona_gpio =irq_data_get_irq_chip_data (d); reg_base = kona_gpio->reg_base; +raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (reg_base +GPIO_INT_MASK (bank_id));
@@ -391,6 +422,7 @@ static void bcm_kona_gpio_irq_unmask(struct irq_data *d) kona_gpio =irq_data_get_irq_chip_data (d); reg_base = kona_gpio->reg_base; +raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (reg_base +GPIO_INT_MSKCLR (bank_id));
@@ -488,15 +520,26 @@ static void bcm_kona_gpio_irq_handler(struct irq_desc *desc)static int bcm_kona_gpio_irq_reqres (struct irq_data *d) {struct bcm_kona_gpio *kona_gpio =irq_data_get_irq_chip_data (d); +unsigned int gpio = d->hwirq; + +/* +* We need to unlock the GPIO before any other operations are performed +* on the relevant GPIO configuration registers +*/ +bcm_kona_gpio_unlock_gpio (kona_gpio, gpio); -return gpiochip_reqres_irq (&kona_gpio->gpio_chip, d->hwirq); +return gpiochip_reqres_irq (&kona_gpio->gpio_chip, gpio); }static void bcm_kona_gpio_irq_relres (struct irq_data *d) {struct bcm_kona_gpio *kona_gpio =irq_data_get_irq_chip_data (d); +unsigned int gpio = d->hwirq; + +/* Once we no longer use it, lock the GPIO again */ +bcm_kona_gpio_lock_gpio (kona_gpio, gpio); -gpiochip_relres_irq (&kona_gpio->gpio_chip, d->hwirq); +gpiochip_relres_irq (&kona_gpio->gpio_chip, gpio); }static struct irq_chip bcm_gpio_irq_chip = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 234/462 gpio: bcm-kona: Add missing newline to dev_err format string
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Weber <[email protected]>
[ Upstream commit 615279db222c3ac56d5c93716efd72b843295c1f ]
Add a missing newline to the format string of the "Couldn't get IRQ for bank..." error message.
--- drivers/gpio/gpio-bcm-kona.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-bcm-kona.c +1 -1
@@ -677,7 +677,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev) bank->irq =platform_get_irq (pdev, i); bank->kona_gpio = kona_gpio;if (bank->irq <0 ) { -dev_err (dev,"Couldn't get IRQ for bank %d" , i); +dev_err (dev,"Couldn't get IRQ for bank %d\n" , i); ret = -ENOENT ; goto err_irq_domain; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 235/462 xen: remove a confusing comment on auto-translated guest I/O
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Tesarik <[email protected]>
[ Upstream commit d826c9e61c99120f8996f8fed6417167e32eb922 ]
After removing the conditional return from xen_create_contiguous_region(), the accompanying comment was left in place, but it now precedes an unrelated conditional and confuses readers.
Stable-dep-of: e93ec87286bd ("x86/xen: allow larger contiguous memory regions in PV guests")
--- arch/x86/xen/mmu_pv.c | 6 ------ 1 file changed, 6 deletions(-)
arch/x86/xen/mmu_pv.c +0 -6
@@ -2274,12 +2274,6 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,int success;unsigned long vstart = (unsigned long )phys_to_virt (pstart); -/* -* Currently an auto-translated guest will not perform I/O, nor will -* it require PAE page directories below 4GB. Therefore any calls to -* this function are redundant and can be ignored. -*/ -if (unlikely (order >MAX_CONTIG_ORDER ))return -ENOMEM ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 236/462 x86/xen: allow larger contiguous memory regions in PV guests
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit e93ec87286bd1fd30b7389e7a387cfb259f297e3 ]
Today a PV guest (including dom0) can create 2MB contiguous memory regions for DMA buffers at max. This has led to problems at least with the megaraid_sas driver, which wants to allocate a 2.3MB DMA buffer.
The limiting factor is the frame array used to do the hypercall for making the memory contiguous, which has 512 entries and is just a static array in mmu_pv.c.
In order to not waste memory for non-PV guests, put the initial frame array into .init.data section and dynamically allocate an array from the .init_after_bootmem hook of PV guests.
In case a contiguous memory area larger than the initially supported 2MB is requested, allocate a larger buffer for the frame list. Note that such an allocation is tried only after memory management has been initialized properly, which is tested via a flag being set in the .init_after_bootmem hook.
--- arch/x86/xen/mmu_pv.c | 71 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 62 insertions(+), 9 deletions(-)
arch/x86/xen/mmu_pv.c +62 -9
@@ -95,6 +95,51 @@ static pud_t level3_user_vsyscall[PTRS_PER_PUD] __page_aligned_bss;*/ static DEFINE_SPINLOCK (xen_reservation_lock); +/* Protected by xen_reservation_lock. */ +#define MIN_CONTIG_ORDER 9/* 2MB */ +static unsigned int discontig_frames_order =MIN_CONTIG_ORDER ; +static unsigned long discontig_frames_early[1UL <<MIN_CONTIG_ORDER ]__initdata ; +static unsigned long *discontig_frames__refdata = discontig_frames_early; +static bool discontig_frames_dyn; + +static int alloc_discontig_frames (unsigned int order) +{ +unsigned long *new_array, *old_array; +unsigned int old_order; +unsigned long flags; + +BUG_ON (order <MIN_CONTIG_ORDER ); +BUILD_BUG_ON (sizeof (discontig_frames_early) !=PAGE_SIZE ); + + new_array = (unsigned long *)__get_free_pages (GFP_KERNEL , + order -MIN_CONTIG_ORDER ); +if (!new_array) +return -ENOMEM ; + +spin_lock_irqsave (&xen_reservation_lock, flags); + + old_order = discontig_frames_order; + +if (order > discontig_frames_order || !discontig_frames_dyn) { +if (!discontig_frames_dyn) + old_array =NULL ; +else + old_array = discontig_frames; + + discontig_frames = new_array; + discontig_frames_order = order; + discontig_frames_dyn = true; + }else { + old_array = new_array; + } + +spin_unlock_irqrestore (&xen_reservation_lock, flags); + +free_pages ((unsigned long )old_array, old_order -MIN_CONTIG_ORDER ); + +return 0 ; +} +/* * Note about cr3 (pagetable base) values: *
@@ -791,6 +836,9 @@ static void __init xen_after_bootmem(void)static_branch_enable (&xen_struct_pages_ready);SetPagePinned (virt_to_page (level3_user_vsyscall));xen_pgd_walk (&init_mm, xen_mark_pinned,FIXADDR_TOP ); + +if (alloc_discontig_frames (MIN_CONTIG_ORDER )) +BUG (); } static void xen_unpin_page(struct mm_struct *mm, struct page *page,
@@ -2149,10 +2197,6 @@ void __init xen_init_mmu_ops(void)memset (dummy_mapping,0xff ,PAGE_SIZE ); } -/* Protected by xen_reservation_lock. */ -#define MAX_CONTIG_ORDER 9/* 2MB */ -static unsigned long discontig_frames[1 <<MAX_CONTIG_ORDER ]; -#define VOID_PTE (mfn_pte(0, __pgprot(0))) static void xen_zap_pfn_range(unsigned long vaddr, unsigned int order, unsigned long *in_frames,
@@ -2269,18 +2313,25 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,unsigned int address_bits, dma_addr_t *dma_handle) { - unsigned long *in_frames = discontig_frames, out_frame; + unsigned long *in_frames, out_frame;unsigned long flags;int success;unsigned long vstart = (unsigned long )phys_to_virt (pstart); -if (unlikely (order >MAX_CONTIG_ORDER )) -return -ENOMEM ; +if (unlikely (order > discontig_frames_order)) { +if (!discontig_frames_dyn) +return -ENOMEM ; + +if (alloc_discontig_frames (order)) +return -ENOMEM ; + }memset ((void *) vstart,0 ,PAGE_SIZE << order);spin_lock_irqsave (&xen_reservation_lock, flags); + in_frames = discontig_frames; +/* 1. Zap current PTEs, remembering MFNs. */ xen_zap_pfn_range (vstart, order, in_frames,NULL );
@@ -2304,12 +2355,12 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,void xen_destroy_contiguous_region (phys_addr_t pstart,unsigned int order) { -unsigned long *out_frames = discontig_frames, in_frame; +unsigned long *out_frames, in_frame;unsigned long flags;int success;unsigned long vstart; -if (unlikely (order >MAX_CONTIG_ORDER )) +if (unlikely (order > discontig_frames_order))return ; vstart = (unsigned long )phys_to_virt (pstart);
@@ -2317,6 +2368,8 @@ void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)spin_lock_irqsave (&xen_reservation_lock, flags); + out_frames = discontig_frames; +/* 1. Find start MFN of contiguous extent. */ in_frame =virt_to_mfn (vstart);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 237/462 media: cxd2841er: fix 64-bit division on gcc-9
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 8d46603eeeb4c6abff1d2e49f2a6ae289dac765e ]
It appears that do_div() once more gets confused by a complex expression that ends up not quite being constant despite __builtin_constant_p() thinking it is:
ERROR: modpost: "__aeabi_uldivmod" [drivers/media/dvb-frontends/cxd2841er.ko] undefined!
Use div_u64() instead, forcing the expression to be evaluated first, and making it a bit more readable.
--- drivers/media/dvb-frontends/cxd2841er.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/media/dvb-frontends/cxd2841er.c +2 -6
@@ -311,12 +311,8 @@ static int cxd2841er_set_reg_bits(struct cxd2841er_priv *priv,static u32 cxd2841er_calc_iffreq_xtal (enum cxd2841er_xtal xtal,u32 ifhz) { -u64 tmp; - - tmp = (u64 ) ifhz *16777216 ; -do_div (tmp, ((xtal ==SONY_XTAL_24000 ) ?48000000 :41000000 )); - -return (u32 ) tmp; +return div_u64 (ifhz *16777216ull , + (xtal ==SONY_XTAL_24000 ) ?48000000 :41000000 ); }static u32 cxd2841er_calc_iffreq (u32 ifhz)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 238/462 media: vidtv: Fix a null-ptr-deref in vidtv_mux_stop_thread
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit 1221989555db711578a327a9367f1be46500cb48 ]
syzbot report a null-ptr-deref in vidtv_mux_stop_thread. [1]
If dvb->mux is not initialized successfully by vidtv_mux_init() in the vidtv_start_streaming(), it will trigger null pointer dereference about mux in vidtv_mux_stop_thread().
Adjust the timing of streaming initialization and check it before stopping it.
[1]
KASAN: null-ptr-deref in range [0x0000000000000128-0x000000000000012f] CPU: 0 UID: 0 PID: 5842 Comm: syz-executor248 Not tainted 6.13.0-rc4-syzkaller-00012-g9b2ffa6148b1 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 RIP: 0010:vidtv_mux_stop_thread+0x26/0x80 drivers/media/test-drivers/vidtv/vidtv_mux.c:471 Code: 90 90 90 90 66 0f 1f 00 55 53 48 89 fb e8 82 2e c8 f9 48 8d bb 28 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 02 7e 3b 0f b6 ab 28 01 00 00 31 ff 89 ee e8 RSP: 0018:ffffc90003f2faa8 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff87cfb125 RDX: 0000000000000025 RSI: ffffffff87d120ce RDI: 0000000000000128 RBP: ffff888029b8d220 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000003 R12: ffff888029b8d188 R13: ffffffff8f590aa0 R14: ffffc9000581c5c8 R15: ffff888029a17710 FS: 00007f7eef5156c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f7eef5e635c CR3: 0000000076ca6000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> vidtv_stop_streaming drivers/media/test-drivers/vidtv/vidtv_bridge.c:209 [inline] vidtv_stop_feed+0x151/0x250 drivers/media/test-drivers/vidtv/vidtv_bridge.c:252 dmx_section_feed_stop_filtering+0x90/0x160 drivers/media/dvb-core/dvb_demux.c:1000 dvb_dmxdev_feed_stop.isra.0+0x1ee/0x270 drivers/media/dvb-core/dmxdev.c:486 dvb_dmxdev_filter_stop+0x22a/0x3a0 drivers/media/dvb-core/dmxdev.c:559 dvb_dmxdev_filter_free drivers/media/dvb-core/dmxdev.c:840 [inline] dvb_demux_release+0x92/0x550 drivers/media/dvb-core/dmxdev.c:1246 __fput+0x3f8/0xb60 fs/file_table.c:450 task_work_run+0x14e/0x250 kernel/task_work.c:239 get_signal+0x1d3/0x2610 kernel/signal.c:2790 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x150/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- drivers/media/test-drivers/vidtv/vidtv_bridge.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/test-drivers/vidtv/vidtv_bridge.c +7 -1
@@ -189,10 +189,11 @@ static int vidtv_start_streaming(struct vidtv_dvb *dvb) mux_args.mux_buf_sz = mux_buf_sz; - dvb->streaming = true; dvb->mux =vidtv_mux_init (dvb->fe[0 ], dev, &mux_args);if (!dvb->mux)return -ENOMEM ; + + dvb->streaming = true;vidtv_mux_start_thread (dvb->mux);dev_dbg_ratelimited (dev,"Started streaming\n" );
@@ -203,6 +204,11 @@ static int vidtv_stop_streaming(struct vidtv_dvb *dvb) {struct device *dev = &dvb->pdev->dev; +if (!dvb->streaming) { +dev_warn_ratelimited (dev,"No streaming. Skipping.\n" ); +return 0 ; + } + dvb->streaming = false;vidtv_mux_stop_thread (dvb->mux);vidtv_mux_destroy (dvb->mux);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 239/462 PCI/DPC: Quirk PIO log size for Intel Raptor Lake-P
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit b198499c7d2508a76243b98e7cca992f6fd2b7f7 ]
Apparently the Raptor Lake-P reference firmware configures the PIO log size correctly, but some vendor BIOSes, including at least ASUSTeK COMPUTER INC. Zenbook UX3402VA_UX3402VA, do not.
Apply the quirk for Raptor Lake-P. This prevents kernel complaints like:
DPC: RP PIO log size 0 is invalid
and also enables the DPC driver to dump the RP PIO Log registers when DPC is triggered.
Note that the bug report also mentions 8086:a76e, which has been already added by 627c6db20703 ("PCI/DPC: Quirk PIO log size for Intel Raptor Lake Root Ports").
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -5964,6 +5964,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a2b, dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x9a2d , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x9a2f , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x9a31 , dpc_log_size); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0xa72f , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0xa73f , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0xa76e , dpc_log_size);#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 240/462 vfio/pci: Enable iowrite64 and ioread64 for vfio pci
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ramesh Thomas <[email protected]>
[ Upstream commit 2b938e3db335e3670475e31a722c2bee34748c5a ]
Definitions of ioread64 and iowrite64 macros in asm/io.h called by vfio pci implementations are enclosed inside check for CONFIG_GENERIC_IOMAP. They don't get defined if CONFIG_GENERIC_IOMAP is defined. Include linux/io-64-nonatomic-lo-hi.h to define iowrite64 and ioread64 macros when they are not defined. io-64-nonatomic-lo-hi.h maps the macros to generic implementation in lib/iomap.c. The generic implementation does 64 bit rw if readq/writeq is defined for the architecture, otherwise it would do 32 bit back to back rw.
Note that there are two versions of the generic implementation that differs in the order the 32 bit words are written if 64 bit support is not present. This is not the little/big endian ordering, which is handled separately. This patch uses the lo followed by hi word ordering which is consistent with current back to back implementation in the vfio/pci code.
--- drivers/vfio/pci/vfio_pci_rdwr.c | 1 + 1 file changed, 1 insertion(+)
drivers/vfio/pci/vfio_pci_rdwr.c +1 -0
@@ -16,6 +16,7 @@#include <linux/io.h> #include <linux/vfio.h> #include <linux/vgaarb.h> +#include <linux/io-64-nonatomic-lo-hi.h> #include "vfio_pci_private.h"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 241/462 Grab mm lock before grabbing pt lock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maksym Planeta <[email protected]>
[ Upstream commit 6d002348789bc16e9203e9818b7a3688787e3b29 ]
Function xen_pin_page calls xen_pte_lock, which in turn grab page table lock (ptlock). When locking, xen_pte_lock expect mm->page_table_lock to be held before grabbing ptlock, but this does not happen when pinning is caused by xen_mm_pin_all.
This commit addresses lockdep warning below, which shows up when suspending a Xen VM.
[ 3680.658422] Freezing user space processes
[ 3680.660156] Freezing user space processes completed (elapsed 0.001 seconds)
[ 3680.660182] OOM killer disabled.
[ 3680.660192] Freezing remaining freezable tasks
[ 3680.661485] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[ 3680.685254]
[ 3680.685265] ==================================
[ 3680.685269] WARNING: Nested lock was not taken
[ 3680.685274] 6.12.0+ #16 Tainted: G W
[ 3680.685279] ----------------------------------
[ 3680.685283] migration/0/19 is trying to lock:
[ 3680.685288] ffff88800bac33c0 (ptlock_ptr(ptdesc)#2){+.+.}-{3:3}, at: xen_pin_page+0x175/0x1d0
[ 3680.685303]
[ 3680.685303] but this task is not holding:
[ 3680.685308] init_mm.page_table_lock
[ 3680.685311]
[ 3680.685311] stack backtrace:
[ 3680.685316] CPU: 0 UID: 0 PID: 19 Comm: migration/0 Tainted: G W 6.12.0+ #16
[ 3680.685324] Tainted: [W]=WARN
[ 3680.685328] Stopper: multi_cpu_stop+0x0/0x120 <- __stop_cpus.constprop.0+0x8c/0xd0
[ 3680.685339] Call Trace:
[ 3680.685344] <TASK>
[ 3680.685347] dump_stack_lvl+0x77/0xb0
[ 3680.685356] __lock_acquire+0x917/0x2310
[ 3680.685364] lock_acquire+0xce/0x2c0
[ 3680.685369] ? xen_pin_page+0x175/0x1d0
[ 3680.685373] _raw_spin_lock_nest_lock+0x2f/0x70
[ 3680.685381] ? xen_pin_page+0x175/0x1d0
[ 3680.685386] xen_pin_page+0x175/0x1d0
[ 3680.685390] ? __pfx_xen_pin_page+0x10/0x10
[ 3680.685394] __xen_pgd_walk+0x233/0x2c0
[ 3680.685401] ? stop_one_cpu+0x91/0x100
[ 3680.685405] __xen_pgd_pin+0x5d/0x250
[ 3680.685410] xen_mm_pin_all+0x70/0xa0
[ 3680.685415] xen_pv_pre_suspend+0xf/0x280
[ 3680.685420] xen_suspend+0x57/0x1a0
[ 3680.685428] multi_cpu_stop+0x6b/0x120
[ 3680.685432] ? update_cpumasks_hier+0x7c/0xa60
[ 3680.685439] ? __pfx_multi_cpu_stop+0x10/0x10
[ 3680.685443] cpu_stopper_thread+0x8c/0x140
[ 3680.685448] ? smpboot_thread_fn+0x20/0x1f0
[ 3680.685454] ? __pfx_smpboot_thread_fn+0x10/0x10
[ 3680.685458] smpboot_thread_fn+0xed/0x1f0
[ 3680.685462] kthread+0xde/0x110
[ 3680.685467] ? __pfx_kthread+0x10/0x10
[ 3680.685471] ret_from_fork+0x2f/0x50
[ 3680.685478] ? __pfx_kthread+0x10/0x10
[ 3680.685482] ret_from_fork_asm+0x1a/0x30
[ 3680.685489] </TASK>
[ 3680.685491]
[ 3680.685491] other info that might help us debug this:
[ 3680.685497] 1 lock held by migration/0/19:
[ 3680.685500] #0: ffffffff8284df38 (pgd_lock){+.+.}-{3:3}, at: xen_mm_pin_all+0x14/0xa0
[ 3680.685512]
[ 3680.685512] stack backtrace:
[ 3680.685518] CPU: 0 UID: 0 PID: 19 Comm: migration/0 Tainted: G W 6.12.0+ #16
[ 3680.685528] Tainted: [W]=WARN
[ 3680.685531] Stopper: multi_cpu_stop+0x0/0x120 <- __stop_cpus.constprop.0+0x8c/0xd0
[ 3680.685538] Call Trace:
[ 3680.685541] <TASK>
[ 3680.685544] dump_stack_lvl+0x77/0xb0
[ 3680.685549] __lock_acquire+0x93c/0x2310
[ 3680.685554] lock_acquire+0xce/0x2c0
[ 3680.685558] ? xen_pin_page+0x175/0x1d0
[ 3680.685562] _raw_spin_lock_nest_lock+0x2f/0x70
[ 3680.685568] ? xen_pin_page+0x175/0x1d0
[ 3680.685572] xen_pin_page+0x175/0x1d0
[ 3680.685578] ? __pfx_xen_pin_page+0x10/0x10
[ 3680.685582] __xen_pgd_walk+0x233/0x2c0
[ 3680.685588] ? stop_one_cpu+0x91/0x100
[ 3680.685592] __xen_pgd_pin+0x5d/0x250
[ 3680.685596] xen_mm_pin_all+0x70/0xa0
[ 3680.685600] xen_pv_pre_suspend+0xf/0x280
[ 3680.685607] xen_suspend+0x57/0x1a0
[ 3680.685611] multi_cpu_stop+0x6b/0x120
[ 3680.685615] ? update_cpumasks_hier+0x7c/0xa60
[ 3680.685620] ? __pfx_multi_cpu_stop+0x10/0x10
[ 3680.685625] cpu_stopper_thread+0x8c/0x140
[ 3680.685629] ? smpboot_thread_fn+0x20/0x1f0
[ 3680.685634] ? __pfx_smpboot_thread_fn+0x10/0x10
[ 3680.685638] smpboot_thread_fn+0xed/0x1f0
[ 3680.685642] kthread+0xde/0x110
[ 3680.685645] ? __pfx_kthread+0x10/0x10
[ 3680.685649] ret_from_fork+0x2f/0x50
[ 3680.685654] ? __pfx_kthread+0x10/0x10
[ 3680.685657] ret_from_fork_asm+0x1a/0x30
[ 3680.685662] </TASK>
[ 3680.685267] xen:grant_table: Grant tables using version 1 layout
[ 3680.685921] OOM killer enabled.
[ 3680.685934] Restarting tasks ... done.Message-ID: <[email protected]>
--- arch/x86/xen/mmu_pv.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/xen/mmu_pv.c +4 -0
@@ -807,6 +807,7 @@ void xen_mm_pin_all(void) {struct page *page; +spin_lock (&init_mm.page_table_lock);spin_lock (&pgd_lock);list_for_each_entry (page, &pgd_list, lru) {
@@ -817,6 +818,7 @@ void xen_mm_pin_all(void) }spin_unlock (&pgd_lock); +spin_unlock (&init_mm.page_table_lock); } static void __init xen_mark_pinned(struct mm_struct *mm, struct page *page,
@@ -914,6 +916,7 @@ void xen_mm_unpin_all(void) {struct page *page; +spin_lock (&init_mm.page_table_lock);spin_lock (&pgd_lock);list_for_each_entry (page, &pgd_list, lru) {
@@ -925,6 +928,7 @@ void xen_mm_unpin_all(void) }spin_unlock (&pgd_lock); +spin_unlock (&init_mm.page_table_lock); }static void xen_activate_mm (struct mm_struct *prev,struct mm_struct *next)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 242/462 orangefs: fix a oob in orangefs_debug_write
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Marshall <[email protected]>
[ Upstream commit f7c848431632598ff9bce57a659db6af60d75b39 ]
I got a syzbot report: slab-out-of-bounds Read in orangefs_debug_write... several people suggested fixes, I tested Al Viro's suggestion and made this patch.
--- fs/orangefs/orangefs-debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/orangefs/orangefs-debugfs.c +2 -2
@@ -393,9 +393,9 @@ static ssize_t orangefs_debug_write(struct file *file,* Thwart users who try to jamb a ridiculous number * of bytes into the debug file... */ -if (count >ORANGEFS_MAX_DEBUG_STRING_LEN +1 ) { +if (count >ORANGEFS_MAX_DEBUG_STRING_LEN ) { silly = count; - count =ORANGEFS_MAX_DEBUG_STRING_LEN +1 ; + count =ORANGEFS_MAX_DEBUG_STRING_LEN ; } buf =kzalloc (ORANGEFS_MAX_DEBUG_STRING_LEN ,GFP_KERNEL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 243/462 ASoC: Intel: bytcr_rt5640: Add DMI quirk for Vexia Edu Atla 10 tablet 5V
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 6917192378c1ce17ba31df51c4e0d8b1c97a453b ]
The Vexia EDU ATLA 10 tablet comes in 2 different versions with significantly different mainboards. The only outward difference is that the charging barrel on one is marked 5V and the other is marked 9V.
The 5V version mostly works with the BYTCR defaults, except that it is missing a CHAN package in its ACPI tables and the default of using SSP0-AIF2 is wrong, instead SSP0-AIF1 must be used. That and its jack detect signal is not inverted as it usually is.
Add a DMI quirk for the 5V version to fix sound not working.
--- sound/soc/intel/boards/bytcr_rt5640.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
sound/soc/intel/boards/bytcr_rt5640.c +16 -1
@@ -935,7 +935,22 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {BYT_RT5640_SSP0_AIF2 | BYT_RT5640_MCLK_EN), }, - { /* Vexia Edu Atla 10 tablet */ + { +/* Vexia Edu Atla 10 tablet 5V version */ + .matches = { +/* Having all 3 of these not set is somewhat unique */ +DMI_MATCH (DMI_SYS_VENDOR ,"To be filled by O.E.M." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"To be filled by O.E.M." ), +DMI_MATCH (DMI_BOARD_NAME ,"To be filled by O.E.M." ), +/* Above strings are too generic, also match on BIOS date */ + DMI_MATCH(DMI_BIOS_DATE, "05/14/2015"), + }, + .driver_data = (void *)(BYTCR_INPUT_DEFAULTS | +BYT_RT5640_JD_NOT_INV | +BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, + { /* Vexia Edu Atla 10 tablet 9V version */ .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"AMI Corporation" ), DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 244/462 batman-adv: fix panic during interface removal
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Strohman <[email protected]>
commit ccb7276a6d26d6f8416e315b43b45e15ee7f29e2 upstream.
Reference counting is used to ensure that batadv_hardif_neigh_node and batadv_hard_iface are not freed before/during batadv_v_elp_throughput_metric_update work is finished.
But there isn't a guarantee that the hard if will remain associated with a soft interface up until the work is finished.
This fixes a crash triggered by reboot that looks like this:
Call trace: batadv_v_mesh_free+0xd0/0x4dc [batman_adv] batadv_v_elp_throughput_metric_update+0x1c/0xa4 process_one_work+0x178/0x398 worker_thread+0x2e8/0x4d0 kthread+0xd8/0xdc ret_from_fork+0x10/0x20
(the batadv_v_mesh_free call is misleading,
and does not actually happen)
I was able to make the issue happen more reliably by changing hardif_neigh->bat_v.metric_work work to be delayed work. This allowed me to track down and confirm the fix.
[[email protected]: prevent entering batadv_v_elp_get_throughput without
soft_iface]
--- net/batman-adv/bat_v_elp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/batman-adv/bat_v_elp.c +8 -1
@@ -66,12 +66,19 @@ static void batadv_v_elp_start_timer(strstatic u32 batadv_v_elp_get_throughput (struct batadv_hardif_neigh_node *neigh) {struct batadv_hard_iface *hard_iface = neigh->if_incoming; +struct net_device *soft_iface = hard_iface->soft_iface;struct ethtool_link_ksettings link_settings;struct net_device *real_netdev;struct station_info sinfo;u32 throughput;int ret; +/* don't query throughput when no longer associated with any +* batman-adv interface +*/ +if (!soft_iface) +return BATADV_THROUGHPUT_DEFAULT_VALUE ; +/* if the user specified a customised value for this interface, then * return it directly */
@@ -142,7 +149,7 @@ static u32 batadv_v_elp_get_throughput(s default_throughput:if (!(hard_iface->bat_v.flags &BATADV_WARNING_DEFAULT )) { - batadv_info(hard_iface->soft_iface, + batadv_info(soft_iface, "WiFi driver or ethtool info does not provide information about link speeds on interface %s, therefore defaulting to hardcoded throughput values of %u.%1u Mbps. Consider overriding the throughput manually or checking your driver.\n", hard_iface->net_dev->name, BATADV_THROUGHPUT_DEFAULT_VALUE / 10,
Greg Kroah-Hartman
maintainerPATCH 245/462 batman-adv: Ignore neighbor throughput metrics in error case
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit e7e34ffc976aaae4f465b7898303241b81ceefc3 upstream.
If a temporary error happened in the evaluation of the neighbor throughput information, then the invalid throughput result should not be stored in the throughtput EWMA.
--- net/batman-adv/bat_v_elp.c | 50 ++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 16 deletions(-)
net/batman-adv/bat_v_elp.c +34 -16
@@ -59,11 +59,13 @@ static void batadv_v_elp_start_timer(str/** * batadv_v_elp_get_throughput() - get the throughput towards a neighbour * @neigh: the neighbour for which the throughput has to be obtained +* @pthroughput: calculated throughput towards the given neighbour in multiples +* of 100kpbs (a value of '1' equals 0.1Mbps, '10' equals 1Mbps, etc). * -* Return: The throughput towards the given neighbour in multiples of 100kpbs -* (a value of '1' equals 0.1Mbps, '10' equals 1Mbps, etc). +* Return: true when value behind @pthroughput was set */ -static u32 batadv_v_elp_get_throughput (struct batadv_hardif_neigh_node *neigh) +static bool batadv_v_elp_get_throughput (struct batadv_hardif_neigh_node *neigh, +u32 *pthroughput) {struct batadv_hard_iface *hard_iface = neigh->if_incoming;struct net_device *soft_iface = hard_iface->soft_iface;
@@ -77,14 +79,16 @@ static u32 batadv_v_elp_get_throughput(s* batman-adv interface */ if (!soft_iface) -return BATADV_THROUGHPUT_DEFAULT_VALUE ; +return false;/* if the user specified a customised value for this interface, then * return it directly */ throughput =atomic_read (&hard_iface->bat_v.throughput_override); -if (throughput !=0 ) -return throughput; +if (throughput !=0 ) { + *pthroughput = throughput; +return true; + }/* if this is a wireless device, then ask its throughput through * cfg80211 API
@@ -111,19 +115,24 @@ static u32 batadv_v_elp_get_throughput(s* possible to delete this neighbor. For now set * the throughput metric to 0. */ -return 0 ; + *pthroughput =0 ; +return true; }if (ret) goto default_throughput; -if (sinfo.filled &BIT (NL80211_STA_INFO_EXPECTED_THROUGHPUT )) -return sinfo.expected_throughput /100 ; +if (sinfo.filled &BIT (NL80211_STA_INFO_EXPECTED_THROUGHPUT )) { + *pthroughput = sinfo.expected_throughput /100 ; +return true; + }/* try to estimate the expected throughput based on reported tx * rates */ -if (sinfo.filled &BIT (NL80211_STA_INFO_TX_BITRATE )) -return cfg80211_calculate_bitrate (&sinfo.txrate) /3 ; +if (sinfo.filled &BIT (NL80211_STA_INFO_TX_BITRATE )) { + *pthroughput =cfg80211_calculate_bitrate (&sinfo.txrate) /3 ; +return true; + } goto default_throughput; }
@@ -143,8 +152,10 @@ static u32 batadv_v_elp_get_throughput(s hard_iface->bat_v.flags &= ~BATADV_FULL_DUPLEX ; throughput = link_settings.base.speed; -if (throughput && throughput !=SPEED_UNKNOWN ) -return throughput *10 ; +if (throughput && throughput !=SPEED_UNKNOWN ) { + *pthroughput = throughput *10 ; +return true; + } } default_throughput:
@@ -158,7 +169,8 @@ default_throughput: }/* if none of the above cases apply, return the base_throughput */ -return BATADV_THROUGHPUT_DEFAULT_VALUE ; + *pthroughput =BATADV_THROUGHPUT_DEFAULT_VALUE ; +return true; }/**
@@ -170,15 +182,21 @@ void batadv_v_elp_throughput_metric_upda {struct batadv_hardif_neigh_node_bat_v *neigh_bat_v;struct batadv_hardif_neigh_node *neigh; +u32 throughput; +bool valid; neigh_bat_v = container_of(work, struct batadv_hardif_neigh_node_bat_v, metric_work); neigh = container_of(neigh_bat_v, struct batadv_hardif_neigh_node, bat_v); -ewma_throughput_add (&neigh->bat_v.throughput, -batadv_v_elp_get_throughput (neigh)); + valid =batadv_v_elp_get_throughput (neigh, &throughput); +if (!valid) + goto put_neigh; + +ewma_throughput_add (&neigh->bat_v.throughput, throughput); +put_neigh:/* decrement refcounter to balance increment performed before scheduling * this task */
Greg Kroah-Hartman
maintainerPATCH 246/462 perf/x86/intel: Ensure LBRs are disabled when a CPU is starting
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit c631a2de7ae48d50434bdc205d901423f8577c65 upstream.
Explicitly clear DEBUGCTL.LBR when a CPU is starting, prior to purging the LBR MSRs themselves, as at least one system has been found to transfer control to the kernel with LBRs enabled (it's unclear whether it's a BIOS flaw or a CPU goof). Because the kernel preserves the original DEBUGCTL, even when toggling LBRs, leaving DEBUGCTL.LBR as is results in running with LBRs enabled at all times.
--- arch/x86/events/intel/core.c | 5 ++++- arch/x86/include/asm/msr-index.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)
arch/x86/events/intel/core.c +4 -1
@@ -4078,8 +4078,11 @@ static void intel_pmu_cpu_starting(int cinit_debug_store_on_cpu (cpu);/* -* Deal with CPUs that don't clear their LBRs on power-up. +* Deal with CPUs that don't clear their LBRs on power-up, and that may +* even boot with LBRs enabled. */ +if (!static_cpu_has (X86_FEATURE_ARCH_LBR ) && x86_pmu.lbr_nr) +msr_clear_bit (MSR_IA32_DEBUGCTLMSR ,DEBUGCTLMSR_LBR_BIT );intel_pmu_lbr_reset (); cpuc->lbr_sel =NULL ;
arch/x86/include/asm/msr-index.h +2 -1
@@ -326,7 +326,8 @@#define MSR_IA32_PASID_VALID BIT_ULL(31)/* DEBUGCTLMSR bits (others vary by model): */ -#define DEBUGCTLMSR_LBR (1UL << 0)/* last branch recording */ +#define DEBUGCTLMSR_LBR_BIT 0/* last branch recording */ +#define DEBUGCTLMSR_LBR (1UL << DEBUGCTLMSR_LBR_BIT)#define DEBUGCTLMSR_BTF_SHIFT 1#define DEBUGCTLMSR_BTF (1UL << 1)/* single-step on branches */ #define DEBUGCTLMSR_TR (1UL << 6)
Greg Kroah-Hartman
maintainerPATCH 247/462 usb: roles: set switch registered flag early on
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Elson Roy Serrao <[email protected]>
commit 634775a752a86784511018a108f3b530cc3399a7 upstream.
The role switch registration and set_role() can happen in parallel as they are invoked independent of each other. There is a possibility that a driver might spend significant amount of time in usb_role_switch_register() API due to the presence of time intensive operations like component_add() which operate under common mutex. This leads to a time window after allocating the switch and before setting the registered flag where the set role notifications are dropped. Below timeline summarizes this behavior
Thread1 | Thread2usb_role_switch_register() |
| | ---> allocate switch | | | ---> component_add() | usb_role_switch_set_role() | | | | | --> Drop role notifications | | since sw->registered | | flag is not set. | | --->Set registered flag.|
To avoid this, set the registered flag early on in the switch register API.
--- drivers/usb/roles/class.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/roles/class.c +3 -2
@@ -345,14 +345,15 @@ usb_role_switch_register(struct device *dev_set_name (&sw->dev,"%s-role-switch" , desc->name ? desc->name :dev_name (parent)); + sw->registered = true; + ret =device_register (&sw->dev);if (ret) { + sw->registered = false;put_device (&sw->dev);return ERR_PTR (ret); } - sw->registered = true; -/* TODO: Symlinks for the host port and the device controller. */ return sw;
Greg Kroah-Hartman
maintainerPATCH 248/462 usb: gadget: udc: renesas_usb3: Fix compiler warning
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guo Ren <[email protected]>
commit 335a1fc1193481f8027f176649c72868172f6f8b upstream.
drivers/usb/gadget/udc/renesas_usb3.c: In function 'renesas_usb3_probe':drivers/usb/gadget/udc/renesas_usb3.c:2638:73: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 6 [-Wformat-truncation=]
2638 | snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
^~~~~~~~~~~~~~~~~~~~~~~~ ^~ ^--- drivers/usb/gadget/udc/renesas_usb3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/renesas_usb3.c +1 -1
@@ -306,7 +306,7 @@ struct renesas_usb3_request {struct list_head queue; }; -#define USB3_EP_NAME_SIZE 8 +#define USB3_EP_NAME_SIZE 16struct renesas_usb3_ep {struct usb_ep ep;struct renesas_usb3 *usb3;
Greg Kroah-Hartman
maintainerPATCH 249/462 usb: dwc2: gadget: remove of_node reference upon udc_stop
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabrice Gasnier <[email protected]>
commit 58cd423820d5b5610977e55e4acdd06628829ede upstream.
In dwc2_hsotg_udc_start(), e.g. when binding composite driver, "of_node" is set to hsotg->dev->of_node.
It causes errors when binding the gadget driver several times, on stm32mp157c-ev1 board. Below error is seen:
"pin PA10 already requested by 49000000.usb-otg; cannot claim for gadget.0"
The first time, no issue is seen as when registering the driver, of_node isn't NULL:
-> gadget_dev_desc_UDC_store
-> usb_gadget_register_driver_owner
-> driver_register
...
-> really_probe -> pinctrl_bind_pins (no effect)Then dwc2_hsotg_udc_start() sets of_node.
The second time (stop the gadget, reconfigure it, then start it again), of_node has been set, so the probing code tries to acquire pins for the gadget. These pins are hold by the controller, hence the error.
So clear gadget.dev.of_node in udc_stop() routine to avoid the issue.
--- drivers/usb/dwc2/gadget.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc2/gadget.c +1 -0
@@ -4581,6 +4581,7 @@ static int dwc2_hsotg_udc_stop(struct usspin_lock_irqsave (&hsotg->lock, flags); hsotg->driver =NULL ; + hsotg->gadget.dev.of_node =NULL ; hsotg->gadget.speed =USB_SPEED_UNKNOWN ; hsotg->enabled =0 ;
Greg Kroah-Hartman
maintainerPATCH 250/462 USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit e71f7f42e3c874ac3314b8f250e8416a706165af upstream.
LS7A EHCI controller doesn't have extended capabilities, so the EECP (EHCI Extended Capabilities Pointer) field of HCCPARAMS register should be 0x0, but it reads as 0xa0 now. This is a hardware flaw and will be fixed in future, now just clear the EECP field to avoid error messages on boot:
......
[ 0.581675] pci 0000:00:04.1: EHCI: unrecognized capability ff [ 0.581699] pci 0000:00:04.1: EHCI: unrecognized capability ff [ 0.581716] pci 0000:00:04.1: EHCI: unrecognized capability ff [ 0.581851] pci 0000:00:04.1: EHCI: unrecognized capability ff ...... [ 0.581916] pci 0000:00:05.1: EHCI: unrecognized capability ff [ 0.581951] pci 0000:00:05.1: EHCI: unrecognized capability ff [ 0.582704] pci 0000:00:05.1: EHCI: unrecognized capability ff [ 0.582799] pci 0000:00:05.1: EHCI: unrecognized capability ff
......
--- drivers/usb/host/pci-quirks.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/host/pci-quirks.c +9 -0
@@ -948,6 +948,15 @@ static void quirk_usb_disable_ehci(struc* booting from USB disk or using a usb keyboard */ hcc_params =readl (base +EHCI_HCC_PARAMS ); + +/* LS7A EHCI controller doesn't have extended capabilities, the +* EECP (EHCI Extended Capabilities Pointer) field of HCCPARAMS +* register should be 0x0 but it reads as 0xa0. So clear it to +* avoid error messages on boot. +*/ +if (pdev->vendor ==PCI_VENDOR_ID_LOONGSON && pdev->device ==0x7a14 ) + hcc_params &= ~(0xffL <<8 ); + offset = (hcc_params >>8 ) &0xff ;while (offset && --count) {pci_read_config_dword (pdev, offset, &cap);
Greg Kroah-Hartman
maintainerPATCH 251/462 usb: core: fix pipe creation for get_bMaxPacketSize0
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Eichenberger <[email protected]>
commit 4aac0db5a0ebc599d4ad9bf5ebab78afa1f33e10 upstream.
When usb_control_msg is used in the get_bMaxPacketSize0 function, the USB pipe does not include the endpoint device number. This can cause failures when a usb hub port is reinitialized after encountering a bad cable connection. As a result, the system logs the following error messages:
usb usb2-port1: cannot reset (err = -32)
usb usb2-port1: Cannot enable. Maybe the USB cable is bad? usb usb2-port1: attempt power cycle
usb 2-1: new high-speed USB device number 5 using ci_hdrc usb 2-1: device descriptor read/8, error -71
The problem began after commit 85d07c556216 ("USB: core: Unite old scheme and new scheme descriptor reads"). There usb_get_device_descriptor was replaced with get_bMaxPacketSize0. Unlike usb_get_device_descriptor, the get_bMaxPacketSize0 function uses the macro usb_rcvaddr0pipe, which does not include the endpoint device number. usb_get_device_descriptor, on the other hand, used the macro usb_rcvctrlpipe, which includes the endpoint device number.
By modifying the get_bMaxPacketSize0 function to use usb_rcvctrlpipe instead of usb_rcvaddr0pipe, the issue can be resolved. This change will ensure that the endpoint device number is included in the USB pipe, preventing reinitialization failures. If the endpoint has not set the device number yet, it will still work because the device number is 0 in udev.
--- drivers/usb/core/hub.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/core/hub.c +1 -2
@@ -4644,7 +4644,6 @@ void usb_ep0_reinit(struct usb_device *uEXPORT_SYMBOL_GPL (usb_ep0_reinit);#define usb_sndaddr0pipe () (PIPE_CONTROL << 30) -#define usb_rcvaddr0pipe () ((PIPE_CONTROL << 30) | USB_DIR_IN)static int hub_set_address (struct usb_device *udev,int devnum) {
@@ -4745,7 +4744,7 @@ static int get_bMaxPacketSize0(struct usfor (i =0 ; i <GET_MAXPACKET0_TRIES ; ++i) {/* Start with invalid values in case the transfer fails */ buf->bDescriptorType = buf->bMaxPacketSize0 =0 ; - rc = usb_control_msg(udev, usb_rcvaddr0pipe(), + rc = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, USB_DT_DEVICE << 8, 0, buf, size,
Greg Kroah-Hartman
maintainerPATCH 252/462 USB: quirks: add USB_QUIRK_NO_LPM quirk for Teclast dist
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lei Huang <[email protected]>
commit e169d96eecd447ff7fd7542ca5fa0911f5622054 upstream.
Teclast disk used on Huawei hisi platforms doesn't work well, losing connectivity intermittently if LPM is enabled. Add quirk disable LPM to resolve the issue.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -520,6 +520,9 @@ static const struct usb_device_id usb_qu/* Blackmagic Design UltraStudio SDI */ { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM }, + /* Teclast disk */ + { USB_DEVICE(0x1f75, 0x0917), .driver_info = USB_QUIRK_NO_LPM }, + /* Hauppauge HVR-950q */ { USB_DEVICE(0x2040, 0x7200), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
Greg Kroah-Hartman
maintainerPATCH 253/462 USB: Add USB_QUIRK_NO_LPM quirk for sony xperia xz1 smartphone
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit 159daf1258227f44b26b5d38f4aa8f37b8cca663 upstream.
The fastboot tool for communicating with Android bootloaders does not work reliably with this device if USB 2 Link Power Management (LPM) is enabled.
Various fastboot commands are affected, including the following, which usually reproduces the problem within two tries:
fastboot getvar kernel
getvar:kernel FAILED (remote: 'GetVar Variable Not found')
This issue was hidden on many systems up until commit 63a1f8454962 ("xhci: stored cached port capability values in one place") as the xhci driver failed to detect USB 2 LPM support if USB 3 ports were listed before USB 2 ports in the "supported protocol capabilities".
Adding the quirk resolves the issue. No drawbacks are expected since the device uses different USB product IDs outside of fastboot mode, and since fastboot commands worked before, until LPM was enabled on the tested system by the aforementioned commit.
Based on a patch from Forest <[email protected]> from which most of the code and commit message is taken.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -430,6 +430,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x0c45, 0x7056), .driver_info = USB_QUIRK_IGNORE_REMOTE_WAKEUP }, + /* Sony Xperia XZ1 Compact (lilac) smartphone in fastboot mode */ + { USB_DEVICE(0x0fce, 0x0dde), .driver_info = USB_QUIRK_NO_LPM }, + /* Action Semiconductor flash disk */ { USB_DEVICE(0x10d6, 0x2200), .driver_info = USB_QUIRK_STRING_FETCH_255 },
Greg Kroah-Hartman
maintainerPATCH 254/462 usb: gadget: f_midi: fix MIDI Streaming descriptor lengths
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Keeping <[email protected]>
commit da1668997052ed1cb00322e1f3b63702615c9429 upstream.
While the MIDI jacks are configured correctly, and the MIDIStreaming endpoint descriptors are filled with the correct information, bNumEmbMIDIJack and bLength are set incorrectly in these descriptors.
This does not matter when the numbers of in and out ports are equal, but when they differ the host will receive broken descriptors with uninitialized stack memory leaking into the descriptor for whichever value is smaller.
The precise meaning of "in" and "out" in the port counts is not clearly defined and can be confusing. But elsewhere the driver consistently uses this to match the USB meaning of IN and OUT viewed from the host, so that "in" ports send data to the host and "out" ports receive data from it.
--- drivers/usb/gadget/function/f_midi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/function/f_midi.c +4 -4
@@ -997,11 +997,11 @@ static int f_midi_bind(struct usb_config }/* configure the endpoint descriptors ... */ - ms_out_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->in_ports); - ms_out_desc.bNumEmbMIDIJack = midi->in_ports; + ms_out_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->out_ports); + ms_out_desc.bNumEmbMIDIJack = midi->out_ports; - ms_in_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->out_ports); - ms_in_desc.bNumEmbMIDIJack = midi->out_ports; + ms_in_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->in_ports); + ms_in_desc.bNumEmbMIDIJack = midi->in_ports;/* ... and add them to the list */ endpoint_descriptor_index = i;
Greg Kroah-Hartman
maintainerPATCH 255/462 USB: hub: Ignore non-compliant devices with too many configs or interfaces
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 2240fed37afbcdb5e8b627bc7ad986891100e05d upstream.
Robert Morris created a test program which can cause usb_hub_to_struct_hub() to dereference a NULL or inappropriate pointer:
Oops: general protection fault, probably for non-canonical address 0xcccccccccccccccc: 0000 [#1] SMP DEBUG_PAGEALLOC PTI CPU: 7 UID: 0 PID: 117 Comm: kworker/7:1 Not tainted 6.13.0-rc3-00017-gf44d154d6e3d #14 Hardware name: FreeBSD BHYVE/BHYVE, BIOS 14.0 10/17/2021 Workqueue: usb_hub_wq hub_event RIP: 0010:usb_hub_adjust_deviceremovable+0x78/0x110 ... Call Trace: <TASK> ? die_addr+0x31/0x80 ? exc_general_protection+0x1b4/0x3c0 ? asm_exc_general_protection+0x26/0x30 ? usb_hub_adjust_deviceremovable+0x78/0x110 hub_probe+0x7c7/0xab0 usb_probe_interface+0x14b/0x350 really_probe+0xd0/0x2d0 ? __pfx___device_attach_driver+0x10/0x10 __driver_probe_device+0x6e/0x110 driver_probe_device+0x1a/0x90 __device_attach_driver+0x7e/0xc0 bus_for_each_drv+0x7f/0xd0 __device_attach+0xaa/0x1a0 bus_probe_device+0x8b/0xa0 device_add+0x62e/0x810 usb_set_configuration+0x65d/0x990 usb_generic_driver_probe+0x4b/0x70 usb_probe_device+0x36/0xd0
The cause of this error is that the device has two interfaces, and the hub driver binds to interface 1 instead of interface 0, which is where usb_hub_to_struct_hub() looks.
We can prevent the problem from occurring by refusing to accept hub devices that violate the USB spec by having more than one configuration or interface.
--- drivers/usb/core/hub.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/core/hub.c +11 -0
@@ -1804,6 +1804,17 @@ static int hub_probe(struct usb_interfac hdev =interface_to_usbdev (intf);/* +* The USB 2.0 spec prohibits hubs from having more than one +* configuration or interface, and we rely on this prohibition. +* Refuse to accept a device that violates it. +*/ +if (hdev->descriptor.bNumConfigurations >1 || + hdev->actconfig->desc.bNumInterfaces >1 ) { +dev_err (&intf->dev,"Invalid hub with more than one config or interface\n" ); +return -EINVAL ; + } + +/* * Set default autosuspend delay as 0 to speedup bus suspend, * based on the below considerations: *
Greg Kroah-Hartman
maintainerPATCH 256/462 USB: cdc-acm: Fill in Renesas R-Car D3 USB Download mode quirk
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 7284922f3e4fa285dff1b8bb593aa9a0b8458f30 upstream.
Add Renesas R-Car D3 USB Download mode quirk and update comments on all the other Renesas R-Car USB Download mode quirks to discern them from each other. This follows R-Car Series, 3rd Generation reference manual Rev.2.00 chapter 19.2.8 USB download mode .
--- drivers/usb/class/cdc-acm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/usb/class/cdc-acm.c +6 -3
@@ -1723,13 +1723,16 @@ static const struct usb_device_id acm_id { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ .driver_info =NO_UNION_NORMAL ,/* has no union descriptor */ }, - { USB_DEVICE(0x045b, 0x023c), /* Renesas USB Download mode */ + { USB_DEVICE(0x045b, 0x023c), /* Renesas R-Car H3 USB Download mode */ .driver_info = DISABLE_ECHO, /* Don't echo banner */ }, - { USB_DEVICE(0x045b, 0x0248), /* Renesas USB Download mode */ + { USB_DEVICE(0x045b, 0x0247), /* Renesas R-Car D3 USB Download mode */ .driver_info = DISABLE_ECHO, /* Don't echo banner */ }, - { USB_DEVICE(0x045b, 0x024D), /* Renesas USB Download mode */ + { USB_DEVICE(0x045b, 0x0248), /* Renesas R-Car M3-N USB Download mode */ + .driver_info = DISABLE_ECHO, /* Don't echo banner */ + }, + { USB_DEVICE(0x045b, 0x024D), /* Renesas R-Car E3 USB Download mode */ .driver_info = DISABLE_ECHO, /* Don't echo banner */ }, { USB_DEVICE(0x0e8d, 0x0003), /* FIREFLY, MediaTek Inc; [email protected] */
Greg Kroah-Hartman
maintainerPATCH 257/462 usb: cdc-acm: Check control transfer buffer size before access
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit e563b01208f4d1f609bcab13333b6c0e24ce6a01 upstream.
If the first fragment is shorter than struct usb_cdc_notification, we can't calculate an expected_size. Log an error and discard the notification instead of reading lengths from memory outside the received data, which can lead to memory corruption when the expected_size decreases between fragments, causing expected_size - acm->nb_index to wrap.
This issue has been present since the beginning of git history; however, it only leads to memory corruption since commit ea2583529cd1 ("cdc-acm: reassemble fragmented notifications").
A mitigating factor is that acm_ctrl_irq() can only execute after userspace has opened /dev/ttyACM*; but if ModemManager is running, ModemManager will do that automatically depending on the USB device's vendor/product IDs and its other interfaces.
--- drivers/usb/class/cdc-acm.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/usb/class/cdc-acm.c +14 -3
@@ -360,7 +360,7 @@ static void acm_process_notification(strstatic void acm_ctrl_irq (struct urb *urb) {struct acm *acm = urb->context; -struct usb_cdc_notification *dr = urb->transfer_buffer; +struct usb_cdc_notification *dr;unsigned int current_size = urb->actual_length;unsigned int expected_size, copy_size, alloc_size;int retval;
@@ -387,9 +387,20 @@ static void acm_ctrl_irq(struct urb *urbusb_mark_last_busy (acm->dev); -if (acm->nb_index) +if (acm->nb_index ==0 ) { +/* +* The first chunk of a message must contain at least the +* notification header with the length field, otherwise we +* can't get an expected_size. +*/ +if (current_size <sizeof (struct usb_cdc_notification )) { +dev_dbg (&acm->control->dev,"urb too short\n" ); + goto exit; + } + dr = urb->transfer_buffer; + }else { dr = (struct usb_cdc_notification *)acm->notification_buffer; - + }/* size = notification-header + (optional) data */ expected_size =sizeof (struct usb_cdc_notification ) +le16_to_cpu (dr->wLength);
Greg Kroah-Hartman
maintainerPATCH 258/462 usb: cdc-acm: Fix handling of oversized fragments
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 12e712964f41d05ae034989892de445781c46730 upstream.
If we receive an initial fragment of size 8 bytes which specifies a wLength of 1 byte (so the reassembled message is supposed to be 9 bytes long), and we then receive a second fragment of size 9 bytes (which is not supposed to happen), we currently wrongly bypass the fragment reassembly code but still pass the pointer to the acm->notification_buffer to acm_process_notification().
Make this less wrong by always going through fragment reassembly when we expect more fragments.
Before this patch, receiving an overlong fragment could lead to newctrl in acm_process_notification() being uninitialized data (instead of data coming from the device).
--- drivers/usb/class/cdc-acm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +1 -1
@@ -405,7 +405,7 @@ static void acm_ctrl_irq(struct urb *urb expected_size =sizeof (struct usb_cdc_notification ) +le16_to_cpu (dr->wLength); -if (current_size < expected_size) { +if (acm->nb_index !=0 || current_size < expected_size) {/* notification is transmitted fragmented, reassemble */ if (acm->nb_size < expected_size) {u8 *new_buffer;
Greg Kroah-Hartman
maintainerPATCH 259/462 USB: serial: option: add MeiG Smart SLM828
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chester A. Unal <[email protected]>
commit db79e75460fc59b19f9c89d4b068e61cee59f37d upstream.
MeiG Smart SLM828 is an LTE-A CAT6 modem with the mPCIe form factor. The "Cls=ff(vend.) Sub=10 Prot=02" and "Cls=ff(vend.) Sub=10 Prot=03" interfaces respond to AT commands. Add these interfaces.
The product ID the modem uses is shared across multiple modems. Therefore, add comments to describe which interface is used for which modem.
T: Bus=01 Lev=01 Prnt=05 Port=01 Cnt=01 Dev#= 6 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=2dee ProdID=4d22 Rev=05.04 S: Manufacturer=MEIG S: Product=LTE-A Module S: SerialNumber=4da7ec42 C: #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=10 Prot=01 Driver=(none) E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=02 Driver=(none) E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=03 Driver=(none) E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=04 Driver=(none) E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=88(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=05 Driver=qmi_wwan E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/usb/serial/option.c +10 -5
@@ -621,7 +621,10 @@ static void option_instat_callback(struc/* MeiG Smart Technology products */ #define MEIGSMART_VENDOR_ID 0x2dee -/* MeiG Smart SRM815/SRM825L based on Qualcomm 315 */ +/* +* MeiG Smart SLM828, SRM815, and SRM825L use the same product ID. SLM828 is +* based on Qualcomm SDX12. SRM815 and SRM825L are based on Qualcomm 315. +*/ #define MEIGSMART_PRODUCT_SRM825L 0x4d22/* MeiG Smart SLM320 based on UNISOC UIS8910 */ #define MEIGSMART_PRODUCT_SLM320 0x4d41
@@ -2405,10 +2408,12 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM320, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM770A, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0, 0) }, /* MeiG Smart SRM815 */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x02) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x03) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, /* MeiG Smart SRM815 and SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, /* MeiG Smart SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, /* MeiG Smart SRM825L */ { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0530, 0xff), /* TCL IK512 MBIM */ .driver_info = NCTRL(1) }, { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0640, 0xff), /* TCL IK512 ECM */
Greg Kroah-Hartman
maintainerPATCH 260/462 USB: serial: option: add Telit Cinterion FN990B compositions
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Porcedda <[email protected]>
commit c979fb5ece2dc11cc9cc3d5c66f750e210bfdee2 upstream.
Add the following Telit Cinterion FN990B40 compositions:
0x10d0: rmnet + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 17 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d0 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs= 9 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10d1: MBIM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 16 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d1 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10d2: RNDIS + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 18 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d2 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10d3: ECM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 20 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d3 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether E: Ad=82(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/usb/serial/option.c +16 -0
@@ -1406,6 +1406,22 @@ static const struct usb_device_id option .driver_info = RSVD(0) | NCTRL(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10c8, 0xff), /* Telit FE910C04 (rmnet) */ .driver_info = RSVD(0) | NCTRL(2) | RSVD(3) | RSVD(4) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x60) }, /* Telit FN990B (rmnet) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x30), + .driver_info = NCTRL(5) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x60) }, /* Telit FN990B (MBIM) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x30), + .driver_info = NCTRL(6) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x60) }, /* Telit FN990B (RNDIS) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x30), + .driver_info = NCTRL(6) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x60) }, /* Telit FN990B (ECM) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x30), + .driver_info = NCTRL(6) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
Greg Kroah-Hartman
maintainerPATCH 261/462 USB: serial: option: fix Telit Cinterion FN990A name
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Porcedda <[email protected]>
commit 12606fe73f33647c5e79bf666833bf0b225e649d upstream.
The correct name for FN990 is FN990A so use it in order to avoid confusion with FN990B.
--- drivers/usb/serial/option.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/serial/option.c +5 -5
@@ -1370,15 +1370,15 @@ static const struct usb_device_id option .driver_info = NCTRL(2) | RSVD(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1063, 0xff), /* Telit LN920 (ECM) */ .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1070, 0xff), /* Telit FN990 (rmnet) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1070, 0xff), /* Telit FN990A (rmnet) */ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1071, 0xff), /* Telit FN990 (MBIM) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1071, 0xff), /* Telit FN990A (MBIM) */ .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1072, 0xff), /* Telit FN990 (RNDIS) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1072, 0xff), /* Telit FN990A (RNDIS) */ .driver_info = NCTRL(2) | RSVD(3) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990 (ECM) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990A (ECM) */ .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990 (PCIe) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990A (PCIe) */ .driver_info = RSVD(0) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1080, 0xff), /* Telit FE990 (rmnet) */ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
Greg Kroah-Hartman
maintainerPATCH 262/462 USB: serial: option: drop MeiG Smart defines
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 6aa8a63c471eb6756aabd03f880feffe6a7af6c9 upstream.
Several MeiG Smart modems apparently use the same product id, making the defines even less useful.
Drop them in favour of using comments consistently to make the id table slightly less unwieldy.
--- drivers/usb/serial/option.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
drivers/usb/serial/option.c +8 -20
@@ -619,18 +619,6 @@ static void option_instat_callback(struc/* Luat Air72*U series based on UNISOC UIS8910 uses UNISOC's vendor ID */ #define LUAT_PRODUCT_AIR720U 0x4e00 -/* MeiG Smart Technology products */ -#define MEIGSMART_VENDOR_ID 0x2dee -/* -* MeiG Smart SLM828, SRM815, and SRM825L use the same product ID. SLM828 is -* based on Qualcomm SDX12. SRM815 and SRM825L are based on Qualcomm 315. -*/ -#define MEIGSMART_PRODUCT_SRM825L 0x4d22 -/* MeiG Smart SLM320 based on UNISOC UIS8910 */ -#define MEIGSMART_PRODUCT_SLM320 0x4d41 -/* MeiG Smart SLM770A based on ASR1803 */ -#define MEIGSMART_PRODUCT_SLM770A 0x4d57 -/* Device flags */ /* Highest interface number which can be used with NCTRL() and RSVD() */
@@ -2366,6 +2354,14 @@ static const struct usb_device_id option { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a05, 0xff) }, /* Fibocom FM650-CN (NCM mode) */ { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a06, 0xff) }, /* Fibocom FM650-CN (RNDIS mode) */ { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a07, 0xff) }, /* Fibocom FM650-CN (MBIM mode) */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d41, 0xff, 0, 0) }, /* MeiG Smart SLM320 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d57, 0xff, 0, 0) }, /* MeiG Smart SLM770A */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0, 0) }, /* MeiG Smart SRM815 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0x10, 0x02) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0x10, 0x03) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x30) }, /* MeiG Smart SRM815 and SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x40) }, /* MeiG Smart SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x60) }, /* MeiG Smart SRM825L */ { USB_DEVICE_INTERFACE_CLASS(0x2df3, 0x9d03, 0xff) }, /* LongSung M5710 */ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */
@@ -2422,14 +2418,6 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM320, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM770A, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0, 0) }, /* MeiG Smart SRM815 */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x02) }, /* MeiG Smart SLM828 */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x03) }, /* MeiG Smart SLM828 */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, /* MeiG Smart SRM815 and SRM825L */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, /* MeiG Smart SRM825L */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, /* MeiG Smart SRM825L */ { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0530, 0xff), /* TCL IK512 MBIM */ .driver_info = NCTRL(1) }, { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0640, 0xff), /* TCL IK512 ECM */
Greg Kroah-Hartman
maintainerPATCH 263/462 can: c_can: fix unbalanced runtime PM disable in error path
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 257a2cd3eb578ee63d6bf90475dc4f4b16984139 upstream.
Runtime PM is enabled as one of the last steps of probe(), so all earlier gotos to "exit_free_device" label were not correct and were leading to unbalanced runtime PM disable depth.
--- drivers/net/can/c_can/c_can_platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/c_can/c_can_platform.c +3 -2
@@ -392,15 +392,16 @@ static int c_can_plat_probe(struct platfif (ret) {dev_err (&pdev->dev,"registering %s failed (err=%d)\n" ,KBUILD_MODNAME , ret); - goto exit_free_device; + goto exit_pm_runtime; }dev_info (&pdev->dev,"%s device registered (regs=%p, irq=%d)\n" ,KBUILD_MODNAME , priv->base, dev->irq);return 0 ; -exit_free_device: +exit_pm_runtime:pm_runtime_disable (priv->device); +exit_free_device:free_c_can_dev (dev); exit:dev_err (&pdev->dev,"probe failed\n" );
Greg Kroah-Hartman
maintainerPATCH 264/462 can: j1939: j1939_sk_send_loop(): fix unable to send messages with data length zero
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Hölzl <[email protected]>
commit 44de577e61ed239db09f0da9d436866bef9b77dd upstream.
The J1939 standard requires the transmission of messages of length 0.
For example proprietary messages are specified with a data length of 0 to 1785. The transmission of such messages is not possible. Sending results in no error being returned but no corresponding can frame being generated.
Enable the transmission of zero length J1939 messages. In order to facilitate this two changes are necessary:
1) If the transmission of a new message is requested from user space the message is segmented in j1939_sk_send_loop(). Let the segmentation take into account zero length messages, do not terminate immediately, queue the corresponding skb.
2) j1939_session_skb_get_by_offset() selects the next skb to transmit for a session. Take into account that there might be zero length skbs in the queue.
--- net/can/j1939/socket.c | 4 ++-- net/can/j1939/transport.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
net/can/j1939/socket.c +2 -2
@@ -1055,7 +1055,7 @@ static int j1939_sk_send_loop(struct j19 todo_size = size; -while (todo_size) { + do { struct j1939_sk_buff_cb *skcb; segment_size = min_t(size_t, J1939_MAX_TP_PACKET_SIZE,
@@ -1100,7 +1100,7 @@ static int j1939_sk_send_loop(struct j19 todo_size -= segment_size; session->total_queued_size += segment_size; - } + }while (todo_size);switch (ret) {case 0 :/* OK */
net/can/j1939/transport.c +3 -2
@@ -378,8 +378,9 @@ sk_buff *j1939_session_skb_get_by_offset skb_queue_walk(&session->skb_queue, do_skb) { do_skcb =j1939_skb_to_cb (do_skb); -if (offset_start >= do_skcb->offset && - offset_start < (do_skcb->offset + do_skb->len)) { +if ((offset_start >= do_skcb->offset && + offset_start < (do_skcb->offset + do_skb->len)) || + (offset_start ==0 && do_skcb->offset ==0 && do_skb->len ==0 )) { skb = do_skb; } }
Greg Kroah-Hartman
maintainerPATCH 265/462 alpha: make stack 16-byte aligned (most cases)
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Kokshaysky <[email protected]>
commit 0a0f7362b0367634a2d5cb7c96226afc116f19c9 upstream.
The problem is that GCC expects 16-byte alignment of the incoming stack since early 2004, as Maciej found out [1]:
Having actually dug speculatively I can see that the psABI was changed in
GCC 3.5 with commit e5e10fb4a350 ("re PR target/14539 (128-bit long double improperly aligned)") back in Mar 2004, when the stack pointer alignment was increased from 8 bytes to 16 bytes, and arch/alpha/kernel/entry.S has various suspicious stack pointer adjustments, starting with SP_OFF which is not a whole multiple of 16.
Also, as Magnus noted, "ALPHA Calling Standard" [2] required the same:
D.3.1 Stack Alignment
This standard requires that stacks be octaword aligned at the time a new procedure is invoked.
However:
- the "normal" kernel stack is always misaligned by 8 bytes, thanks to the odd number of 64-bit words in 'struct pt_regs', which is the very first thing pushed onto the kernel thread stack;
- syscall, fault, interrupt etc. handlers may, or may not, receive aligned stack depending on numerous factors.
Somehow we got away with it until recently, when we ended up with a stack corruption in kernel/smp.c:smp_call_function_single() due to its use of 32-byte aligned local data and the compiler doing clever things allocating it on the stack.
This adds padding between the PAL-saved and kernel-saved registers so that 'struct pt_regs' have an even number of 64-bit words. This makes the stack properly aligned for most of the kernel code, except two handlers which need special threatment.
Note: struct pt_regs doesn't belong in uapi/asm; this should be fixed, but let's put this off until later.
--- arch/alpha/include/uapi/asm/ptrace.h | 2 ++ 1 file changed, 2 insertions(+)
arch/alpha/include/uapi/asm/ptrace.h +2 -0
@@ -42,6 +42,8 @@ struct pt_regs {unsigned long trap_a0;unsigned long trap_a1;unsigned long trap_a2; +/* This makes the stack 16-byte aligned as GCC expects */ +unsigned long __pad0;/* These are saved by PAL-code: */ unsigned long ps;unsigned long pc;
Greg Kroah-Hartman
maintainerPATCH 266/462 efi: Avoid cold plugged memory for placing the kernel
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit ba69e0750b0362870294adab09339a0c39c3beaf upstream.
UEFI 2.11 introduced EFI_MEMORY_HOT_PLUGGABLE to annotate system memory regions that are 'cold plugged' at boot, i.e., hot pluggable memory that is available from early boot, and described as system RAM by the firmware.
Existing loaders and EFI applications running in the boot context will happily use this memory for allocating data structures that cannot be freed or moved at runtime, and this prevents the memory from being unplugged. Going forward, the new EFI_MEMORY_HOT_PLUGGABLE attribute should be tested, and memory annotated as such should be avoided for such allocations.
In the EFI stub, there are a couple of occurrences where, instead of the high-level AllocatePages() UEFI boot service, a low-level code sequence is used that traverses the EFI memory map and carves out the requested number of pages from a free region. This is needed, e.g., for allocating as low as possible, or for allocating pages at random.
While AllocatePages() should presumably avoid special purpose memory and cold plugged regions, this manual approach needs to incorporate this logic itself, in order to prevent the kernel itself from ending up in a hot unpluggable region, preventing it from being unplugged.
So add the EFI_MEMORY_HOTPLUGGABLE macro definition, and check for it where appropriate.
--- drivers/firmware/efi/efi.c | 6 ++++-- drivers/firmware/efi/libstub/randomalloc.c | 3 +++ drivers/firmware/efi/libstub/relocate.c | 3 +++ include/linux/efi.h | 1 + 4 files changed, 11 insertions(+), 2 deletions(-)
drivers/firmware/efi/efi.c +4 -2
@@ -774,13 +774,15 @@ char * __init efi_md_typeattr_format(chaEFI_MEMORY_WB |EFI_MEMORY_UCE |EFI_MEMORY_RO |EFI_MEMORY_WP |EFI_MEMORY_RP |EFI_MEMORY_XP |EFI_MEMORY_NV |EFI_MEMORY_SP |EFI_MEMORY_CPU_CRYPTO | - EFI_MEMORY_RUNTIME | EFI_MEMORY_MORE_RELIABLE)) +EFI_MEMORY_MORE_RELIABLE |EFI_MEMORY_HOT_PLUGGABLE | + EFI_MEMORY_RUNTIME)) snprintf(pos, size, "|attr=0x%016llx]", (unsigned long long)attr); else snprintf(pos, size, -"|%3s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]" , +"|%3s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]" , attr &EFI_MEMORY_RUNTIME ?"RUN" :"" , + attr &EFI_MEMORY_HOT_PLUGGABLE ?"HP" :"" , attr &EFI_MEMORY_MORE_RELIABLE ?"MR" :"" , attr &EFI_MEMORY_CPU_CRYPTO ?"CC" :"" , attr & EFI_MEMORY_SP ? "SP" : "",
drivers/firmware/efi/libstub/randomalloc.c +3 -0
@@ -24,6 +24,9 @@ static unsigned long get_entry_num_slotsif (md->type !=EFI_CONVENTIONAL_MEMORY )return 0 ; +if (md->attribute &EFI_MEMORY_HOT_PLUGGABLE ) +return 0 ; +if (efi_soft_reserve_enabled () && (md->attribute &EFI_MEMORY_SP ))return 0 ;
drivers/firmware/efi/libstub/relocate.c +3 -0
@@ -62,6 +62,9 @@ efi_status_t efi_low_alloc_above(unsigneif (desc->type !=EFI_CONVENTIONAL_MEMORY )continue ; +if (desc->attribute &EFI_MEMORY_HOT_PLUGGABLE ) +continue ; +if (efi_soft_reserve_enabled () && (desc->attribute &EFI_MEMORY_SP ))continue ;
include/linux/efi.h +1 -0
@@ -125,6 +125,7 @@ typedef struct {#define EFI_MEMORY_RO ((u64)0x0000000000020000ULL)/* read-only */ #define EFI_MEMORY_SP ((u64)0x0000000000040000ULL)/* soft reserved */ #define EFI_MEMORY_CPU_CRYPTO ((u64)0x0000000000080000ULL)/* supports encryption */ +#define EFI_MEMORY_HOT_PLUGGABLE BIT_ULL(20)/* supports unplugging at runtime */ #define EFI_MEMORY_RUNTIME ((u64)0x8000000000000000ULL)/* range requires runtime mapping */ #define EFI_MEMORY_DESCRIPTOR_VERSION 1
Greg Kroah-Hartman
maintainerPATCH 267/462 serial: 8250: Fix fifo underflow on flush
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Keeping <[email protected]>
commit 9e512eaaf8f4008c44ede3dfc0fbc9d9c5118583 upstream.
When flushing the serial port's buffer, uart_flush_buffer() calls kfifo_reset() but if there is an outstanding DMA transfer then the completion function will consume data from the kfifo via uart_xmit_advance(), underflowing and leading to ongoing DMA as the driver tries to transmit another 2^32 bytes.
This is readily reproduced with serial-generic and amidi sending even short messages as closing the device on exit will wait for the fifo to drain and in the underflow case amidi hangs for 30 seconds on exit in tty_wait_until_sent(). A trace of that gives:
kworker/1:1-84 [001] 51.769423: bprint: serial8250_tx_dma: tx_size=3 fifo_len=3
amidi-763 [001] 51.769460: bprint: uart_flush_buffer: resetting fifo
irq/21-fe530000-76 [000] 51.769474: bprint: __dma_tx_complete: tx_size=3
irq/21-fe530000-76 [000] 51.769479: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294967293
irq/21-fe530000-76 [000] 51.781295: bprint: __dma_tx_complete: tx_size=4096
irq/21-fe530000-76 [000] 51.781301: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294963197
irq/21-fe530000-76 [000] 51.793131: bprint: __dma_tx_complete: tx_size=4096
irq/21-fe530000-76 [000] 51.793135: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294959101
irq/21-fe530000-76 [000] 51.804949: bprint: __dma_tx_complete: tx_size=4096Since the port lock is held in when the kfifo is reset in uart_flush_buffer() and in __dma_tx_complete(), adding a flush_buffer hook to adjust the outstanding DMA byte count is sufficient to avoid the kfifo underflow.
--- drivers/tty/serial/8250/8250.h | 2 ++ drivers/tty/serial/8250/8250_dma.c | 16 ++++++++++++++++ drivers/tty/serial/8250/8250_port.c | 9 +++++++++ 3 files changed, 27 insertions(+)
drivers/tty/serial/8250/8250.h +2 -0
@@ -325,6 +325,7 @@ static inline int is_omap1510_8250(struc#ifdef CONFIG_SERIAL_8250_DMA extern int serial8250_tx_dma (struct uart_8250_port *); +extern void serial8250_tx_dma_flush (struct uart_8250_port *);extern int serial8250_rx_dma (struct uart_8250_port *);extern void serial8250_rx_dma_flush (struct uart_8250_port *);extern int serial8250_request_dma (struct uart_8250_port *);
@@ -341,6 +342,7 @@ static inline int serial8250_tx_dma(stru {return -1 ; } +static inline void serial8250_tx_dma_flush (struct uart_8250_port *p) { }static inline int serial8250_rx_dma (struct uart_8250_port *p) {return -1 ;
drivers/tty/serial/8250/8250_dma.c +16 -0
@@ -135,6 +135,22 @@ err:return ret; } +void serial8250_tx_dma_flush (struct uart_8250_port *p) +{ +struct uart_8250_dma *dma = p->dma; + +if (!dma->tx_running) +return ; + +/* +* kfifo_reset() has been called by the serial core, avoid +* advancing and underflowing in __dma_tx_complete(). +*/ + dma->tx_size =0 ; + +dmaengine_terminate_async (dma->rxchan); +} +int serial8250_rx_dma (struct uart_8250_port *p) {struct uart_8250_dma *dma = p->dma;
drivers/tty/serial/8250/8250_port.c +9 -0
@@ -2509,6 +2509,14 @@ static unsigned int npcm_get_divisor(strreturn DIV_ROUND_CLOSEST (port->uartclk,16 * baud +2 ) -2 ; } +static void serial8250_flush_buffer (struct uart_port *port) +{ +struct uart_8250_port *up =up_to_u8250p (port); + +if (up->dma) +serial8250_tx_dma_flush (up); +} +static unsigned int serial8250_do_get_divisor (struct uart_port *port,unsigned int baud,unsigned int *frac)
@@ -3209,6 +3217,7 @@ static const struct uart_ops serial8250_ .break_ctl = serial8250_break_ctl, .startup = serial8250_startup, .shutdown = serial8250_shutdown, + .flush_buffer = serial8250_flush_buffer, .set_termios = serial8250_set_termios, .set_ldisc = serial8250_set_ldisc, .pm = serial8250_pm,
Greg Kroah-Hartman
maintainerPATCH 268/462 alpha: align stack for page fault and user unaligned trap handlers
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Kokshaysky <[email protected]>
commit 3b35a171060f846b08b48646b38c30b5d57d17ff upstream.
do_page_fault() and do_entUna() are special because they use non-standard stack frame layout. Fix them manually.
--- arch/alpha/kernel/entry.S | 20 ++++++++++---------- arch/alpha/kernel/traps.c | 2 +- arch/alpha/mm/fault.c | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-)
arch/alpha/kernel/entry.S +10 -10
@@ -199,8 +199,8 @@ CFI_END_OSF_FRAME entArith CFI_START_OSF_FRAME entMM SAVE_ALL /* save $9 - $15 so the inline exception code can manipulate them. */ - subq $sp, 56, $sp - .cfi_adjust_cfa_offset 56 + subq $sp, 64, $sp + .cfi_adjust_cfa_offset 64 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp)
@@ -215,7 +215,7 @@ CFI_START_OSF_FRAME entMM .cfi_rel_offset $13, 32 .cfi_rel_offset $14, 40 .cfi_rel_offset $15, 48 - addq $sp, 56, $19 + addq $sp, 64, $19 /* handle the fault */ lda $8, 0x3fff bic $sp, $8, $8
@@ -228,7 +228,7 @@ CFI_START_OSF_FRAME entMM ldq $13, 32($sp) ldq $14, 40($sp) ldq $15, 48($sp) - addq $sp, 56, $sp + addq $sp, 64, $sp .cfi_restore $9 .cfi_restore $10 .cfi_restore $11
@@ -236,7 +236,7 @@ CFI_START_OSF_FRAME entMM .cfi_restore $13 .cfi_restore $14 .cfi_restore $15 - .cfi_adjust_cfa_offset -56 + .cfi_adjust_cfa_offset -64 /* finish up the syscall as normal. */ br ret_from_sys_call CFI_END_OSF_FRAME entMM
@@ -383,8 +383,8 @@ entUnaUser: .cfi_restore $0 .cfi_adjust_cfa_offset -256 SAVE_ALL /* setup normal kernel stack */ - lda $sp, -56($sp) - .cfi_adjust_cfa_offset 56 + lda $sp, -64($sp) + .cfi_adjust_cfa_offset 64 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp)
@@ -400,7 +400,7 @@ entUnaUser: .cfi_rel_offset $14, 40 .cfi_rel_offset $15, 48 lda $8, 0x3fff - addq $sp, 56, $19 + addq $sp, 64, $19 bic $sp, $8, $8 jsr $26, do_entUnaUser ldq $9, 0($sp)
@@ -410,7 +410,7 @@ entUnaUser: ldq $13, 32($sp) ldq $14, 40($sp) ldq $15, 48($sp) - lda $sp, 56($sp) + lda $sp, 64($sp) .cfi_restore $9 .cfi_restore $10 .cfi_restore $11
@@ -418,7 +418,7 @@ entUnaUser: .cfi_restore $13 .cfi_restore $14 .cfi_restore $15 - .cfi_adjust_cfa_offset -56 + .cfi_adjust_cfa_offset -64 br ret_from_sys_call CFI_END_OSF_FRAME entUna
arch/alpha/kernel/traps.c +1 -1
@@ -709,7 +709,7 @@ s_reg_to_mem (unsigned long s_reg)static int unauser_reg_offsets[32 ] = {R (r0),R (r1),R (r2),R (r3),R (r4),R (r5),R (r6),R (r7),R (r8),/* r9 ... r15 are stored in front of regs. */ --56 ,-48 ,-40 ,-32 ,-24 ,-16 ,-8 , +-64 ,-56 ,-48 ,-40 ,-32 ,-24 ,-16 ,/* padding at -8 */ R (r16),R (r17),R (r18),R (r19),R (r20),R (r21),R (r22),R (r23),R (r24),R (r25),R (r26),R (r27),R (r28),R (gp),
arch/alpha/mm/fault.c +2 -2
@@ -78,8 +78,8 @@ __load_new_mm_context(struct mm_struct */* Macro for exception fixup code to access integer registers. */ #define dpf_reg (r) \ - (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \ - (r) <= 18 ? (r)+10 : (r)-10]) + (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-17 : \ + (r) <= 18 ? (r)+11 : (r)-10]) asmlinkage void do_page_fault(unsigned long address, unsigned long mmcsr,
Greg Kroah-Hartman
maintainerPATCH 269/462 gpio: stmpe: Check return value of stmpe_reg_read in stmpe_gpio_irq_sync_unlock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit b9644fbfbcab13da7f8b37bef7c51e5b8407d031 upstream.
The stmpe_reg_read function can fail, but its return value is not checked in stmpe_gpio_irq_sync_unlock. This can lead to silent failures and incorrect behavior if the hardware access fails.
This patch adds checks for the return value of stmpe_reg_read. If the function fails, an error message is logged and the function returns early to avoid further issues.
--- drivers/gpio/gpio-stmpe.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpio/gpio-stmpe.c +12 -3
@@ -191,7 +191,7 @@ static void stmpe_gpio_irq_sync_unlock(s [REG_IE][CSB] = STMPE_IDX_IEGPIOR_CSB, [REG_IE][MSB] = STMPE_IDX_IEGPIOR_MSB, }; -int i, j; +int ret, i, j;/* * STMPE1600: to be able to get IRQ from pins,
@@ -199,8 +199,16 @@ static void stmpe_gpio_irq_sync_unlock(s* GPSR or GPCR registers */ if (stmpe->partnum ==STMPE1600 ) { -stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB ]); -stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB ]); + ret =stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB ]); +if (ret <0 ) { +dev_err (stmpe->dev,"Failed to read GPMR_LSB: %d\n" , ret); + goto err; + } + ret =stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB ]); +if (ret <0 ) { +dev_err (stmpe->dev,"Failed to read GPMR_CSB: %d\n" , ret); + goto err; + } }for (i =0 ; i <CACHE_NR_REGS ; i++) {
@@ -222,6 +230,7 @@ static void stmpe_gpio_irq_sync_unlock(s } } +err:mutex_unlock (&stmpe_gpio->irq_lock); }
Greg Kroah-Hartman
maintainerPATCH 270/462 partitions: mac: fix handling of bogus partition table
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 80e648042e512d5a767da251d44132553fe04ae0 upstream.
Fix several issues in partition probing:
- The bailout for a bad partoffset must use put_dev_sector(), since the preceding read_part_sector() succeeded.
- If the partition table claims a silly sector size like 0xfff bytes (which results in partition table entries straddling sector boundaries), bail out instead of accessing out-of-bounds memory.
- We must not assume that the partition table contains proper NUL termination - use strnlen() and strncmp() instead of strlen() and strcmp().
--- block/partitions/mac.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
block/partitions/mac.c +15 -3
@@ -51,13 +51,25 @@ int mac_partition(struct parsed_partitio } secsize =be16_to_cpu (md->block_size);put_dev_sector (sect); + +/* +* If the "block size" is not a power of 2, things get weird - we might +* end up with a partition straddling a sector boundary, so we wouldn't +* be able to read a partition entry with read_part_sector(). +* Real block sizes are probably (?) powers of two, so just require +* that. +*/ +if (!is_power_of_2 (secsize)) +return -1 ; datasize =round_down (secsize,512 ); data =read_part_sector (state, datasize /512 , §);if (!data)return -1 ; partoffset = secsize %512 ; -if (partoffset +sizeof (*part) > datasize) +if (partoffset +sizeof (*part) > datasize) { +put_dev_sector (sect);return -1 ; + } part = (struct mac_partition *) (data + partoffset);if (be16_to_cpu (part->signature) !=MAC_PARTITION_MAGIC ) {put_dev_sector (sect);
@@ -110,8 +122,8 @@ int mac_partition(struct parsed_partitioint i, l; goodness++; - l =strlen (part->name); -if (strcmp (part->name,"/" ) ==0 ) + l =strnlen (part->name,sizeof (part->name)); +if (strncmp (part->name,"/" ,sizeof (part->name)) ==0 ) goodness++;for (i =0 ; i <= l -4 ; ++i) { if (strncasecmp(part->name + i, "root",
Greg Kroah-Hartman
maintainerPATCH 271/462 regmap-irq: Add missing kfree()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit 32ffed055dcee17f6705f545b069e44a66067808 upstream.
Add kfree() for "d->main_status_buf" to the error-handling path to prevent a memory leak.
--- drivers/base/regmap/regmap-irq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/regmap/regmap-irq.c +2 -0
@@ -834,6 +834,7 @@ err_alloc:kfree (d->wake_buf);kfree (d->mask_buf_def);kfree (d->mask_buf); +kfree (d->main_status_buf);kfree (d->status_buf);kfree (d->status_reg_buf);kfree (d);
@@ -904,6 +905,7 @@ void regmap_del_irq_chip(int irq, structkfree (d->wake_buf);kfree (d->mask_buf_def);kfree (d->mask_buf); +kfree (d->main_status_buf);kfree (d->status_reg_buf);kfree (d->status_buf);kfree (d);
Greg Kroah-Hartman
maintainerPATCH 272/462 arm64: Handle .ARM.attributes section in linker scripts
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit ca0f4fe7cf7183bfbdc67ca2de56ae1fc3a8db2b upstream.
A recent LLVM commit [1] started generating an .ARM.attributes section similar to the one that exists for 32-bit, which results in orphan section warnings (or errors if CONFIG_WERROR is enabled) from the linker because it is not handled in the arm64 linker scripts.
ld.lld: error: arch/arm64/kernel/vdso/vgettimeofday.o:(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: arch/arm64/kernel/vdso/vgetrandom.o:(.ARM.attributes) is being placed in '.ARM.attributes'
ld.lld: error: vmlinux.a(lib/vsprintf.o):(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: vmlinux.a(lib/win_minmax.o):(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: vmlinux.a(lib/xarray.o):(.ARM.attributes) is being placed in '.ARM.attributes'
Discard the new sections in the necessary linker scripts to resolve the warnings, as the kernel and vDSO do not need to retain it, similar to the .note.gnu.property section.
--- arch/arm64/kernel/vdso/vdso.lds.S | 1 + arch/arm64/kernel/vmlinux.lds.S | 1 + 2 files changed, 2 insertions(+)
arch/arm64/kernel/vdso/vdso.lds.S +1 -0
@@ -37,6 +37,7 @@ SECTIONS */ /DISCARD/ : { *(.note.GNU-stack .note.gnu.property) + *(.ARM.attributes) } .note : { *(.note.*) } :text :note
arch/arm64/kernel/vmlinux.lds.S +1 -0
@@ -113,6 +113,7 @@ SECTIONS /DISCARD/ : { *(.interp .dynamic) *(.dynsym .dynstr .hash .gnu.hash) + *(.ARM.attributes) } . = KIMAGE_VADDR;
Greg Kroah-Hartman
maintainerPATCH 273/462 mlxsw: Add return value check for mlxsw_sp_port_get_stats_raw()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit fee5d688940690cc845937459e340e4e02598e90 upstream.
Add a check for the return value of mlxsw_sp_port_get_stats_raw() in __mlxsw_sp_port_get_stats(). If mlxsw_sp_port_get_stats_raw() returns an error, exit the function to prevent further processing with potentially invalid data.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +3 -1
@@ -761,7 +761,9 @@ static void __mlxsw_sp_port_get_stats(st err =mlxsw_sp_get_hw_stats_by_group (&hw_stats, &len, grp);if (err)return ; -mlxsw_sp_port_get_stats_raw (dev, grp, prio, ppcnt_pl); + err =mlxsw_sp_port_get_stats_raw (dev, grp, prio, ppcnt_pl); +if (err) +return ;for (i =0 ; i < len; i++) { data[data_index + i] = hw_stats[i].getter (ppcnt_pl);if (!hw_stats[i].cells_bytes)
Greg Kroah-Hartman
maintainerPATCH 274/462 clocksource: Limit number of CPUs checked for clock synchronization
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul E. McKenney <[email protected]>
[ Upstream commit fa218f1cce6ba40069c8daab8821de7e6be1cdd0 ]
Currently, if skew is detected on a clock marked CLOCK_SOURCE_VERIFY_PERCPU, that clock is checked on all CPUs. This is thorough, but might not be what you want on a system with a few tens of CPUs, let alone a few hundred of them.
Therefore, by default check only up to eight randomly chosen CPUs. Also provide a new clocksource.verify_n_cpus kernel boot parameter. A value of -1 says to check all of the CPUs, and a non-negative value says to randomly select that number of CPUs, without concern about selecting the same CPU multiple times. However, make use of a cpumask so that a given CPU will be checked at most once.
Stable-dep-of: 6bb05a33337b ("clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context")
--- .../admin-guide/kernel-parameters.txt | 10 +++ kernel/time/clocksource.c | 74 ++++++++++++++++++- 2 files changed, 82 insertions(+), 2 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +10 -0
@@ -583,6 +583,16 @@ unstable. Defaults to three retries, that is, four attempts to read the clock under test. + clocksource.verify_n_cpus= [KNL] + Limit the number of CPUs checked for clocksources + marked with CLOCK_SOURCE_VERIFY_PERCPU that + are marked unstable due to excessive skew. + A negative value says to check all CPUs, while + zero says not to check any. Values larger than + nr_cpu_ids are silently truncated to nr_cpu_ids. + The actual CPUs are chosen randomly, with + no replacement if the same CPU is chosen twice. + clearcpuid=BITNUM[,BITNUM...] [X86] Disable CPUID feature X for the kernel. See arch/x86/include/asm/cpufeatures.h for the valid bit
kernel/time/clocksource.c +72 -2
114 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 275/462 clocksource: Replace deprecated CPU-hotplug functions.
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 698429f9d0e54ce3964151adff886ee5fc59714b ]
The functions get_online_cpus() and put_online_cpus() have been deprecated during the CPU hotplug rework. They map directly to cpus_read_lock() and cpus_read_unlock().
Replace deprecated CPU-hotplug functions with the official version. The behavior remains unchanged.
Stable-dep-of: 6bb05a33337b ("clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context")
--- kernel/time/clocksource.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/time/clocksource.c +3 -3
@@ -335,12 +335,12 @@ static void clocksource_verify_percpu(struct clocksource *cs)return ;cpumask_clear (&cpus_ahead);cpumask_clear (&cpus_behind); -get_online_cpus (); +cpus_read_lock ();preempt_disable ();clocksource_verify_choose_cpus ();if (cpumask_weight (&cpus_chosen) ==0 ) {preempt_enable (); -put_online_cpus (); +cpus_read_unlock ();pr_warn ("Not enough CPUs to check clocksource '%s'.\n" , cs->name);return ; }
@@ -366,7 +366,7 @@ static void clocksource_verify_percpu(struct clocksource *cs) cs_nsec_min = cs_nsec; }preempt_enable (); -put_online_cpus (); +cpus_read_unlock ();if (!cpumask_empty (&cpus_ahead))pr_warn (" CPUs %*pbl ahead of CPU %d for clocksource %s.\n" ,cpumask_pr_args (&cpus_ahead), testcpu, cs->name);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 276/462 clocksource: Replace cpumask_weight() with cpumask_empty()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yury Norov <[email protected]>
[ Upstream commit 8afbcaf8690dac19ebf570a4e4fef9c59c75bf8e ]
clocksource_verify_percpu() calls cpumask_weight() to check if any bit of a given cpumask is set.
This can be done more efficiently with cpumask_empty() because cpumask_empty() stops traversing the cpumask as soon as it finds first set bit, while cpumask_weight() counts all bits unconditionally.
Stable-dep-of: 6bb05a33337b ("clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context")
--- kernel/time/clocksource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/clocksource.c +1 -1
@@ -338,7 +338,7 @@ static void clocksource_verify_percpu(struct clocksource *cs)cpus_read_lock ();preempt_disable ();clocksource_verify_choose_cpus (); -if (cpumask_weight (&cpus_chosen) ==0 ) { +if (cpumask_empty (&cpus_chosen)) {preempt_enable ();cpus_read_unlock ();pr_warn ("Not enough CPUs to check clocksource '%s'.\n" , cs->name);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 277/462 clocksource: Use pr_info() for "Checking clocksource synchronization" message
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 1f566840a82982141f94086061927a90e79440e5 ]
The "Checking clocksource synchronization" message is normally printed when clocksource_verify_percpu() is called for a given clocksource if both the CLOCK_SOURCE_UNSTABLE and CLOCK_SOURCE_VERIFY_PERCPU flags are set.
It is an informational message and so pr_info() is the correct choice.
Stable-dep-of: 6bb05a33337b ("clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context")
--- kernel/time/clocksource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/time/clocksource.c +2 -1
@@ -345,7 +345,8 @@ static void clocksource_verify_percpu(struct clocksource *cs)return ; } testcpu =smp_processor_id (); -pr_warn ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , cs->name, testcpu,cpumask_pr_args (&cpus_chosen)); +pr_info ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , + cs->name, testcpu,cpumask_pr_args (&cpus_chosen));for_each_cpu (cpu, &cpus_chosen) {if (cpu == testcpu)continue ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 278/462 clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 6bb05a33337b2c842373857b63de5c9bf1ae2a09 ]
The following bug report happened with a PREEMPT_RT kernel:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2012, name: kwatchdog preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 get_random_u32+0x4f/0x110 clocksource_verify_choose_cpus+0xab/0x1a0 clocksource_verify_percpu.part.0+0x6b/0x330 clocksource_watchdog_kthread+0x193/0x1a0
It is due to the fact that clocksource_verify_choose_cpus() is invoked with preemption disabled. This function invokes get_random_u32() to obtain random numbers for choosing CPUs. The batched_entropy_32 local lock and/or the base_crng.lock spinlock in driver/char/random.c will be acquired during the call. In PREEMPT_RT kernel, they are both sleeping locks and so cannot be acquired in atomic context.
Fix this problem by using migrate_disable() to allow smp_processor_id() to be reliably used without introducing atomic context. preempt_disable() is then called after clocksource_verify_choose_cpus() but before the clocksource measurement is being run to avoid introducing unexpected latency.
--- kernel/time/clocksource.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/time/clocksource.c +4 -2
@@ -336,10 +336,10 @@ static void clocksource_verify_percpu(struct clocksource *cs)cpumask_clear (&cpus_ahead);cpumask_clear (&cpus_behind);cpus_read_lock (); -preempt_disable (); +migrate_disable ();clocksource_verify_choose_cpus ();if (cpumask_empty (&cpus_chosen)) { -preempt_enable (); +migrate_enable ();cpus_read_unlock ();pr_warn ("Not enough CPUs to check clocksource '%s'.\n" , cs->name);return ;
@@ -347,6 +347,7 @@ static void clocksource_verify_percpu(struct clocksource *cs) testcpu =smp_processor_id ();pr_info ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , cs->name, testcpu,cpumask_pr_args (&cpus_chosen)); +preempt_disable ();for_each_cpu (cpu, &cpus_chosen) {if (cpu == testcpu)continue ;
@@ -367,6 +368,7 @@ static void clocksource_verify_percpu(struct clocksource *cs) cs_nsec_min = cs_nsec; }preempt_enable (); +migrate_enable ();cpus_read_unlock ();if (!cpumask_empty (&cpus_ahead)) pr_warn(" CPUs %*pbl ahead of CPU %d for clocksource %s.\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 279/462 net: treat possible_net_t net pointer as an RCU one and add read_pnet_rcu()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit 2034d90ae41ae93e30d492ebcf1f06f97a9cfba6 ]
Make the net pointer stored in possible_net_t structure annotated as an RCU pointer. Change the access helpers to treat it as such. Introduce read_pnet_rcu() helper to allow caller to dereference the net pointer under RCU read lock.
Stable-dep-of: dd205fcc33d9 ("ipv4: use RCU protection in rt_is_expired()")
--- include/net/net_namespace.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
include/net/net_namespace.h +12 -3
@@ -320,21 +320,30 @@ static inline int check_net(const struct net *net)typedef struct {#ifdef CONFIG_NET_NS -struct net *net; +struct net __rcu *net;#endif }possible_net_t ;static inline void write_pnet (possible_net_t *pnet,struct net *net) {#ifdef CONFIG_NET_NS - pnet->net = net; +rcu_assign_pointer (pnet->net, net);#endif }static inline struct net *read_pnet (const possible_net_t *pnet) {#ifdef CONFIG_NET_NS -return pnet->net; +return rcu_dereference_protected (pnet->net, true); +#else +return &init_net; +#endif +} + +static inline struct net *read_pnet_rcu (possible_net_t *pnet) +{ +#ifdef CONFIG_NET_NS +return rcu_dereference (pnet->net);#else return &init_net;#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 280/462 net: add dev_net_rcu() helper
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 482ad2a4ace2740ca0ff1cbc8f3c7f862f3ab507 ]
dev->nd_net can change, readers should either
use rcu_read_lock() or RTNL.
We currently use a generic helper, dev_net() with no debugging support. We probably have many hidden bugs.
Add dev_net_rcu() helper for callers using rcu_read_lock() protection.
Stable-dep-of: dd205fcc33d9 ("ipv4: use RCU protection in rt_is_expired()")
--- include/linux/netdevice.h | 6 ++++++ include/net/net_namespace.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
include/linux/netdevice.h +6 -0
@@ -2361,6 +2361,12 @@ struct net *dev_net(const struct net_device *dev)return read_pnet (&dev->nd_net); } +static inline +struct net *dev_net_rcu (const struct net_device *dev) +{ +return read_pnet_rcu (&dev->nd_net); +} +static inline void dev_net_set (struct net_device *dev,struct net *net) {
include/net/net_namespace.h +1 -1
@@ -340,7 +340,7 @@ static inline struct net *read_pnet(const possible_net_t *pnet)#endif } -static inline struct net *read_pnet_rcu (possible_net_t *pnet) +static inline struct net *read_pnet_rcu (const possible_net_t *pnet) {#ifdef CONFIG_NET_NS return rcu_dereference (pnet->net);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 281/462 ipv4: use RCU protection in rt_is_expired()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit dd205fcc33d92d54eee4d7f21bb073af9bd5ce2b ]
rt_is_expired() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/route.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/ipv4/route.c +7 -1
@@ -423,7 +423,13 @@ static inline int ip_rt_proc_init(void)static inline bool rt_is_expired (const struct rtable *rth) { -return rth->rt_genid !=rt_genid_ipv4 (dev_net (rth->dst.dev)); +bool res; + +rcu_read_lock (); + res = rth->rt_genid !=rt_genid_ipv4 (dev_net_rcu (rth->dst.dev)); +rcu_read_unlock (); + +return res; }void rt_cache_flush (struct net *net)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 282/462 ipv4: use RCU protection in inet_select_addr()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 719817cd293e4fa389e1f69c396f3f816ed5aa41 ]
inet_select_addr() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/devinet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/devinet.c +2 -1
@@ -1317,10 +1317,11 @@ __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope)__be32 addr =0 ;unsigned char localnet_scope =RT_SCOPE_HOST ;struct in_device *in_dev; -struct net *net =dev_net (dev); +struct net *net;int master_idx;rcu_read_lock (); + net =dev_net_rcu (dev); in_dev =__in_dev_get_rcu (dev);if (!in_dev) goto no_in_dev;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 283/462 ipv6: use RCU protection in ip6_default_advmss()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 3c8ffcd248da34fc41e52a46e51505900115fc2a ]
ip6_default_advmss() needs rcu protection to make sure the net structure it reads does not disappear.
--- net/ipv6/route.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/ipv6/route.c +6 -1
@@ -3056,13 +3056,18 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst) {struct net_device *dev = dst->dev;unsigned int mtu =dst_mtu (dst); -struct net *net =dev_net (dev); +struct net *net; mtu -=sizeof (struct ipv6hdr ) +sizeof (struct tcphdr ); +rcu_read_lock (); + + net =dev_net_rcu (dev);if (mtu < net->ipv6.sysctl.ip6_rt_min_advmss) mtu = net->ipv6.sysctl.ip6_rt_min_advmss; +rcu_read_unlock (); +/* * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and * corresponding MSS is IPV6_MAXPLEN - tcp_header_size.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 284/462 ndisc: use RCU protection in ndisc_alloc_skb()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 628e6d18930bbd21f2d4562228afe27694f66da9 ]
ndisc_alloc_skb() can be called without RTNL or RCU being held.
Add RCU protection to avoid possible UAF.
--- net/ipv6/ndisc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/ipv6/ndisc.c +4 -6
@@ -417,15 +417,11 @@ static struct sk_buff *ndisc_alloc_skb(struct net_device *dev, {int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -struct sock *sk =dev_net (dev)->ipv6.ndisc_sk;struct sk_buff *skb; skb =alloc_skb (hlen +sizeof (struct ipv6hdr ) + len + tlen,GFP_ATOMIC ); -if (!skb) { -ND_PRINTK (0 , err,"ndisc: %s failed to allocate an skb\n" , - __func__); +if (!skb)return NULL ; - } skb->protocol =htons (ETH_P_IPV6 ); skb->dev = dev;
@@ -436,7 +432,9 @@ static struct sk_buff *ndisc_alloc_skb(struct net_device *dev,/* Manually assign socket ownership as we avoid calling * sock_alloc_send_pskb() to bypass wmem buffer limits */ -skb_set_owner_w (skb, sk); +rcu_read_lock (); +skb_set_owner_w (skb,dev_net_rcu (dev)->ipv6.ndisc_sk); +rcu_read_unlock ();return skb; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 285/462 neighbour: delete redundant judgment statements
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zetao <[email protected]>
[ Upstream commit c25bdd2ac8cf7da70a226f1a66cdce7af15ff86f ]
The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise.
Stable-dep-of: becbd5850c03 ("neighbour: use RCU protection in __neigh_notify()")
--- net/core/neighbour.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/core/neighbour.c +1 -2
@@ -3387,8 +3387,7 @@ static void __neigh_notify(struct neighbour *n, int type, int flags,rtnl_notify (skb, net,0 ,RTNLGRP_NEIGH ,NULL ,GFP_ATOMIC );return ; errout: -if (err <0 ) -rtnl_set_sk_err (net,RTNLGRP_NEIGH , err); +rtnl_set_sk_err (net,RTNLGRP_NEIGH , err); }void neigh_app_ns (struct neighbour *n)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 286/462 neighbour: use RCU protection in __neigh_notify()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit becbd5850c03ed33b232083dd66c6e38c0c0e569 ]
__neigh_notify() can be called without RTNL or RCU protection.
Use RCU protection to avoid potential UAF.
--- net/core/neighbour.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/core/neighbour.c +6 -2
@@ -3369,10 +3369,12 @@ static const struct seq_operations neigh_stat_seq_ops = {static void __neigh_notify (struct neighbour *n,int type,int flags,u32 pid) { -struct net *net =dev_net (n->dev);struct sk_buff *skb;int err = -ENOBUFS ; +struct net *net; +rcu_read_lock (); + net =dev_net_rcu (n->dev); skb =nlmsg_new (neigh_nlmsg_size (),GFP_ATOMIC );if (skb ==NULL ) goto errout;
@@ -3385,9 +3387,11 @@ static void __neigh_notify(struct neighbour *n, int type, int flags, goto errout; }rtnl_notify (skb, net,0 ,RTNLGRP_NEIGH ,NULL ,GFP_ATOMIC ); -return ; + goto out; errout:rtnl_set_sk_err (net,RTNLGRP_NEIGH , err); +out: +rcu_read_unlock (); }void neigh_app_ns (struct neighbour *n)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 287/462 arp: use RCU protection in arp_xmit()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a42b69f692165ec39db42d595f4f65a4c8f42e44 ]
arp_xmit() can be called without RTNL or RCU protection.
Use RCU protection to avoid potential UAF.
--- net/ipv4/arp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/arp.c +3 -1
@@ -637,10 +637,12 @@ static int arp_xmit_finish(struct net *net, struct sock *sk, struct sk_buff *skb*/ void arp_xmit (struct sk_buff *skb) { +rcu_read_lock ();/* Send it off, maybe filter it using firewalling first. */ NF_HOOK (NFPROTO_ARP ,NF_ARP_OUT , -dev_net (skb->dev),NULL , skb,NULL , skb->dev, +dev_net_rcu (skb->dev),NULL , skb,NULL , skb->dev, arp_xmit_finish); +rcu_read_unlock (); }EXPORT_SYMBOL (arp_xmit);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 288/462 openvswitch: use RCU protection in ovs_vport_cmd_fill_info()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 90b2f49a502fa71090d9f4fe29a2f51fe5dff76d ]
ovs_vport_cmd_fill_info() can be called without RTNL or RCU.
Use RCU protection and dev_net_rcu() to avoid potential UAF.
--- net/openvswitch/datapath.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/openvswitch/datapath.c +9 -3
@@ -1980,6 +1980,7 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, {struct ovs_header *ovs_header;struct ovs_vport_stats vport_stats; +struct net *net_vport;int err; ovs_header = genlmsg_put(skb, portid, seq, &dp_vport_genl_family,
@@ -1996,12 +1997,15 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, nla_put_u32(skb, OVS_VPORT_ATTR_IFINDEX, vport->dev->ifindex)) goto nla_put_failure; -if (!net_eq (net,dev_net (vport->dev))) { -int id =peernet2id_alloc (net,dev_net (vport->dev), gfp); +rcu_read_lock (); + net_vport =dev_net_rcu (vport->dev); +if (!net_eq (net, net_vport)) { +int id =peernet2id_alloc (net, net_vport,GFP_ATOMIC );if (nla_put_s32 (skb,OVS_VPORT_ATTR_NETNSID , id)) - goto nla_put_failure; + goto nla_put_failure_unlock; } +rcu_read_unlock ();ovs_vport_get_stats (vport, &vport_stats); if (nla_put_64bit(skb, OVS_VPORT_ATTR_STATS,
@@ -2019,6 +2023,8 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb,genlmsg_end (skb, ovs_header);return 0 ; +nla_put_failure_unlock: +rcu_read_unlock (); nla_put_failure: err = -EMSGSIZE ; error:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 289/462 ndisc: extend RCU protection in ndisc_send_skb()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ed6ae1f325d3c43966ec1b62ac1459e2b8e45640 ]
ndisc_send_skb() can be called without RTNL or RCU held.
Acquire rcu_read_lock() earlier, so that we can use dev_net_rcu() and avoid a potential UAF.
--- net/ipv6/ndisc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/ipv6/ndisc.c +8 -4
@@ -471,16 +471,20 @@ static void ndisc_send_skb(struct sk_buff *skb,const struct in6_addr *daddr, const struct in6_addr *saddr) { + struct icmp6hdr *icmp6h = icmp6_hdr(skb);struct dst_entry *dst =skb_dst (skb); -struct net *net =dev_net (skb->dev); -struct sock *sk = net->ipv6.ndisc_sk;struct inet6_dev *idev; +struct net *net; +struct sock *sk;int err; -struct icmp6hdr *icmp6h =icmp6_hdr (skb);u8 type; type = icmp6h->icmp6_type; +rcu_read_lock (); + + net =dev_net_rcu (skb->dev); + sk = net->ipv6.ndisc_sk;if (!dst) {struct flowi6 fl6;int oif = skb->dev->ifindex;
@@ -488,6 +492,7 @@ static void ndisc_send_skb(struct sk_buff *skb,icmpv6_flow_init (sk, &fl6, type, saddr, daddr, oif); dst =icmp6_dst_alloc (skb->dev, &fl6);if (IS_ERR (dst)) { +rcu_read_unlock ();kfree_skb (skb);return ; }
@@ -502,7 +507,6 @@ static void ndisc_send_skb(struct sk_buff *skb,ip6_nd_hdr (skb, saddr, daddr,inet6_sk (sk)->hop_limit, skb->len); -rcu_read_lock (); idev =__in6_dev_get (dst->dev);IP6_UPD_PO_STATS (net, idev,IPSTATS_MIB_OUT , skb->len);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 290/462 drm/tidss: Fix issue in irq handling causing irq-flood issue
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 44b6730ab53ef04944fbaf6da0e77397531517b7 upstream.
It has been observed that sometimes DSS will trigger an interrupt and the top level interrupt (DISPC_IRQSTATUS) is not zero, but the VP and VID level interrupt-statuses are zero.
As the top level irqstatus is supposed to tell whether we have VP/VID interrupts, the thinking of the driver authors was that this particular case could never happen. Thus the driver only clears the DISPC_IRQSTATUS bits which has corresponding interrupts in VP/VID status. So when this issue happens, the driver will not clear DISPC_IRQSTATUS, and we get an interrupt flood.
It is unclear why the issue happens. It could be a race issue in the driver, but no such race has been found. It could also be an issue with the HW. However a similar case can be easily triggered by manually writing to DISPC_IRQSTATUS_RAW. This will forcibly set a bit in the DISPC_IRQSTATUS and trigger an interrupt, and as the driver never clears the bit, we get an interrupt flood.
To fix the issue, always clear DISPC_IRQSTATUS. The concern with this solution is that if the top level irqstatus is the one that triggers the interrupt, always clearing DISPC_IRQSTATUS might leave some interrupts unhandled if VP/VID interrupt statuses have bits set. However, testing shows that if any of the irqstatuses is set (i.e. even if DISPC_IRQSTATUS == 0, but a VID irqstatus has a bit set), we will get an interrupt.
--- drivers/gpu/drm/tidss/tidss_dispc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/tidss/tidss_dispc.c +4 -8
@@ -676,24 +676,20 @@ staticvoid dispc_k3_clear_irqstatus (struct dispc_device *dispc,dispc_irq_t clearmask) {unsigned int i; -u32 top_clear =0 ;for (i =0 ; i < dispc->feat->num_vps; ++i) { -if (clearmask &DSS_IRQ_VP_MASK (i)) { +if (clearmask &DSS_IRQ_VP_MASK (i))dispc_k3_vp_write_irqstatus (dispc, i, clearmask); - top_clear |=BIT (i); - } }for (i =0 ; i < dispc->feat->num_planes; ++i) { -if (clearmask &DSS_IRQ_PLANE_MASK (i)) { +if (clearmask &DSS_IRQ_PLANE_MASK (i))dispc_k3_vid_write_irqstatus (dispc, i, clearmask); - top_clear |=BIT (4 + i); - } }if (dispc->feat->subrev ==DISPC_K2G )return ; -dispc_write (dispc,DISPC_IRQSTATUS , top_clear); +/* always clear the top level irqstatus */ +dispc_write (dispc,DISPC_IRQSTATUS ,dispc_read (dispc,DISPC_IRQSTATUS ));/* Flush posted writes */ dispc_read (dispc,DISPC_IRQSTATUS );
Greg Kroah-Hartman
maintainerPATCH 291/462 drm/tidss: Clear the interrupt status for interrupts being disabled
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devarsh Thakkar <[email protected]>
commit 361a2ebb5cad211732ec3c5d962de49b21895590 upstream.
The driver does not touch the irqstatus register when it is disabling interrupts. This might cause an interrupt to trigger for an interrupt that was just disabled.
To fix the issue, clear the irqstatus registers right after disabling the interrupts.
--- drivers/gpu/drm/tidss/tidss_dispc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/tidss/tidss_dispc.c +8 -2
@@ -596,7 +596,7 @@ void dispc_k2g_set_irqenable(struct disp {dispc_irq_t old_mask =dispc_k2g_read_irqenable (dispc); -/* clear the irqstatus for newly enabled irqs */ +/* clear the irqstatus for irqs that will be enabled */ dispc_k2g_clear_irqstatus (dispc, (mask ^ old_mask) & mask);dispc_k2g_vp_set_irqenable (dispc,0 , mask);
@@ -604,6 +604,9 @@ void dispc_k2g_set_irqenable(struct dispdispc_write (dispc,DISPC_IRQENABLE_SET , (1 <<0 ) | (1 <<7 )); +/* clear the irqstatus for irqs that were disabled */ +dispc_k2g_clear_irqstatus (dispc, (mask ^ old_mask) & old_mask); +/* flush posted write */ dispc_k2g_read_irqenable (dispc); }
@@ -735,7 +738,7 @@ static void dispc_k3_set_irqenable(struc old_mask =dispc_k3_read_irqenable (dispc); -/* clear the irqstatus for newly enabled irqs */ +/* clear the irqstatus for irqs that will be enabled */ dispc_k3_clear_irqstatus (dispc, (old_mask ^ mask) & mask);for (i =0 ; i < dispc->feat->num_vps; ++i) {
@@ -760,6 +763,9 @@ static void dispc_k3_set_irqenable(strucif (main_disable)dispc_write (dispc,DISPC_IRQENABLE_CLR , main_disable); +/* clear the irqstatus for irqs that were disabled */ +dispc_k3_clear_irqstatus (dispc, (old_mask ^ mask) & old_mask); +/* Flush posted writes */ dispc_read (dispc,DISPC_IRQENABLE_SET ); }
Greg Kroah-Hartman
maintainerPATCH 292/462 kdb: Do not assume write() callback available
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
commit 6d3e0d8cc63221dec670d0ee92ac57961581e975 upstream.
It is allowed for consoles to not provide a write() callback. For example ttynull does this.
Check if a write() callback is available before using it.
--- kernel/debug/kdb/kdb_io.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/debug/kdb/kdb_io.c +2 -0
@@ -577,6 +577,8 @@ static void kdb_msg_write(const char *mscontinue ;if (c == dbg_io_ops->cons)continue ; +if (!c->write) +continue ;/* * Set oops_in_progress to encourage the console drivers to * disregard their internal spin locks: in the current calling
Greg Kroah-Hartman
maintainerPATCH 293/462 x86/static-call: Remove early_boot_irqs_disabled check to fix Xen PVH dom0
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Cooper <[email protected]>
commit 5cc2db37124bb33914996d6fdbb2ddb3811f2945 upstream.
__static_call_update_early() has a check for early_boot_irqs_disabled, but is used before early_boot_irqs_disabled is set up in start_kernel().
Xen PV has always special cased early_boot_irqs_disabled, but Xen PVH does not and falls over the BUG when booting as dom0.
It is very suspect that early_boot_irqs_disabled starts as 0, becomes 1 for a time, then becomes 0 again, but as this needs backporting to fix a breakage in a security fix, dropping the BUG_ON() is the far safer option.
--- arch/x86/kernel/static_call.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/kernel/static_call.c +0 -1
@@ -113,7 +113,6 @@ EXPORT_SYMBOL_GPL(arch_static_call_trans noinstr void __static_call_update_early(void *tramp, void *func) {BUG_ON (system_state !=SYSTEM_BOOTING ); -BUG_ON (!early_boot_irqs_disabled);BUG_ON (static_call_initialized);__text_gen_insn (tramp,JMP32_INSN_OPCODE , tramp, func,JMP32_INSN_SIZE );sync_core ();
Greg Kroah-Hartman
maintainerPATCH 294/462 alpha: replace hardcoded stack offsets with autogenerated ones
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Kokshaysky <[email protected]>
commit 77b823fa619f97d16409ca37ad4f7936e28c5f83 upstream.
This allows the assembly in entry.S to automatically keep in sync with changes in the stack layout (struct pt_regs and struct switch_stack).
--- arch/alpha/kernel/asm-offsets.c | 2 ++ arch/alpha/kernel/entry.S | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-)
arch/alpha/kernel/asm-offsets.c +2 -0
@@ -32,7 +32,9 @@ void foo(void)DEFINE (CRED_EGID , offsetof(struct cred , egid));BLANK (); +DEFINE (SP_OFF , offsetof(struct pt_regs , ps));DEFINE (SIZEOF_PT_REGS ,sizeof (struct pt_regs )); +DEFINE (SWITCH_STACK_SIZE ,sizeof (struct switch_stack ));DEFINE (PT_PTRACED ,PT_PTRACED );DEFINE (CLONE_VM ,CLONE_VM );DEFINE (CLONE_UNTRACED ,CLONE_UNTRACED );
arch/alpha/kernel/entry.S +0 -4
@@ -15,10 +15,6 @@ .set noat .cfi_sections .debug_frame -/* Stack offsets. */ -#define SP_OFF 184 -#define SWITCH_STACK_SIZE 320 - .macro CFI_START_OSF_FRAME func .align 4 .globl \func
Greg Kroah-Hartman
maintainerPATCH 295/462 nilfs2: do not output warnings when clearing dirty buffers
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 299910dcb4525ac0274f3efa9527876315ba4f67 upstream.
After detecting file system corruption and degrading to a read-only mount, dirty folios and buffers in the page cache are cleared, and a large number of warnings are output at that time, often filling up the kernel log.
In this case, since the degrading to a read-only mount is output to the kernel log, these warnings are not very meaningful, and are rather a nuisance in system management and debugging.
The related nilfs2-specific page/folio routines have a silent argument that suppresses the warning output, but since it is not currently used meaningfully, remove both the silent argument and the warning output.
Stable-dep-of: ca76bb226bf4 ("nilfs2: do not force clear folio if buffer is referenced")
--- fs/nilfs2/inode.c | 4 ++-- fs/nilfs2/mdt.c | 6 +++--- fs/nilfs2/page.c | 20 +++----------------- fs/nilfs2/page.h | 4 ++-- 4 files changed, 10 insertions(+), 24 deletions(-)
fs/nilfs2/inode.c +2 -2
@@ -162,7 +162,7 @@ static int nilfs_writepages(struct addreint err =0 ;if (sb_rdonly (inode->i_sb)) { -nilfs_clear_dirty_pages (mapping, false); +nilfs_clear_dirty_pages (mapping);return -EROFS ; }
@@ -185,7 +185,7 @@ static int nilfs_writepage(struct page ** have dirty pages that try to be flushed in background. * So, here we simply discard this dirty page. */ -nilfs_clear_dirty_page (page, false); +nilfs_clear_dirty_page (page);unlock_page (page);return -EROFS ; }
fs/nilfs2/mdt.c +3 -3
@@ -410,7 +410,7 @@ nilfs_mdt_write_page(struct page *page,* have dirty pages that try to be flushed in background. * So, here we simply discard this dirty page. */ -nilfs_clear_dirty_page (page, false); +nilfs_clear_dirty_page (page);unlock_page (page);return -EROFS ; }
@@ -631,10 +631,10 @@ void nilfs_mdt_restore_from_shadow_map(sif (mi->mi_palloc_cache)nilfs_palloc_clear_cache (inode); -nilfs_clear_dirty_pages (inode->i_mapping, true); +nilfs_clear_dirty_pages (inode->i_mapping);nilfs_copy_back_pages (inode->i_mapping, shadow->inode->i_mapping); -nilfs_clear_dirty_pages (ii->i_assoc_inode->i_mapping, true); +nilfs_clear_dirty_pages (ii->i_assoc_inode->i_mapping);nilfs_copy_back_pages (ii->i_assoc_inode->i_mapping,NILFS_I (shadow->inode)->i_assoc_inode->i_mapping);
fs/nilfs2/page.c +3 -17
@@ -354,9 +354,8 @@ repeat:/** * nilfs_clear_dirty_pages - discard dirty pages in address space * @mapping: address space with dirty pages for discarding -* @silent: suppress [true] or print [false] warning messages */ -void nilfs_clear_dirty_pages (struct address_space *mapping,bool silent) +void nilfs_clear_dirty_pages (struct address_space *mapping) {struct pagevec pvec;unsigned int i;
@@ -377,7 +376,7 @@ void nilfs_clear_dirty_pages(struct addr* was acquired. Skip processing in that case. */ if (likely (page->mapping == mapping)) -nilfs_clear_dirty_page (page, silent); +nilfs_clear_dirty_page (page);unlock_page (page); }
@@ -389,19 +388,11 @@ void nilfs_clear_dirty_pages(struct addr/** * nilfs_clear_dirty_page - discard dirty page * @page: dirty page that will be discarded -* @silent: suppress [true] or print [false] warning messages */ -void nilfs_clear_dirty_page (struct page *page,bool silent) +void nilfs_clear_dirty_page (struct page *page) { -struct inode *inode = page->mapping->host; -struct super_block *sb = inode->i_sb; -BUG_ON (!PageLocked (page)); -if (!silent) -nilfs_warn (sb,"discard dirty page: offset=%lld, ino=%lu" , -page_offset (page), inode->i_ino); -ClearPageUptodate (page);ClearPageMappedToDisk (page);ClearPageChecked (page);
@@ -417,11 +408,6 @@ void nilfs_clear_dirty_page(struct page bh = head =page_buffers (page);do {lock_buffer (bh); -if (!silent) -nilfs_warn (sb, -"discard dirty block: blocknr=%llu, size=%zu" , - (u64 )bh->b_blocknr, bh->b_size); -set_mask_bits (&bh->b_state, clear_bits,0 );unlock_buffer (bh); }while (bh = bh->b_this_page, bh != head);
fs/nilfs2/page.h +2 -2
@@ -41,8 +41,8 @@ void nilfs_page_bug(struct page *);int nilfs_copy_dirty_pages (struct address_space *,struct address_space *);void nilfs_copy_back_pages (struct address_space *,struct address_space *); -void nilfs_clear_dirty_page (struct page *,bool ); -void nilfs_clear_dirty_pages (struct address_space *,bool ); +void nilfs_clear_dirty_page (struct page *page); +void nilfs_clear_dirty_pages (struct address_space *mapping);void nilfs_mapping_init (struct address_space *mapping,struct inode *inode);unsigned int nilfs_page_count_clean_buffers (struct page *,unsigned int ,unsigned int );
Greg Kroah-Hartman
maintainerPATCH 296/462 nilfs2: do not force clear folio if buffer is referenced
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit ca76bb226bf47ff04c782cacbd299f12ddee1ec1 upstream.
Patch series "nilfs2: protect busy buffer heads from being force-cleared".
This series fixes the buffer head state inconsistency issues reported by syzbot that occurs when the filesystem is corrupted and falls back to read-only, and the associated buffer head use-after-free issue.
This patch (of 2):
Syzbot has reported that after nilfs2 detects filesystem corruption and falls back to read-only, inconsistencies in the buffer state may occur.
One of the inconsistencies is that when nilfs2 calls mark_buffer_dirty() to set a data or metadata buffer as dirty, but it detects that the buffer is not in the uptodate state:
WARNING: CPU: 0 PID: 6049 at fs/buffer.c:1177 mark_buffer_dirty+0x2e5/0x520 fs/buffer.c:1177 ... Call Trace: <TASK> nilfs_palloc_commit_alloc_entry+0x4b/0x160 fs/nilfs2/alloc.c:598 nilfs_ifile_create_inode+0x1dd/0x3a0 fs/nilfs2/ifile.c:73 nilfs_new_inode+0x254/0x830 fs/nilfs2/inode.c:344 nilfs_mkdir+0x10d/0x340 fs/nilfs2/namei.c:218 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257 do_mkdirat+0x264/0x3a0 fs/namei.c:4280 __do_sys_mkdirat fs/namei.c:4295 [inline] __se_sys_mkdirat fs/namei.c:4293 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4293 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
The other is when nilfs_btree_propagate(), which propagates the dirty state to the ancestor nodes of a b-tree that point to a dirty buffer, detects that the origin buffer is not dirty, even though it should be:
WARNING: CPU: 0 PID: 5245 at fs/nilfs2/btree.c:2089 nilfs_btree_propagate+0xc79/0xdf0 fs/nilfs2/btree.c:2089 ... Call Trace: <TASK> nilfs_bmap_propagate+0x75/0x120 fs/nilfs2/bmap.c:345 nilfs_collect_file_data+0x4d/0xd0 fs/nilfs2/segment.c:587 nilfs_segctor_apply_buffers+0x184/0x340 fs/nilfs2/segment.c:1006 nilfs_segctor_scan_file+0x28c/0xa50 fs/nilfs2/segment.c:1045 nilfs_segctor_collect_blocks fs/nilfs2/segment.c:1216 [inline] nilfs_segctor_collect fs/nilfs2/segment.c:1540 [inline] nilfs_segctor_do_construct+0x1c28/0x6b90 fs/nilfs2/segment.c:2115 nilfs_segctor_construct+0x181/0x6b0 fs/nilfs2/segment.c:2479 nilfs_segctor_thread_construct fs/nilfs2/segment.c:2587 [inline] nilfs_segctor_thread+0x69e/0xe80 fs/nilfs2/segment.c:2701 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 </TASK>
Both of these issues are caused by the callbacks that handle the page/folio write requests, forcibly clear various states, including the working state of the buffers they hold, at unexpected times when they detect read-only fallback.
Fix these issues by checking if the buffer is referenced before clearing the page/folio state, and skipping the clear if it is.
--- fs/nilfs2/page.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-)
fs/nilfs2/page.c +29 -6
@@ -388,24 +388,44 @@ void nilfs_clear_dirty_pages(struct addr/** * nilfs_clear_dirty_page - discard dirty page * @page: dirty page that will be discarded +* +* nilfs_clear_dirty_page() clears working states including dirty state for +* the page and its buffers. If the page has buffers, clear only if it is +* confirmed that none of the buffer heads are busy (none have valid +* references and none are locked). */ void nilfs_clear_dirty_page (struct page *page) {BUG_ON (!PageLocked (page)); -ClearPageUptodate (page); -ClearPageMappedToDisk (page); -ClearPageChecked (page); -if (page_has_buffers (page)) { -struct buffer_head *bh, *head; +struct buffer_head *bh, *head =page_buffers (page);const unsigned long clear_bits = (BIT (BH_Uptodate) |BIT (BH_Dirty) |BIT (BH_Mapped) |BIT (BH_Async_Write) |BIT (BH_NILFS_Volatile) |BIT (BH_NILFS_Checked) |BIT (BH_NILFS_Redirected) |BIT (BH_Delay)); +bool busy, invalidated = false; - bh = head =page_buffers (page); +recheck_buffers: + busy = false; + bh = head; +do { +if (atomic_read (&bh->b_count) |buffer_locked (bh)) { + busy = true; +break ; + } + }while (bh = bh->b_this_page, bh != head); + +if (busy) { +if (invalidated) +return ; +invalidate_bh_lrus (); + invalidated = true; + goto recheck_buffers; + } + + bh = head; do { lock_buffer(bh); set_mask_bits(&bh->b_state, clear_bits, 0);
@@ -413,6 +433,9 @@ void nilfs_clear_dirty_page(struct page }while (bh = bh->b_this_page, bh != head); } +ClearPageUptodate (page); +ClearPageMappedToDisk (page); +ClearPageChecked (page);__nilfs_clear_page_dirty (page); }
Greg Kroah-Hartman
maintainerPATCH 297/462 nilfs2: protect access to buffers with no active references
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 367a9bffabe08c04f6d725032cce3d891b2b9e1a upstream.
nilfs_lookup_dirty_data_buffers(), which iterates through the buffers attached to dirty data folios/pages, accesses the attached buffers without locking the folios/pages.
For data cache, nilfs_clear_folio_dirty() may be called asynchronously when the file system degenerates to read only, so nilfs_lookup_dirty_data_buffers() still has the potential to cause use after free issues when buffers lose the protection of their dirty state midway due to this asynchronous clearing and are unintentionally freed by try_to_free_buffers().
Eliminate this race issue by adjusting the lock section in this function.
--- fs/nilfs2/segment.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nilfs2/segment.c +3 -1
@@ -732,7 +732,6 @@ static size_t nilfs_lookup_dirty_data_bu }if (!page_has_buffers (page))create_empty_buffers (page,i_blocksize (inode),0 ); -unlock_page (page); bh = head =page_buffers (page); do {
@@ -742,11 +741,14 @@ static size_t nilfs_lookup_dirty_data_bulist_add_tail (&bh->b_assoc_buffers, listp); ndirties++;if (unlikely (ndirties >= nlimit)) { +unlock_page (page);pagevec_release (&pvec);cond_resched ();return ndirties; } }while (bh = bh->b_this_page, bh != head); + +unlock_page (page); }pagevec_release (&pvec);cond_resched ();
Greg Kroah-Hartman
maintainerPATCH 298/462 can: ems_pci: move ASIX AX99100 ids to pci_ids.h
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaqing Zhao <[email protected]>
commit 3029ad91335353a70feb42acd24d580d70ab258b upstream.
Move PCI Vendor and Device ID of ASIX AX99100 PCIe to Multi I/O Controller to pci_ids.h for its serial and parallel port driver support in subsequent patches.
--- include/linux/pci_ids.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/pci_ids.h +4 -0
@@ -1765,6 +1765,10 @@#define PCI_SUBDEVICE_ID_AT_2700FX 0x2701#define PCI_SUBDEVICE_ID_AT_2701FX 0x2703 +#define PCI_VENDOR_ID_ASIX 0x125b +#define PCI_DEVICE_ID_ASIX_AX99100 0x9100 +#define PCI_DEVICE_ID_ASIX_AX99100_LB 0x9110 +#define PCI_VENDOR_ID_ESS 0x125d#define PCI_DEVICE_ID_ESS_ESS1968 0x1968#define PCI_DEVICE_ID_ESS_ESS1978 0x1978
Greg Kroah-Hartman
maintainerPATCH 299/462 serial: 8250_pci: add support for ASIX AX99100
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaqing Zhao <[email protected]>
commit 0b32216557ce3b2a468d1282d99b428bf72ff532 upstream.
Each of the 4 PCI functions on ASIX AX99100 PCIe to Multi I/O Controller can be configured as a single-port serial port controller. The subvendor id is 0x1000 when configured as serial port and MSI interrupts are supported.
--- drivers/tty/serial/8250/8250_pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/tty/serial/8250/8250_pci.c +10 -0
@@ -65,6 +65,8 @@ static const struct pci_device_id pci_us 0xA000, 0x1000) }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_NETMOS ,PCI_DEVICE_ID_NETMOS_9922 , 0xA000, 0x1000) }, + { PCI_DEVICE_SUB(PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100, + 0xA000, 0x1000) }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL, PCI_ANY_ID, PCI_ANY_ID) }, { }
@@ -5785,6 +5787,14 @@ static const struct pci_device_id serial {PCI_VENDOR_ID_NETMOS ,PCI_DEVICE_ID_NETMOS_9865 ,0xA000 ,0x3004 , 0, 0, pbn_b0_bt_4_115200 }, + +/* +* ASIX AX99100 PCIe to Multi I/O Controller +*/ + { PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100, +0xA000 ,0x1000 , + 0, 0, pbn_b0_1_115200 }, +/* Intel CE4100 */ { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Greg Kroah-Hartman
maintainerPATCH 300/462 parport_pc: add support for ASIX AX99100
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaqing Zhao <[email protected]>
commit 16aae4c64600a6319a6f10dbff833fa198bf9599 upstream.
The PCI function 2 on ASIX AX99100 PCIe to Multi I/O Controller can be configured as a single-port parallel port controller. The subvendor id is 0x2000 when configured as parallel port. It supports IEEE-1284 EPP / ECP with its ECR on BAR1.
--- drivers/parport/parport_pc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/parport/parport_pc.c +5 -0
@@ -2611,6 +2611,7 @@ enum parport_pc_pci_cards { netmos_9815, netmos_9901, netmos_9865, + asix_ax99100, quatech_sppxp100, wch_ch382l, brainboxes_uc146,
@@ -2676,6 +2677,7 @@ static struct parport_pc_pci { /* netmos_9815 */ { 2, { { 0, 1 }, { 2, 3 }, } }, /* netmos_9901 */ { 1, { { 0, -1 }, } }, /* netmos_9865 */ { 1, { { 0, -1 }, } }, + /* asix_ax99100 */ { 1, { { 0, 1 }, } }, /* quatech_sppxp100 */ { 1, { { 0, 1 }, } }, /* wch_ch382l */ { 1, { { 2, -1 }, } }, /* brainboxes_uc146 */ { 1, { { 3, -1 }, } },
@@ -2766,6 +2768,9 @@ static const struct pci_device_id parpor 0xA000, 0x1000, 0, 0, netmos_9865 }, {PCI_VENDOR_ID_NETMOS ,PCI_DEVICE_ID_NETMOS_9865 , 0xA000, 0x2000, 0, 0, netmos_9865 }, +/* ASIX AX99100 PCIe to Multi I/O Controller */ + { PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100, + 0xA000, 0x2000, 0, 0, asix_ax99100 },/* Quatech SPPXP-100 Parallel port PCI ExpressCard */ { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
Greg Kroah-Hartman
maintainerPATCH 301/462 netdevsim: print human readable IP address
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
commit c71bc6da6198a6d88df86094f1052bb581951d65 upstream.
Currently, IPSec addresses are printed in hexadecimal format, which is not user-friendly. e.g.
# cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec SA count=2 tx=20 sa[0] rx ipaddr=0x00000000 00000000 00000000 0100a8c0 sa[0] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[0] key=0x3167608a ca4f1397 43565909 941fa627 sa[1] tx ipaddr=0x00000000 00000000 00000000 00000000 sa[1] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[1] key=0x3167608a ca4f1397 43565909 941fa627
This patch updates the code to print the IPSec address in a human-readable format for easier debug. e.g.
# cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec SA count=4 tx=40 sa[0] tx ipaddr=0.0.0.0 sa[0] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[0] key=0x3167608a ca4f1397 43565909 941fa627 sa[1] rx ipaddr=192.168.0.1 sa[1] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[1] key=0x3167608a ca4f1397 43565909 941fa627 sa[2] tx ipaddr=:: sa[2] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[2] key=0x3167608a ca4f1397 43565909 941fa627 sa[3] rx ipaddr=2000::1 sa[3] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[3] key=0x3167608a ca4f1397 43565909 941fa627
--- drivers/net/netdevsim/ipsec.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/netdevsim/ipsec.c +8 -4
@@ -39,10 +39,14 @@ static ssize_t nsim_dbg_netdev_ops_read(if (!sap->used)continue ; - p +=scnprintf (p, bufsize - (p - buf), -"sa[%i] %cx ipaddr=0x%08x %08x %08x %08x\n" , - i, (sap->rx ?'r' :'t' ), sap->ipaddr[0 ], - sap->ipaddr[1 ], sap->ipaddr[2 ], sap->ipaddr[3 ]); +if (sap->xs->props.family ==AF_INET6 ) + p +=scnprintf (p, bufsize - (p - buf), +"sa[%i] %cx ipaddr=%pI6c\n" , + i, (sap->rx ?'r' :'t' ), &sap->ipaddr); +else + p +=scnprintf (p, bufsize - (p - buf), +"sa[%i] %cx ipaddr=%pI4\n" , + i, (sap->rx ?'r' :'t' ), &sap->ipaddr[3 ]); p += scnprintf(p, bufsize - (p - buf), "sa[%i] spi=0x%08x proto=0x%x salt=0x%08x crypt=%d\n", i, be32_to_cpu(sap->xs->id.spi),
Greg Kroah-Hartman
maintainerPATCH 302/462 selftests: rtnetlink: update netdevsim ipsec output format
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
commit 3ec920bb978ccdc68a7dfb304d303d598d038cb1 upstream.
After the netdevsim update to use human-readable IP address formats for IPsec, we can now use the source and destination IPs directly in testing. Here is the result:
# ./rtnetlink.sh -t kci_test_ipsec_offload PASS: ipsec_offload
--- tools/testing/selftests/net/rtnetlink.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/rtnetlink.sh +2 -2
@@ -813,10 +813,10 @@ kci_test_ipsec_offload() # does driver have correct offload info diff $sysfsf - << EOF SA count=2 tx=3 -sa[0] tx ipaddr=0x00000000 00000000 00000000 00000000 +sa[0] tx ipaddr=$dstip sa[0] spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1 sa[0] key=0x34333231 38373635 32313039 36353433 -sa[1] rx ipaddr=0x00000000 00000000 00000000 037ba8c0 +sa[1] rx ipaddr=$srcip sa[1] spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1 sa[1] key=0x34333231 38373635 32313039 36353433 EOF
Greg Kroah-Hartman
maintainerPATCH 303/462 f2fs: fix to wait dio completion
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
commit 96cfeb0389530ae32ade8a48ae3ae1ac3b6c009d upstream.
It should wait all existing dio write IOs before block removal, otherwise, previous direct write IO may overwrite data in the block which may be reused by other inode.
--- fs/f2fs/file.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/f2fs/file.c +13 -0
@@ -957,6 +957,13 @@ int f2fs_setattr(struct dentry *dentry,return err; } +/* +* wait for inflight dio, blocks should be removed after +* IO completion. +*/ +if (attr->ia_size < old_size) +inode_dio_wait (inode); +down_write (&F2FS_I (inode)->i_gc_rwsem[WRITE ]);down_write (&F2FS_I (inode)->i_mmap_sem);
@@ -1777,6 +1784,12 @@ static long f2fs_fallocate(struct file *if (ret) goto out; +/* +* wait for inflight dio, blocks should be removed after IO +* completion. +*/ +inode_dio_wait (inode); +if (mode &FALLOC_FL_PUNCH_HOLE ) {if (offset >= inode->i_size) goto out;
Greg Kroah-Hartman
maintainerPATCH 304/462 x86/i8253: Disable PIT timer 0 when not in use
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
commit 70e6b7d9ae3c63df90a7bba7700e8d5c300c3c60 upstream.
Leaving the PIT interrupt running can cause noticeable steal time for virtual guests. The VMM generally has a timer which toggles the IRQ input to the PIC and I/O APIC, which takes CPU time away from the guest. Even on real hardware, running the counter may use power needlessly (albeit not much).
Make sure it's turned off if it isn't going to be used.
--- arch/x86/kernel/i8253.c | 11 +++++++++-- drivers/clocksource/i8253.c | 13 +++++++++---- include/linux/i8253.h | 1 + 3 files changed, 19 insertions(+), 6 deletions(-)
arch/x86/kernel/i8253.c +9 -2
@@ -8,6 +8,7 @@#include <linux/timex.h> #include <linux/i8253.h> +#include <asm/hypervisor.h> #include <asm/apic.h> #include <asm/hpet.h> #include <asm/time.h>
@@ -39,9 +40,15 @@ static bool __init use_pit(void)bool __init pit_timer_init (void ) { -if (!use_pit ()) +if (!use_pit ()) { +/* +* Don't just ignore the PIT. Ensure it's stopped, because +* VMMs otherwise steal CPU time just to pointlessly waggle +* the (masked) IRQ. +*/ +clockevent_i8253_disable ();return false; - + }clockevent_i8253_init (true); global_clock_event = &i8253_clockevent;return true;
drivers/clocksource/i8253.c +9 -4
@@ -108,11 +108,8 @@ int __init clocksource_i8253_init(void)#endif #ifdef CONFIG_CLKEVT_I8253 -static int pit_shutdown (struct clock_event_device *evt) +void clockevent_i8253_disable (void ) { -if (!clockevent_state_oneshot (evt) && !clockevent_state_periodic (evt)) -return 0 ; -raw_spin_lock (&i8253_lock);outb_p (0x30 ,PIT_MODE );
@@ -123,6 +120,14 @@ static int pit_shutdown(struct clock_eve }raw_spin_unlock (&i8253_lock); +} + +static int pit_shutdown (struct clock_event_device *evt) +{ +if (!clockevent_state_oneshot (evt) && !clockevent_state_periodic (evt)) +return 0 ; + +clockevent_i8253_disable ();return 0 ; }
include/linux/i8253.h +1 -0
@@ -24,6 +24,7 @@ extern raw_spinlock_t i8253_lock;extern bool i8253_clear_counter_on_shutdown;extern struct clock_event_device i8253_clockevent;extern void clockevent_i8253_init (bool oneshot); +extern void clockevent_i8253_disable (void );extern void setup_pit_timer (void );
Re: [EXTERNAL] [PATCH 5.10 304/462] x86/i8253: Disable PIT timer 0 when not in use
Quoted 14 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
commit
70e6b7d9ae3c63df90a7bba7700e8d5c300c3c60upstream.Leaving the PIT interrupt running can cause noticeable steal time for virtual guests. The VMM generally has a timer which toggles the IRQ input to the PIC and I/O APIC, which takes CPU time away from the guest. Even on real hardware, running the counter may use power needlessly (albeit not much).
Quoted 7 lines
Make sure it's turned off if it isn't going to be used.
Signed-off-by David Woodhouse <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>Tested-by Michael Kelley <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
You probably want commit 531b2ca0a940ac ("clockevents/drivers/i8253:
Fix stop sequence for timer 0") too, to make sure it *does* actually stop the PIT correctly.
Greg Kroah-Hartman
maintainerRe: [EXTERNAL] [PATCH 5.10 304/462] x86/i8253: Disable PIT timer 0 when not in use
Quoted 23 lines · David Woodhouse
Quoted 14 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
commit
70e6b7d9ae3c63df90a7bba7700e8d5c300c3c60upstream.Leaving the PIT interrupt running can cause noticeable steal time for virtual guests. The VMM generally has a timer which toggles the IRQ input to the PIC and I/O APIC, which takes CPU time away from the guest. Even on real hardware, running the counter may use power needlessly (albeit not much).
Quoted 7 lines
Make sure it's turned off if it isn't going to be used.
Signed-off-by David Woodhouse <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>Tested-by Michael Kelley <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 3 lines
You probably want commit
531b2ca0a940ac("clockevents/drivers/i8253:
Fix stop sequence for timer 0") too, to make sure it *does* actually stop the PIT correctly.
As well as for all of the other stable branches that this showed up in. I'll queue that up for the next round of stable releases.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 305/462 Revert "btrfs: avoid monopolizing a core when activating a swap file"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <[email protected]>
This reverts commit a1c3a19446a440c68e80e9c34c5f308ff58aac88.
The backport for linux-5.10.y, commit a1c3a19446a4 ("btrfs: avoid monopolizing a core when activating a swap file"), inserted cond_resched() in the wrong location.
Revert it now; a subsequent commit will re-backport the original patch.
--- fs/btrfs/inode.c | 2 -- 1 file changed, 2 deletions(-)
fs/btrfs/inode.c +0 -2
@@ -7127,8 +7127,6 @@ noinline int can_nocow_extent(struct ino ret = -EAGAIN ; goto out; } - -cond_resched (); }btrfs_release_path (path);
Greg Kroah-Hartman
maintainerPATCH 306/462 btrfs: avoid monopolizing a core when activating a swap file
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 2c8507c63f5498d4ee4af404a8e44ceae4345056 upstream.
This commit re-attempts the backport of the change to the linux-5.10.y branch. Commit a1c3a19446a4 ("btrfs: avoid monopolizing a core when activating a swap file") on this branch was reverted.
During swap activation we iterate over the extents of a file and we can have many thousands of them, so we can end up in a busy loop monopolizing a core. Avoid this by doing a voluntary reschedule after processing each extent.
--- fs/btrfs/inode.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/inode.c +2 -0
@@ -10422,6 +10422,8 @@ static int btrfs_swap_activate(struct sw } start += len; + +cond_resched (); }if (bsi.block_len)
Greg Kroah-Hartman
maintainerPATCH 307/462 pps: Fix a use-after-free
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Calvin Owens <[email protected]>
commit c79a39dc8d060b9e64e8b0fa9d245d44befeefbe upstream.
On a board running ntpd and gpsd, I'm seeing a consistent use-after-free in sys_exit() from gpsd when rebooting:
pps pps1: removed
------------[ cut here ]------------
kobject: '(null)' (00000000db4bec24): is not initialized, yet kobject_put() is being called.
WARNING: CPU: 2 PID: 440 at lib/kobject.c:734 kobject_put+0x120/0x150
CPU: 2 UID: 299 PID: 440 Comm: gpsd Not tainted 6.11.0-rc6-00308-gb31c44928842 #1
Hardware name: Raspberry Pi 4 Model B Rev 1.1 (DT)
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : kobject_put+0x120/0x150
lr : kobject_put+0x120/0x150
sp : ffffffc0803d3ae0
x29: ffffffc0803d3ae0 x28: ffffff8042dc9738 x27: 0000000000000001
x26: 0000000000000000 x25: ffffff8042dc9040 x24: ffffff8042dc9440
x23: ffffff80402a4620 x22: ffffff8042ef4bd0 x21: ffffff80405cb600
x20: 000000000008001b x19: ffffff8040b3b6e0 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 696e6920746f6e20
x14: 7369203a29343263 x13: 205d303434542020 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
Call trace:
kobject_put+0x120/0x150
cdev_put+0x20/0x3c
__fput+0x2c4/0x2d8
____fput+0x1c/0x38
task_work_run+0x70/0xfc
do_exit+0x2a0/0x924
do_group_exit+0x34/0x90
get_signal+0x7fc/0x8c0
do_signal+0x128/0x13b4
do_notify_resume+0xdc/0x160
el0_svc+0xd4/0xf8
el0t_64_sync_handler+0x140/0x14c
el0t_64_sync+0x190/0x194
---[ end trace 0000000000000000 ]---...followed by more symptoms of corruption, with similar stacks:
refcount_t: underflow; use-after-free.
kernel BUG at lib/list_debug.c:62!
Kernel panic - not syncing: Oops - BUG: Fatal exception
This happens because pps_device_destruct() frees the pps_device with the embedded cdev immediately after calling cdev_del(), but, as the comment above cdev_del() notes, fops for previously opened cdevs are still callable even after cdev_del() returns. I think this bug has always been there: I can't explain why it suddenly started happening every time I reboot this particular board.
In commit d953e0e837e6 ("pps: Fix a use-after free bug when unregistering a source."), George Spelvin suggested removing the embedded cdev. That seems like the simplest way to fix this, so I've implemented his suggestion, using __register_chrdev() with pps_idr becoming the source of truth for which minor corresponds to which device.
But now that pps_idr defines userspace visibility instead of cdev_add(), we need to be sure the pps->dev refcount can't reach zero while userspace can still find it again. So, the idr_remove() call moves to pps_unregister_cdev(), and pps_idr now holds a reference to pps->dev.
pps_core: source serial1 got cdev (251:1)
<...>
pps pps1: removed
pps_core: unregistering pps1
pps_core: deallocating pps1
--- drivers/pps/clients/pps-gpio.c | 4 - drivers/pps/clients/pps-ktimer.c | 4 - drivers/pps/clients/pps-ldisc.c | 6 - drivers/pps/clients/pps_parport.c | 4 - drivers/pps/kapi.c | 10 +- drivers/pps/kc.c | 10 +- drivers/pps/pps.c | 127 +++++++++++++++++++------------------- include/linux/pps_kernel.h | 3 8 files changed, 86 insertions(+), 82 deletions(-)
drivers/pps/clients/pps-gpio.c +2 -2
@@ -232,8 +232,8 @@ static int pps_gpio_probe(struct platforreturn -EINVAL ; } -dev_info (data->pps->dev,"Registered IRQ %d as PPS source\n" , - data->irq); +dev_dbg (&data->pps->dev,"Registered IRQ %d as PPS source\n" , + data->irq);return 0 ; }
drivers/pps/clients/pps-ktimer.c +2 -2
@@ -56,7 +56,7 @@ static struct pps_source_info pps_ktimer static void __exit pps_ktimer_exit(void) { -dev_info (pps->dev,"ktimer PPS source unregistered\n" ); +dev_dbg (&pps->dev,"ktimer PPS source unregistered\n" );del_timer_sync (&ktimer);pps_unregister_source (pps);
@@ -74,7 +74,7 @@ static int __init pps_ktimer_init(void)timer_setup (&ktimer, pps_ktimer_event,0 );mod_timer (&ktimer, jiffies +HZ ); -dev_info (pps->dev,"ktimer PPS source registered\n" ); +dev_dbg (&pps->dev,"ktimer PPS source registered\n" );return 0 ; }
drivers/pps/clients/pps-ldisc.c +3 -3
@@ -34,7 +34,7 @@ static void pps_tty_dcd_change(struct ttpps_event (pps, &ts, status ?PPS_CAPTUREASSERT :PPS_CAPTURECLEAR ,NULL ); -dev_dbg (pps->dev,"PPS %s at %lu\n" , +dev_dbg (&pps->dev,"PPS %s at %lu\n" , status ?"assert" :"clear" , jiffies); }
@@ -71,7 +71,7 @@ static int pps_tty_open(struct tty_struc goto err_unregister; } -dev_info (pps->dev,"source \"%s\" added\n" , info.path); +dev_dbg (&pps->dev,"source \"%s\" added\n" , info.path);return 0 ;
@@ -91,7 +91,7 @@ static void pps_tty_close(struct tty_strif (WARN_ON (!pps))return ; -dev_info (pps->dev,"removed\n" ); +dev_info (&pps->dev,"removed\n" );pps_unregister_source (pps); }
drivers/pps/clients/pps_parport.c +2 -2
@@ -83,7 +83,7 @@ static void parport_irq(void *handle)/* check the signal (no signal means the pulse is lost this time) */ if (!signal_is_set (port)) {local_irq_restore (flags); -dev_err (dev->pps->dev,"lost the signal\n" ); +dev_err (&dev->pps->dev,"lost the signal\n" ); goto out_assert; }
@@ -100,7 +100,7 @@ static void parport_irq(void *handle)/* timeout */ dev->cw_err++;if (dev->cw_err >=CLEAR_WAIT_MAX_ERRORS ) { -dev_err (dev->pps->dev,"disabled clear edge capture after %d" +dev_err (&dev->pps->dev,"disabled clear edge capture after %d" " timeouts\n" , dev->cw_err); dev->cw =0 ; dev->cw_err =0 ;
drivers/pps/kapi.c +5 -5
@@ -41,7 +41,7 @@ static void pps_add_offset(struct pps_ktstatic void pps_echo_client_default (struct pps_device *pps,int event,void *data) { -dev_info (pps->dev,"echo %s %s\n" , +dev_info (&pps->dev,"echo %s %s\n" , event &PPS_CAPTUREASSERT ?"assert" :"" , event &PPS_CAPTURECLEAR ?"clear" :"" ); }
@@ -112,7 +112,7 @@ struct pps_device *pps_register_source(s goto kfree_pps; } -dev_info (pps->dev,"new PPS source %s\n" , info->name); +dev_dbg (&pps->dev,"new PPS source %s\n" , info->name);return pps;
@@ -166,7 +166,7 @@ void pps_event(struct pps_device *pps, s/* check event type */ BUG_ON ((event & (PPS_CAPTUREASSERT |PPS_CAPTURECLEAR )) ==0 ); -dev_dbg (pps->dev,"PPS event at %lld.%09ld\n" , +dev_dbg (&pps->dev,"PPS event at %lld.%09ld\n" , (s64 )ts->ts_real.tv_sec, ts->ts_real.tv_nsec);timespec_to_pps_ktime (&ts_real, ts->ts_real);
@@ -188,7 +188,7 @@ void pps_event(struct pps_device *pps, s/* Save the time stamp */ pps->assert_tu = ts_real; pps->assert_sequence++; -dev_dbg (pps->dev,"capture assert seq #%u\n" , +dev_dbg (&pps->dev,"capture assert seq #%u\n" , pps->assert_sequence); captured = ~0 ;
@@ -202,7 +202,7 @@ void pps_event(struct pps_device *pps, s/* Save the time stamp */ pps->clear_tu = ts_real; pps->clear_sequence++; -dev_dbg (pps->dev,"capture clear seq #%u\n" , +dev_dbg (&pps->dev,"capture clear seq #%u\n" , pps->clear_sequence); captured = ~0 ;
drivers/pps/kc.c +5 -5
@@ -43,11 +43,11 @@ int pps_kc_bind(struct pps_device *pps, pps_kc_hardpps_mode =0 ; pps_kc_hardpps_dev =NULL ;spin_unlock_irq (&pps_kc_hardpps_lock); -dev_info (pps->dev,"unbound kernel" +dev_info (&pps->dev,"unbound kernel" " consumer\n" ); }else {spin_unlock_irq (&pps_kc_hardpps_lock); -dev_err (pps->dev,"selected kernel consumer" +dev_err (&pps->dev,"selected kernel consumer" " is not bound\n" );return -EINVAL ; }
@@ -57,11 +57,11 @@ int pps_kc_bind(struct pps_device *pps, pps_kc_hardpps_mode = bind_args->edge; pps_kc_hardpps_dev = pps;spin_unlock_irq (&pps_kc_hardpps_lock); -dev_info (pps->dev,"bound kernel consumer: " +dev_info (&pps->dev,"bound kernel consumer: " "edge=0x%x\n" , bind_args->edge); }else {spin_unlock_irq (&pps_kc_hardpps_lock); -dev_err (pps->dev,"another kernel consumer" +dev_err (&pps->dev,"another kernel consumer" " is already bound\n" );return -EINVAL ; }
@@ -83,7 +83,7 @@ void pps_kc_remove(struct pps_device *pp pps_kc_hardpps_mode =0 ; pps_kc_hardpps_dev =NULL ;spin_unlock_irq (&pps_kc_hardpps_lock); -dev_info (pps->dev,"unbound kernel consumer" +dev_info (&pps->dev,"unbound kernel consumer" " on device removal\n" ); }else spin_unlock_irq (&pps_kc_hardpps_lock);
drivers/pps/pps.c +66 -61
288 lines not on this page · raw message
include/linux/pps_kernel.h +1 -2
@@ -56,8 +56,7 @@ struct pps_device {unsigned int id;/* PPS source unique ID */ void const *lookup_cookie;/* For pps_lookup_dev() only */ -struct cdev cdev; -struct device *dev; +struct device dev;struct fasync_struct *async_queue;/* fasync method */ spinlock_t lock; };