6.6.140-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 1/474 ALSA: usb-audio: stop parsing UAC2 rates at MAX_NR_RATES
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit 3c318f97dcc50b2e0556a1813bd6958678e881fd upstream.
parse_uac2_sample_rate_range() caps the number of enumerated rates at MAX_NR_RATES, but it only breaks out of the current rate loop. A malformed UAC2 RANGE response with additional triplets continues parsing the remaining triplets and repeatedly prints "invalid uac2 rates" while probe still holds register_mutex.
Stop the whole parse once the cap is reached and return the number of rates collected so far.
--- sound/usb/format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/format.c +1 -1
@@ -461,7 +461,7 @@ static int parse_uac2_sample_rate_range( nr_rates++;if (nr_rates >=MAX_NR_RATES ) {usb_audio_err (chip,"invalid uac2 rates\n" ); -break ; +return nr_rates; } skip_rate:
Greg Kroah-Hartman
maintainerPATCH 10/474 misc: ibmasm: fix OOB MMIO read in ibmasm_handle_mouse_interrupt()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyllis Xu <[email protected]>
commit 4b6e6ead556734bdc14024c5f837132b1e7a4b84 upstream.
ibmasm_handle_mouse_interrupt() performs an out-of-bounds MMIO read when the queue reader or writer index from hardware exceeds REMOTE_QUEUE_SIZE (60).
A compromised service processor can trigger this by writing an out-of-range value to the reader or writer MMIO register before asserting an interrupt. Since writer is re-read from hardware on every loop iteration, it can also be set to an out-of-range value after the loop has already started.
The root cause is that get_queue_reader() and get_queue_writer() return raw readl() values that are passed directly into get_queue_entry(), which computes:
queue_begin + reader * sizeof(struct remote_input)
with no bounds check. This unchecked MMIO address is then passed to memcpy_fromio(), reading 8 bytes from unintended device registers. For sufficiently large values the address falls outside the PCI BAR mapping entirely, triggering a machine check exception.
Fix by checking both indices against REMOTE_QUEUE_SIZE at the top of the loop body, before any call to get_queue_entry(). On an out-of-range value, reset the reader register to 0 via set_queue_reader() before breaking, so that normal queue operation can resume if the corrupted hardware state is transient.
--- drivers/misc/ibmasm/remote.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/misc/ibmasm/remote.c +5 -0
@@ -177,6 +177,11 @@ void ibmasm_handle_mouse_interrupt(struc writer =get_queue_writer (sp);while (reader != writer) { +if (reader >=REMOTE_QUEUE_SIZE || writer >=REMOTE_QUEUE_SIZE ) { +set_queue_reader (sp,0 ); +break ; + } +memcpy_fromio (&input,get_queue_entry (sp, reader),sizeof (struct remote_input ));
Greg Kroah-Hartman
maintainerPATCH 11/474 ibmasm: fix OOB reads in command_file_write due to missing size checks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyllis Xu <[email protected]>
commit 0eb09f737428e482a32a2e31e5e223f2b35a71d3 upstream.
The command_file_write() handler allocates a kernel buffer of exactly count bytes and copies user data into it, but does not validate the buffer against the dot command protocol before passing it to get_dot_command_size() and get_dot_command_timeout().
Since both the allocation size (count) and the header fields (command_size, data_size) are independently user-controlled, an attacker can cause get_dot_command_size() to return a value exceeding the allocation, triggering OOB reads in get_dot_command_timeout() and an out-of-bounds memcpy_toio() that leaks kernel heap memory to the service processor.
Fix with two guards: reject writes smaller than sizeof(struct dot_command_header) before allocation, then after copying user data reject commands where the buffer is smaller than the total size declared by the header (sizeof(header) + command_size + data_size). This ensures all subsequent header and payload field accesses stay within the buffer.
--- drivers/misc/ibmasm/ibmasmfs.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/misc/ibmasm/ibmasmfs.c +7 -0
@@ -303,6 +303,8 @@ static ssize_t command_file_write(structreturn -EINVAL ;if (count ==0 || count >IBMASM_CMD_MAX_BUFFER_SIZE )return 0 ; +if (count <sizeof (struct dot_command_header )) +return -EINVAL ;if (*offset !=0 )return 0 ;
@@ -319,6 +321,11 @@ static ssize_t command_file_write(structreturn -EFAULT ; } +if (count <get_dot_command_size (cmd->buffer)) { +command_put (cmd); +return -EINVAL ; + } +spin_lock_irqsave (&command_data->sp->lock, flags);if (command_data->command) {spin_unlock_irqrestore (&command_data->sp->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 12/474 ibmasm: fix heap over-read in ibmasm_send_i2o_message()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyllis Xu <[email protected]>
commit 9aad71144fa3682cca3837a06c8623016790e7ec upstream.
The ibmasm_send_i2o_message() function uses get_dot_command_size() to compute the byte count for memcpy_toio(), but this value is derived from user-controlled fields in the dot_command_header (command_size: u8,data_size: u16) and is never validated against the actual allocation size. A root user can write a small buffer with inflated header fields, causing memcpy_toio() to read up to ~65 KB past the end of the allocation into adjacent kernel heap, which is then forwarded to the service processor over MMIO.
Silently clamping the copy size is not sufficient: if the header fields claim a larger size than the buffer, the SP receives a dot command whose own header is inconsistent with the I2O message length, which can cause the SP to desynchronize. Reject such commands outright by returning failure.
Validate command_size before calling get_mfa_inbound() to avoid leaking an I2O message frame: reading INBOUND_QUEUE_PORT dequeues a hardware frame from the controller's free pool, and returning without a corresponding set_mfa_inbound() call would permanently exhaust it.
Additionally, clamp command_size to I2O_COMMAND_SIZE before the memcpy_toio() so the MMIO write stays within the I2O message frame, consistent with the clamping already performed by outgoing_message_size() for the header field.
--- drivers/misc/ibmasm/lowlevel.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/misc/ibmasm/lowlevel.c +8 -4
@@ -19,17 +19,21 @@ static struct i2o_header header = I2O_HEint ibmasm_send_i2o_message (struct service_processor *sp) {u32 mfa; -unsigned int command_size; +size_t command_size;struct i2o_message *message;struct command *command = sp->current_command; + command_size =get_dot_command_size (command->buffer); +if (command_size > command->buffer_size) +return 1 ; +if (command_size >I2O_COMMAND_SIZE ) + command_size =I2O_COMMAND_SIZE ; + mfa =get_mfa_inbound (sp->base_address);if (!mfa)return 1 ; - command_size =get_dot_command_size (command->buffer); - header.message_size =outgoing_message_size (command_size); - + header.message_size =outgoing_message_size ((unsigned int )command_size); message =get_i2o_message (sp->base_address, mfa);memcpy_toio (&message->header, &header,sizeof (struct i2o_header ));
Greg Kroah-Hartman
maintainerPATCH 13/474 firmware: google: framebuffer: Do not mark framebuffer as busy
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit f3850d399de3b6142b02315227ef9e772ed0c302 upstream.
Remove the flag IORESOURCE_BUSY flag from coreboot's framebuffer resource. It prevents simpledrm from successfully requesting the range for its own use; resulting in errors such as
[ 2.775430] simple-framebuffer simple-framebuffer.0: [drm] could not acquire memory region [mem 0x80000000-0x80407fff flags 0x80000200]
As with other uses of simple-framebuffer, the simple-framebuffer device should only declare it's I/O resources, but not actively use them.
--- drivers/firmware/google/framebuffer-coreboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/google/framebuffer-coreboot.c +1 -1
@@ -50,7 +50,7 @@ static int framebuffer_probe(struct corereturn -ENODEV ;memset (&res,0 ,sizeof (res)); - res.flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res.flags =IORESOURCE_MEM ; res.name ="Coreboot Framebuffer" ; res.start = fb->physical_address; length =PAGE_ALIGN (fb->y_resolution * fb->bytes_per_line);
Greg Kroah-Hartman
maintainerPATCH 14/474 Bluetooth: MGMT: Fix possible UAFs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 302a1f674c00dd5581ab8e493ef44767c5101aab ]
This attemps to fix possible UAFs caused by struct mgmt_pending being freed while still being processed like in the following trace, in order to fix mgmt_pending_valid is introduce and use to check if the mgmt_pending hasn't been removed from the pending list, on the complete callbacks it is used to check and in addtion remove the cmd from the list while holding mgmt_pending_lock to avoid TOCTOU problems since if the cmd is left on the list it can still be accessed and freed.
BUG: KASAN: slab-use-after-free in mgmt_add_adv_patterns_monitor_sync+0x35/0x50 net/bluetooth/mgmt.c:5223 Read of size 8 at addr ffff8880709d4dc0 by task kworker/u11:0/55 CPU: 0 UID: 0 PID: 55 Comm: kworker/u11:0 Not tainted 6.16.4 #2 PREEMPT(full) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 Workqueue: hci0 hci_cmd_sync_work Call Trace: <TASK> dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 mgmt_add_adv_patterns_monitor_sync+0x35/0x50 net/bluetooth/mgmt.c:5223 hci_cmd_sync_work+0x210/0x3a0 net/bluetooth/hci_sync.c:332 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3321 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402 kthread+0x711/0x8a0 kernel/kthread.c:464 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 home/kwqcheii/source/fuzzing/kernel/kasan/linux-6.16.4/arch/x86/entry/entry_64.S:245 </TASK> Allocated by task 12210: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __kmalloc_cache_noprof+0x230/0x3d0 mm/slub.c:4364 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] mgmt_pending_new+0x65/0x1e0 net/bluetooth/mgmt_util.c:269 mgmt_pending_add+0x35/0x140 net/bluetooth/mgmt_util.c:296 __add_adv_patterns_monitor+0x130/0x200 net/bluetooth/mgmt.c:5247 add_adv_patterns_monitor+0x214/0x360 net/bluetooth/mgmt.c:5364 hci_mgmt_cmd+0x9c9/0xef0 net/bluetooth/hci_sock.c:1719 hci_sock_sendmsg+0x6ca/0xef0 net/bluetooth/hci_sock.c:1839 sock_sendmsg_nosec net/socket.c:714 [inline] __sock_sendmsg+0x219/0x270 net/socket.c:729 sock_write_iter+0x258/0x330 net/socket.c:1133 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x5c9/0xb30 fs/read_write.c:686 ksys_write+0x145/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 12221: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x62/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2381 [inline] slab_free mm/slub.c:4648 [inline] kfree+0x18e/0x440 mm/slub.c:4847 mgmt_pending_free net/bluetooth/mgmt_util.c:311 [inline] mgmt_pending_foreach+0x30d/0x380 net/bluetooth/mgmt_util.c:257 __mgmt_power_off+0x169/0x350 net/bluetooth/mgmt.c:9444 hci_dev_close_sync+0x754/0x1330 net/bluetooth/hci_sync.c:5290 hci_dev_do_close net/bluetooth/hci_core.c:501 [inline] hci_dev_close+0x108/0x200 net/bluetooth/hci_core.c:526 sock_do_ioctl+0xd9/0x300 net/socket.c:1192 sock_ioctl+0x576/0x790 net/socket.c:1313 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- net/bluetooth/mgmt.c | 259 ++++++++++++++++++++++++++------------ net/bluetooth/mgmt_util.c | 46 +++++++ net/bluetooth/mgmt_util.h | 3 + 3 files changed, 231 insertions(+), 77 deletions(-)
net/bluetooth/mgmt.c +182 -77
@@ -1319,8 +1319,7 @@ static void mgmt_set_powered_complete(struct hci_dev *hdev, void *data, int err)struct mgmt_mode *cp;/* Make sure cmd still outstanding. */ -if (err == -ECANCELED || - cmd !=pending_find (MGMT_OP_SET_POWERED , hdev)) +if (err == -ECANCELED || !mgmt_pending_valid (hdev, cmd))return ; cp = cmd->param;
@@ -1347,23 +1346,29 @@ static void mgmt_set_powered_complete(struct hci_dev *hdev, void *data, int err) mgmt_status(err)); } -mgmt_pending_remove (cmd); +mgmt_pending_free (cmd); }static int set_powered_sync (struct hci_dev *hdev,void *data) {struct mgmt_pending_cmd *cmd = data; -struct mgmt_mode *cp; +struct mgmt_mode cp; + +mutex_lock (&hdev->mgmt_pending_lock);/* Make sure cmd still outstanding. */ -if (cmd !=pending_find (MGMT_OP_SET_POWERED , hdev)) +if (!__mgmt_pending_listed (hdev, cmd)) { +mutex_unlock (&hdev->mgmt_pending_lock);return -ECANCELED ; + } - cp = cmd->param; +memcpy (&cp, cmd->param,sizeof (cp)); + +mutex_unlock (&hdev->mgmt_pending_lock);BT_DBG ("%s" , hdev->name); -return hci_set_powered_sync (hdev, cp->val); +return hci_set_powered_sync (hdev, cp.val); } static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data,
@@ -1504,8 +1509,7 @@ static void mgmt_set_discoverable_complete(struct hci_dev *hdev, void *data,bt_dev_dbg (hdev,"err %d" , err);/* Make sure cmd still outstanding. */ -if (err == -ECANCELED || - cmd !=pending_find (MGMT_OP_SET_DISCOVERABLE , hdev)) +if (err == -ECANCELED || !mgmt_pending_valid (hdev, cmd))return ;hci_dev_lock (hdev);
@@ -1527,12 +1531,15 @@ static void mgmt_set_discoverable_complete(struct hci_dev *hdev, void *data,new_settings (hdev, cmd->sk); done: -mgmt_pending_remove (cmd); +mgmt_pending_free (cmd);hci_dev_unlock (hdev); }static int set_discoverable_sync (struct hci_dev *hdev,void *data) { +if (!mgmt_pending_listed (hdev, data)) +return -ECANCELED ; +BT_DBG ("%s" , hdev->name);return hci_update_discoverable_sync (hdev);
@@ -1679,8 +1686,7 @@ static void mgmt_set_connectable_complete(struct hci_dev *hdev, void *data,bt_dev_dbg (hdev,"err %d" , err);/* Make sure cmd still outstanding. */ -if (err == -ECANCELED || - cmd !=pending_find (MGMT_OP_SET_CONNECTABLE , hdev)) +if (err == -ECANCELED || !mgmt_pending_valid (hdev, cmd))return ;hci_dev_lock (hdev);
@@ -1696,7 +1702,7 @@ static void mgmt_set_connectable_complete(struct hci_dev *hdev, void *data, done:if (cmd) -mgmt_pending_remove (cmd); +mgmt_pending_free (cmd);hci_dev_unlock (hdev); }
@@ -1732,6 +1738,9 @@ static int set_connectable_update_settings(struct hci_dev *hdev,static int set_connectable_sync (struct hci_dev *hdev,void *data) { +if (!mgmt_pending_listed (hdev, data)) +return -ECANCELED ; +BT_DBG ("%s" , hdev->name);return hci_update_connectable_sync (hdev);
@@ -1908,14 +1917,17 @@ static void set_ssp_complete(struct hci_dev *hdev, void *data, int err) {struct cmd_lookup match = {NULL , hdev };struct mgmt_pending_cmd *cmd = data; -struct mgmt_mode *cp = cmd->param; -u8 enable = cp->val; +struct mgmt_mode *cp; +u8 enable;bool changed;/* Make sure cmd still outstanding. */ -if (err == -ECANCELED || cmd !=pending_find (MGMT_OP_SET_SSP , hdev)) +if (err == -ECANCELED || !mgmt_pending_valid (hdev, cmd))return ; + cp = cmd->param; + enable = cp->val; +if (err) {u8 mgmt_err =mgmt_status (err);
@@ -1924,8 +1936,7 @@ static void set_ssp_complete(struct hci_dev *hdev, void *data, int err)new_settings (hdev,NULL ); } -mgmt_pending_foreach (MGMT_OP_SET_SSP , hdev, true, - cmd_status_rsp, &mgmt_err); +mgmt_cmd_status (cmd->sk, cmd->hdev->id, cmd->opcode, mgmt_err);return ; }
@@ -1935,7 +1946,7 @@ static void set_ssp_complete(struct hci_dev *hdev, void *data, int err) changed =hci_dev_test_and_clear_flag (hdev,HCI_SSP_ENABLED ); } -mgmt_pending_foreach (MGMT_OP_SET_SSP , hdev, true, settings_rsp, &match); +settings_rsp (cmd, &match);if (changed)new_settings (hdev, match.sk);
@@ -1949,14 +1960,25 @@ static void set_ssp_complete(struct hci_dev *hdev, void *data, int err)static int set_ssp_sync (struct hci_dev *hdev,void *data) {struct mgmt_pending_cmd *cmd = data; -struct mgmt_mode *cp = cmd->param; +struct mgmt_mode cp;bool changed = false;int err; -if (cp->val) +mutex_lock (&hdev->mgmt_pending_lock); + +if (!__mgmt_pending_listed (hdev, cmd)) { +mutex_unlock (&hdev->mgmt_pending_lock); +return -ECANCELED ; + } + +memcpy (&cp, cmd->param,sizeof (cp)); + +mutex_unlock (&hdev->mgmt_pending_lock); + +if (cp.val) changed = !hci_dev_test_and_set_flag (hdev,HCI_SSP_ENABLED ); - err =hci_write_ssp_mode_sync (hdev, cp->val); + err =hci_write_ssp_mode_sync (hdev, cp.val);if (!err && changed)hci_dev_clear_flag (hdev,HCI_SSP_ENABLED );
@@ -2049,32 +2071,50 @@ static int set_hs(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)static void set_le_complete (struct hci_dev *hdev,void *data,int err) { +struct mgmt_pending_cmd *cmd = data;struct cmd_lookup match = {NULL , hdev };u8 status =mgmt_status (err);bt_dev_dbg (hdev,"err %d" , err); -if (status) { -mgmt_pending_foreach (MGMT_OP_SET_LE , hdev, true, cmd_status_rsp, - &status); +if (err == -ECANCELED || !mgmt_pending_valid (hdev, data))return ; + +if (status) { +mgmt_cmd_status (cmd->sk, cmd->hdev->id, cmd->opcode, status); + goto done; } -mgmt_pending_foreach (MGMT_OP_SET_LE , hdev, true, settings_rsp, &match); +settings_rsp (cmd, &match);new_settings (hdev, match.sk);if (match.sk)sock_put (match.sk); + +done: +mgmt_pending_free (cmd); }static int set_le_sync (struct hci_dev *hdev,void *data) {struct mgmt_pending_cmd *cmd = data; -struct mgmt_mode *cp = cmd->param; -u8 val = !!cp->val; +struct mgmt_mode cp; +u8 val;int err; +mutex_lock (&hdev->mgmt_pending_lock); + +if (!__mgmt_pending_listed (hdev, cmd)) { +mutex_unlock (&hdev->mgmt_pending_lock); +return -ECANCELED ; + } + +memcpy (&cp, cmd->param,sizeof (cp)); + val = !!cp.val; + +mutex_unlock (&hdev->mgmt_pending_lock); +if (!val) {hci_clear_adv_instance_sync (hdev,NULL ,0x00 , true);
@@ -2116,7 +2156,12 @@ static void set_mesh_complete(struct hci_dev *hdev, void *data, int err) {struct mgmt_pending_cmd *cmd = data;u8 status =mgmt_status (err); -struct sock *sk = cmd->sk; +struct sock *sk; + +if (err == -ECANCELED || !mgmt_pending_valid (hdev, cmd)) +return ; + + sk = cmd->sk;if (status) { mgmt_pending_foreach(MGMT_OP_SET_MESH_RECEIVER, hdev, true,
@@ -2131,24 +2176,37 @@ static void set_mesh_complete(struct hci_dev *hdev, void *data, int err)static int set_mesh_sync (struct hci_dev *hdev,void *data) {struct mgmt_pending_cmd *cmd = data; -struct mgmt_cp_set_mesh *cp = cmd->param; -size_t len = cmd->param_len; +struct mgmt_cp_set_mesh cp; +size_t len; + +mutex_lock (&hdev->mgmt_pending_lock); + +if (!__mgmt_pending_listed (hdev, cmd)) { +mutex_unlock (&hdev->mgmt_pending_lock); +return -ECANCELED ; + } + +memcpy (&cp, cmd->param,sizeof (cp)); + +mutex_unlock (&hdev->mgmt_pending_lock); + + len = cmd->param_len;memset (hdev->mesh_ad_types,0 ,sizeof (hdev->mesh_ad_types)); -if (cp->enable) +if (cp.enable)hci_dev_set_flag (hdev,HCI_MESH );else hci_dev_clear_flag (hdev,HCI_MESH ); - hdev->le_scan_interval =__le16_to_cpu (cp->period); - hdev->le_scan_window =__le16_to_cpu (cp->window); + hdev->le_scan_interval =__le16_to_cpu (cp.period); + hdev->le_scan_window =__le16_to_cpu (cp.window); - len -=sizeof (*cp); + len -=sizeof (cp);/* If filters don't fit, forward all adv pkts */ if (len <=sizeof (hdev->mesh_ad_types)) -memcpy (hdev->mesh_ad_types, cp->ad_types, len); +memcpy (hdev->mesh_ad_types, cp.ad_types, len);hci_update_passive_scan_sync (hdev);return 0 ;
@@ -3802,15 +3860,16 @@ static int name_changed_sync(struct hci_dev *hdev, void *data)static void set_name_complete (struct hci_dev *hdev,void *data,int err) {struct mgmt_pending_cmd *cmd = data; -struct mgmt_cp_set_local_name *cp = cmd->param; +struct mgmt_cp_set_local_name *cp;u8 status =mgmt_status (err);bt_dev_dbg (hdev,"err %d" , err); -if (err == -ECANCELED || - cmd !=pending_find (MGMT_OP_SET_LOCAL_NAME , hdev)) +if (err == -ECANCELED || !mgmt_pending_valid (hdev, cmd))return ; + cp = cmd->param; +if (status) {mgmt_cmd_status (cmd->sk, hdev->id,MGMT_OP_SET_LOCAL_NAME , status);
@@ -3822,16 +3881,27 @@ static void set_name_complete(struct hci_dev *hdev, void *data, int err)hci_cmd_sync_queue (hdev, name_changed_sync,NULL ,NULL ); } -mgmt_pending_remove (cmd); +mgmt_pending_free (cmd); }static int set_name_sync (struct hci_dev *hdev,void *data) {struct mgmt_pending_cmd *cmd = data; -struct mgmt_cp_set_local_name *cp = cmd->param; +struct mgmt_cp_set_local_name cp; + +mutex_lock (&hdev->mgmt_pending_lock); + +if (!__mgmt_pending_listed (hdev, cmd)) { +mutex_unlock (&hdev->mgmt_pending_lock); +return -ECANCELED ; + } + +memcpy (&cp, cmd->param,sizeof (cp)); + +mutex_unlock (&hdev->mgmt_pending_lock);if (lmp_bredr_capable (hdev)) { -hci_update_name_sync (hdev, cp->name); +hci_update_name_sync (hdev, cp.name);hci_update_eir_sync (hdev); }
@@ -3983,12 +4053,10 @@ int mgmt_phy_configuration_changed(struct hci_dev *hdev, struct sock *skip)static void set_default_phy_complete (struct hci_dev *hdev,void *data,int err) {struct mgmt_pending_cmd *cmd = data; -struct sk_buff *skb = cmd->skb; +struct sk_buff *skb;u8 status =mgmt_status (err); -if (err == -ECANCELED || - cmd !=pending_find (MGMT_OP_SET_PHY_CONFIGURATION , hdev)) -return ; + skb = cmd->skb;if (!status) {if (!skb)
@@ -4015,7 +4083,7 @@ static void set_default_phy_complete(struct hci_dev *hdev, void *data, int err)if (skb && !IS_ERR (skb))kfree_skb (skb); -mgmt_pending_remove (cmd); +mgmt_pending_free (cmd); }static int set_default_phy_sync (struct hci_dev *hdev,void *data)
@@ -4023,7 +4091,9 @@ static int set_default_phy_sync(struct hci_dev *hdev, void *data)struct mgmt_pending_cmd *cmd = data;struct mgmt_cp_set_phy_configuration *cp = cmd->param;struct hci_cp_le_set_default_phy cp_phy; -u32 selected_phys =__le32_to_cpu (cp->selected_phys); +u32 selected_phys; + + selected_phys =__le32_to_cpu (cp->selected_phys);memset (&cp_phy,0 ,sizeof (cp_phy));
@@ -4163,7 +4233,7 @@ static int set_phy_configuration(struct sock *sk, struct hci_dev *hdev, goto unlock; } - cmd =mgmt_pending_add (sk,MGMT_OP_SET_PHY_CONFIGURATION , hdev, data, + cmd =mgmt_pending_new (sk,MGMT_OP_SET_PHY_CONFIGURATION , hdev, data, len);if (!cmd) err = -ENOMEM ;
@@ -5253,7 +5323,17 @@ static void mgmt_add_adv_patterns_monitor_complete(struct hci_dev *hdev, {struct mgmt_rp_add_adv_patterns_monitor rp;struct mgmt_pending_cmd *cmd = data; -struct adv_monitor *monitor = cmd->user_data; +struct adv_monitor *monitor; + +/* This is likely the result of hdev being closed and mgmt_index_removed +* is attempting to clean up any pending command so +* hci_adv_monitors_clear is about to be called which will take care of +* freeing the adv_monitor instances. +*/ +if (status == -ECANCELED && !mgmt_pending_valid (hdev, cmd)) +return ; + + monitor = cmd->user_data;hci_dev_lock (hdev);
@@ -5279,9 +5359,20 @@ static void mgmt_add_adv_patterns_monitor_complete(struct hci_dev *hdev,static int mgmt_add_adv_patterns_monitor_sync (struct hci_dev *hdev,void *data) {struct mgmt_pending_cmd *cmd = data; -struct adv_monitor *monitor = cmd->user_data; +struct adv_monitor *mon; + +mutex_lock (&hdev->mgmt_pending_lock); + +if (!__mgmt_pending_listed (hdev, cmd)) { +mutex_unlock (&hdev->mgmt_pending_lock); +return -ECANCELED ; + } + + mon = cmd->user_data; + +mutex_unlock (&hdev->mgmt_pending_lock); -return hci_add_adv_monitor (hdev, monitor); +return hci_add_adv_monitor (hdev, mon); } static int __add_adv_patterns_monitor(struct sock *sk, struct hci_dev *hdev,
@@ -5548,7 +5639,8 @@ static int remove_adv_monitor(struct sock *sk, struct hci_dev *hdev, status); } -static void read_local_oob_data_complete (struct hci_dev *hdev,void *data,int err) +static void read_local_oob_data_complete (struct hci_dev *hdev,void *data, +int err) {struct mgmt_rp_read_local_oob_data mgmt_rp;size_t rp_size =sizeof (mgmt_rp);
@@ -5568,7 +5660,8 @@ static void read_local_oob_data_complete(struct hci_dev *hdev, void *data, int ebt_dev_dbg (hdev,"status %d" , status);if (status) { -mgmt_cmd_status (cmd->sk, hdev->id,MGMT_OP_READ_LOCAL_OOB_DATA , status); +mgmt_cmd_status (cmd->sk, hdev->id,MGMT_OP_READ_LOCAL_OOB_DATA , + status); goto remove; }
@@ -5873,17 +5966,12 @@ static void start_discovery_complete(struct hci_dev *hdev, void *data, int err)bt_dev_dbg (hdev,"err %d" , err); -if (err == -ECANCELED ) -return ; - -if (cmd !=pending_find (MGMT_OP_START_DISCOVERY , hdev) && - cmd !=pending_find (MGMT_OP_START_LIMITED_DISCOVERY , hdev) && - cmd !=pending_find (MGMT_OP_START_SERVICE_DISCOVERY , hdev)) +if (err == -ECANCELED || !mgmt_pending_valid (hdev, cmd))return ;mgmt_cmd_complete (cmd->sk, cmd->hdev->id, cmd->opcode,mgmt_status (err), cmd->param,1 ); -mgmt_pending_remove (cmd); +mgmt_pending_free (cmd);hci_discovery_set_state (hdev, err ?DISCOVERY_STOPPED :DISCOVERY_FINDING );
@@ -5891,6 +5979,9 @@ static void start_discovery_complete(struct hci_dev *hdev, void *data, int err)static int start_discovery_sync (struct hci_dev *hdev,void *data) { +if (!mgmt_pending_listed (hdev, data)) +return -ECANCELED ; +return hci_start_discovery_sync (hdev); }
@@ -6113,15 +6204,14 @@ static void stop_discovery_complete(struct hci_dev *hdev, void *data, int err) {struct mgmt_pending_cmd *cmd = data; -if (err == -ECANCELED || - cmd !=pending_find (MGMT_OP_STOP_DISCOVERY , hdev)) +if (err == -ECANCELED || !mgmt_pending_valid (hdev, cmd))return ;bt_dev_dbg (hdev,"err %d" , err);mgmt_cmd_complete (cmd->sk, cmd->hdev->id, cmd->opcode,mgmt_status (err), cmd->param,1 ); -mgmt_pending_remove (cmd); +mgmt_pending_free (cmd);if (!err)hci_discovery_set_state (hdev,DISCOVERY_STOPPED );
@@ -6129,6 +6219,9 @@ static void stop_discovery_complete(struct hci_dev *hdev, void *data, int err)static int stop_discovery_sync (struct hci_dev *hdev,void *data) { +if (!mgmt_pending_listed (hdev, data)) +return -ECANCELED ; +return hci_stop_discovery_sync (hdev); }
@@ -6338,14 +6431,18 @@ static void enable_advertising_instance(struct hci_dev *hdev, int err)static void set_advertising_complete (struct hci_dev *hdev,void *data,int err) { +struct mgmt_pending_cmd *cmd = data;struct cmd_lookup match = {NULL , hdev };u8 instance;struct adv_info *adv_instance;u8 status =mgmt_status (err); +if (err == -ECANCELED || !mgmt_pending_valid (hdev, data)) +return ; +if (status) { -mgmt_pending_foreach (MGMT_OP_SET_ADVERTISING , hdev, true, - cmd_status_rsp, &status); +mgmt_cmd_status (cmd->sk, cmd->hdev->id, cmd->opcode, status); +mgmt_pending_free (cmd);return ; }
@@ -6354,8 +6451,7 @@ static void set_advertising_complete(struct hci_dev *hdev, void *data, int err)else hci_dev_clear_flag (hdev,HCI_ADVERTISING ); -mgmt_pending_foreach (MGMT_OP_SET_ADVERTISING , hdev, true, settings_rsp, - &match); +settings_rsp (cmd, &match);new_settings (hdev, match.sk);
@@ -6387,10 +6483,23 @@ static void set_advertising_complete(struct hci_dev *hdev, void *data, int err)static int set_adv_sync (struct hci_dev *hdev,void *data) {struct mgmt_pending_cmd *cmd = data; -struct mgmt_mode *cp = cmd->param; -u8 val = !!cp->val; +struct mgmt_mode cp; +u8 val; -if (cp->val ==0x02 ) +mutex_lock (&hdev->mgmt_pending_lock); + +if (!__mgmt_pending_listed (hdev, cmd)) { +mutex_unlock (&hdev->mgmt_pending_lock); +return -ECANCELED ; + } + +memcpy (&cp, cmd->param,sizeof (cp)); + +mutex_unlock (&hdev->mgmt_pending_lock); + + val = !!cp.val; + +if (cp.val ==0x02 )hci_dev_set_flag (hdev,HCI_ADVERTISING_CONNECTABLE );else hci_dev_clear_flag (hdev,HCI_ADVERTISING_CONNECTABLE );
@@ -8100,10 +8209,6 @@ static void read_local_oob_ext_data_complete(struct hci_dev *hdev, void *data,u8 status =mgmt_status (err);u16 eir_len; -if (err == -ECANCELED || - cmd !=pending_find (MGMT_OP_READ_LOCAL_OOB_EXT_DATA , hdev)) -return ; -if (!status) {if (!skb) status =MGMT_STATUS_FAILED ;
@@ -8210,7 +8315,7 @@ static void read_local_oob_ext_data_complete(struct hci_dev *hdev, void *data,kfree_skb (skb);kfree (mgmt_rp); -mgmt_pending_remove (cmd); +mgmt_pending_free (cmd); } static int read_local_ssp_oob_req(struct hci_dev *hdev, struct sock *sk,
@@ -8219,7 +8324,7 @@ static int read_local_ssp_oob_req(struct hci_dev *hdev, struct sock *sk,struct mgmt_pending_cmd *cmd;int err; - cmd =mgmt_pending_add (sk,MGMT_OP_READ_LOCAL_OOB_EXT_DATA , hdev, + cmd =mgmt_pending_new (sk,MGMT_OP_READ_LOCAL_OOB_EXT_DATA , hdev, cp,sizeof (*cp));if (!cmd)return -ENOMEM ;
net/bluetooth/mgmt_util.c +46 -0
52 lines not on this page · raw message
net/bluetooth/mgmt_util.h +3 -0
@@ -65,6 +65,9 @@ struct mgmt_pending_cmd *mgmt_pending_new(struct sock *sk, u16 opcode, void *data, u16 len);void mgmt_pending_free (struct mgmt_pending_cmd *cmd);void mgmt_pending_remove (struct mgmt_pending_cmd *cmd); +bool __mgmt_pending_listed (struct hci_dev *hdev,struct mgmt_pending_cmd *cmd); +bool mgmt_pending_listed (struct hci_dev *hdev,struct mgmt_pending_cmd *cmd); +bool mgmt_pending_valid (struct hci_dev *hdev,struct mgmt_pending_cmd *cmd);void mgmt_mesh_foreach (struct hci_dev *hdev,void (*cb)(struct mgmt_mesh_tx *mesh_tx,void *data),void *data,struct sock *sk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 15/474 padata: Fix pd UAF once and for all
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 71203f68c7749609d7fc8ae6ad054bdedeb24f91 ]
There is a race condition/UAF in padata_reorder that goes back to the initial commit. A reference count is taken at the start of the process in padata_do_parallel, and released at the end in padata_serial_worker.
This reference count is (and only is) required for padata_replace to function correctly. If padata_replace is never called then there is no issue.
In the function padata_reorder which serves as the core of padata, as soon as padata is added to queue->serial.list, and the associated spin lock released, that padata may be processed and the reference count on pd would go away.
Fix this by getting the next padata before the squeue->serial lock is released.
In order to make this possible, simplify padata_reorder by only calling it once the next padata arrives.
[ Adjust context of padata_find_next(). Replace cpumask_next_wrap(cpu, pd->cpumask.pcpu) with cpumask_next_wrap(cpu, pd->cpumask.pcpu, -1, false) in padata_reorder() in v6.6 according to dc5bb9b769c9 ("cpumask: deprecate cpumask_next_wrap()") and f954a2d37637 ("padata: switch padata_find_next() to using cpumask_next_wrap()") . ]
--- include/linux/padata.h | 3 - kernel/padata.c | 136 +++++++++++------------------------------ 2 files changed, 37 insertions(+), 102 deletions(-)
include/linux/padata.h +0 -3
@@ -91,7 +91,6 @@ struct padata_cpumask {* @cpu: Next CPU to be processed. * @cpumask: The cpumasks in use for parallel and serial workers. * @reorder_work: work struct for reordering. -* @lock: Reorder lock. */ struct parallel_data {struct padata_shell *ps;
@@ -102,8 +101,6 @@ struct parallel_data {unsigned int processed;int cpu;struct padata_cpumask cpumask; -struct work_struct reorder_work; -spinlock_t ____cacheline_aligned lock; };/**
kernel/padata.c +37 -99
202 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 16/474 padata: Remove comment for reorder_work
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 82a0302e7167d0b7c6cde56613db3748f8dd806d ]
Remove comment for reorder_work which no longer exists.
--- include/linux/padata.h | 1 - 1 file changed, 1 deletion(-)
include/linux/padata.h +0 -1
@@ -90,7 +90,6 @@ struct padata_cpumask {* @processed: Number of already processed objects. * @cpu: Next CPU to be processed. * @cpumask: The cpumasks in use for parallel and serial workers. -* @reorder_work: work struct for reordering. */ struct parallel_data {struct padata_shell *ps;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 17/474 drm/amdgpu: Use vmemdup_array_user in amdgpu_bo_create_list_entry_array
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tvrtko Ursulin <[email protected]>
[ Upstream commit c4ac100e9ae252b09986766ad23b1f83ca3a369d ]
Replace kvmalloc_array() + copy_from_user() with vmemdup_array_user() on the fast path.
This shrinks the source code and improves separation between the kernel and userspace slabs.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 41 +++++++++------------ 1 file changed, 17 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +17 -24
@@ -195,43 +195,36 @@ void amdgpu_bo_list_put(struct amdgpu_bo_list *list)int amdgpu_bo_create_list_entry_array (struct drm_amdgpu_bo_list_in *in,struct drm_amdgpu_bo_list_entry **info_param) { -const void __user *uptr =u64_to_user_ptr (in->bo_info_ptr);const uint32_t info_size =sizeof (struct drm_amdgpu_bo_list_entry ); +const void __user *uptr =u64_to_user_ptr (in->bo_info_ptr); +const uint32_t bo_info_size = in->bo_info_size; +const uint32_t bo_number = in->bo_number;struct drm_amdgpu_bo_list_entry *info; -int r; - - info =kvmalloc_array (in->bo_number, info_size,GFP_KERNEL ); -if (!info) -return -ENOMEM ;/* copy the handle array from userspace to a kernel buffer */ - r = -EFAULT ; -if (likely (info_size == in->bo_info_size)) { -unsigned long bytes = in->bo_number * - in->bo_info_size; - -if (copy_from_user (info, uptr, bytes)) - goto error_free; - +if (likely (info_size == bo_info_size)) { + info =vmemdup_array_user (uptr, bo_number, info_size); +if (IS_ERR (info)) +return PTR_ERR (info); }else { -unsigned long bytes =min (in->bo_info_size, info_size); +const uint32_t bytes =min (bo_info_size, info_size);unsigned i; -memset (info,0 , in->bo_number * info_size); -for (i =0 ; i < in->bo_number; ++i) { -if (copy_from_user (&info[i], uptr, bytes)) - goto error_free; + info =kvmalloc_array (bo_number, info_size,GFP_KERNEL ); +if (!info) +return -ENOMEM ; - uptr += in->bo_info_size; +memset (info,0 , bo_number * info_size); +for (i =0 ; i < bo_number; ++i, uptr += bo_info_size) { +if (copy_from_user (&info[i], uptr, bytes)) { +kvfree (info); +return -EFAULT ; + } } } *info_param = info;return 0 ; - -error_free: -kvfree (info); -return r; } int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 18/474 drm/amdgpu: Limit BO list entry count to prevent resource exhaustion
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse.Zhang <[email protected]>
[ Upstream commit 6270b1a5dab94665d7adce3dc78bc9066ed28bdd ]
Userspace can pass an arbitrary number of BO list entries via the bo_number field. Although the previous multiplication overflow check prevents out-of-bounds allocation, a large number of entries could still cause excessive memory allocation (up to potentially gigabytes) and unnecessarily long list processing times.
Introduce a hard limit of 128k entries per BO list, which is more than sufficient for any realistic use case (e.g., a single list containing all buffers in a large scene). This prevents memory exhaustion attacks and ensures predictable performance.
Return -EINVAL if the requested entry count exceeds the limit
--- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +4 -0
@@ -36,6 +36,7 @@#define AMDGPU_BO_LIST_MAX_PRIORITY 32u#define AMDGPU_BO_LIST_NUM_BUCKETS (AMDGPU_BO_LIST_MAX_PRIORITY + 1) +#define AMDGPU_BO_LIST_MAX_ENTRIES (128 * 1024)static void amdgpu_bo_list_free_rcu (struct rcu_head *rcu) {
@@ -201,6 +202,9 @@ int amdgpu_bo_create_list_entry_array(struct drm_amdgpu_bo_list_in *in,const uint32_t bo_number = in->bo_number;struct drm_amdgpu_bo_list_entry *info; +if (bo_number >AMDGPU_BO_LIST_MAX_ENTRIES ) +return -EINVAL ; +/* copy the handle array from userspace to a kernel buffer */ if (likely (info_size == bo_info_size)) { info =vmemdup_array_user (uptr, bo_number, info_size);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 19/474 regset: use kvzalloc() for regset_get_alloc()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit 6b839b3b76cf17296ebd4a893841f32cae08229c upstream.
While browsing through ChromeOS crash reports, I found one with an allocation failure that looked like this:
chrome: page allocation failure: order:7,
mode:0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO),
nodemask=(null),cpuset=urgent,mems_allowed=0
CPU: 7 PID: 3295 Comm: chrome Not tainted
5.15.133-20574-g8044615ac35c #1 (HASH:1162 1)
Hardware name: Google Lazor (rev3 - 8) with KB Backlight (DT)
Call trace:
...
warn_alloc+0x104/0x174
__alloc_pages+0x5f0/0x6e4
kmalloc_order+0x44/0x98
kmalloc_order_trace+0x34/0x124
__kmalloc+0x228/0x36c
__regset_get+0x68/0xcc
regset_get_alloc+0x1c/0x28
elf_core_dump+0x3d8/0xd8c
do_coredump+0xeb8/0x1378
get_signal+0x14c/0x804
...An order 7 allocation is (1 << 7) contiguous pages, or 512K. It's not a surprise that this allocation failed on a system that's been running for a while.
More digging showed that it was fairly easy to see the order 7 allocation by just sending a SIGQUIT to chrome (or other processes) to generate a core dump. The actual amount being allocated was 279,584 bytes and it was for "core_note_type" NT_ARM_SVE.
There was quite a bit of discussion [1] on the mailing lists in response to my v1 patch attempting to switch to vmalloc. The overall conclusion was that we could likely reduce the 279,584 byte allocation by quite a bit and Mark Brown has sent a patch to that effect [2]. However even with the 279,584 byte allocation gone there are still 65,552 byte allocations. These are just barely more than the 65,536 bytes and thus would require an order 5 allocation.
An order 5 allocation is still something to avoid unless necessary and nothing needs the memory here to be contiguous. Change the allocation to kvzalloc() which should still be efficient for small allocations but doesn't force the memory subsystem to work hard (and maybe fail) at getting a large contiguous chunk.
[1] https://lore.kernel.org/r/20240201171159.1.Id9ad163b60d21c9e56c2d686b0cc9083a8ba7924@changeid
[2] https://lore.kernel.org/r/20240203-arm64-sve-ptrace-regset-size-v1-1-2c3ba1386b9e@kernel.org
--- fs/binfmt_elf.c | 2 +- kernel/regset.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/binfmt_elf.c +1 -1
@@ -2035,7 +2035,7 @@ static void free_note_info(struct elf_note_info *info) threads = t->next;WARN_ON (t->notes[0 ].data && t->notes[0 ].data != &t->prstatus);for (i =1 ; i < info->thread_notes; ++i) -kfree (t->notes[i].data); +kvfree (t->notes[i].data);kfree (t); }kfree (info->psinfo.data);
kernel/regset.c +3 -3
@@ -16,14 +16,14 @@ static int __regset_get(struct task_struct *target,if (size > regset->n * regset->size) size = regset->n * regset->size;if (!p) { - to_free = p =kzalloc (size,GFP_KERNEL ); + to_free = p =kvzalloc (size,GFP_KERNEL );if (!p)return -ENOMEM ; } res = regset->regset_get (target, regset, (struct membuf ){.p = p, .left = size});if (res <0 ) { -kfree (to_free); +kvfree (to_free);return res; } *data = p;
@@ -71,6 +71,6 @@ int copy_regset_to_user(struct task_struct *target, ret =regset_get_alloc (target, regset, size, &buf);if (ret >0 ) ret =copy_to_user (data, buf, ret) ? -EFAULT :0 ; -kfree (buf); +kvfree (buf);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2/474 ALSA: usb-audio: Avoid false E-MU sample-rate notifications
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit fca9c850042a7ab4828ce3a9caa8bc40ea09856a upstream.
snd_emuusb_set_samplerate() unconditionally notifies the E-MU SampleRate Extension Unit control after issuing SET_CUR.
If snd_usb_mixer_set_ctl_value() fails, the control value has not changed, yet snd_usb_mixer_notify_id() still invalidates the cache and emits a value-change event to userspace.
Notify the control only after a successful write.
--- sound/usb/mixer_quirks.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
sound/usb/mixer_quirks.c +6 -4
@@ -1561,15 +1561,17 @@ void snd_emuusb_set_samplerate(struct sn {struct usb_mixer_interface *mixer;struct usb_mixer_elem_info *cval; +int err;int unitid =12 ;/* SampleRate ExtensionUnit ID */ list_for_each_entry (mixer, &chip->mixer_list, list) {if (mixer->id_elems[unitid]) { cval =mixer_elem_list_to_info (mixer->id_elems[unitid]); -snd_usb_mixer_set_ctl_value (cval,UAC_SET_CUR , - cval->control <<8 , - samplerate_id); -snd_usb_mixer_notify_id (mixer, unitid); + err =snd_usb_mixer_set_ctl_value (cval,UAC_SET_CUR , + cval->control <<8 , + samplerate_id); +if (!err) +snd_usb_mixer_notify_id (mixer, unitid);break ; } }
Greg Kroah-Hartman
maintainerPATCH 3/474 ALSA: usb-audio: Fix Audio Advantage Micro II SPDIF switch
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit a9224f26b754b5034719248891ff3c2ea0d11144 upstream.
snd_microii_spdif_switch_put() returns 0 when the requested vendor register value differs from the cached one.
This comparison was inverted by the resume-support conversion, so real SPDIF switch toggles are ignored while no-op writes still issue SET_CUR and report success.
Return early only when the requested value matches the cached one.
--- sound/usb/mixer_quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer_quirks.c +1 -1
@@ -2066,7 +2066,7 @@ static int snd_microii_spdif_switch_put(int err; reg = ucontrol->value.integer.value[0 ] ?0x28 :0x2a ; -if (reg != list->kctl->private_value) +if (reg == list->kctl->private_value)return 0 ; kcontrol->private_value = reg;
Greg Kroah-Hartman
maintainerPATCH 4/474 usb: xhci: Make usb_host_endpoint.hcpriv survive endpoint_disable()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
commit 25e531b422dc2ac90cdae3b6e74b5cdeb081440d upstream.
xHCI hardware maintains its endpoint state between add_endpoint() and drop_endpoint() calls followed by successful check_bandwidth(). So does the driver.
Core may call endpoint_disable() during xHCI endpoint life, so don't clear host_ep->hcpriv then, because this breaks endpoint_reset().
If a driver calls usb_set_interface(), submits URBs which make host sequence state non-zero and calls usb_clear_halt(), the device clears its sequence state but xhci_endpoint_reset() bails out. The next URB
malfunctions: USB2 loses one packet, USB3 gets Transaction Error or may not complete at all on some (buggy?) HCs from ASMedia and AMD. This is triggered by uvcvideo on bulk video devices.
The code was copied from ehci_endpoint_disable() but it isn't needed here - hcpriv should only be NULL on emulated root hub endpoints. It might prevent resetting and inadvertently enabling a disabled and dropped endpoint, but core shouldn't try to reset dropped endpoints.
Document xhci requirements regarding hcpriv. They are currently met.
--- drivers/usb/host/xhci.c | 1 - include/linux/usb.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +0 -1
@@ -3102,7 +3102,6 @@ rescan:xhci_dbg (xhci,"endpoint disable with ep_state 0x%x\n" , ep->ep_state); done: - host_ep->hcpriv =NULL ;spin_unlock_irqrestore (&xhci->lock, flags); }
include/linux/usb.h +2 -1
@@ -53,7 +53,8 @@ struct ep_device;* @ssp_isoc_ep_comp: SuperSpeedPlus isoc companion descriptor for this endpoint * @urb_list: urbs queued to this endpoint; maintained by usbcore * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) -* with one or more transfer descriptors (TDs) per urb +* with one or more transfer descriptors (TDs) per urb; must be preserved +* by core while BW is allocated for the endpoint * @ep_dev: ep_device for sysfs info * @extra: descriptors following this endpoint in the configuration * @extralen: how many bytes of "extra" are valid
Greg Kroah-Hartman
maintainerPATCH 5/474 usb: chipidea: otg: not wait vbus drop if use role_switch
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit a4e99587102a83ee911c670752fbca694c7e557f upstream.
The usb role switch will update ID and VBUS states at the same time, and vbus will not drop when execute data role swap in Type-C usecase. So lets not wait vbus drop in usb role switch case too.
--- drivers/usb/chipidea/otg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/chipidea/otg.c +2 -2
@@ -187,8 +187,8 @@ void ci_handle_id_switch(struct ci_hdrcci_role_stop (ci); -if (role ==CI_ROLE_GADGET && -IS_ERR (ci->platdata->vbus_extcon.edev)) +if (role ==CI_ROLE_GADGET && !ci->role_switch && +IS_ERR (ci->platdata->vbus_extcon.edev))/* * Wait vbus lower than OTGSC_BSV before connecting * to host. If connecting status is from an external
Greg Kroah-Hartman
maintainerPATCH 6/474 usb: chipidea: core: allow ci_irq_handler() handle both ID and VBUS change
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit b94b631d9f78e653855f7fb58dbcb86c2a856f6f upstream.
For USB role switch-triggered IRQ, ID and VBUS change come together, for example when switching from host to device mode. ID indicate a role switch and VBUS is required to determine whether the device controller can start operating. Currently, ci_irq_handler() handles only a single event per invocation. This can cause an issue where switching to device mode results in the device controller not working at all. Allowing ci_irq_handler() to handle both ID and VBUS change in one call resolves this issue.
Meanwhile, this change also affects the VBUS event handling logic. Previously, if an ID event indicated host mode the VBUS IRQ will be ignored as the device disable BSE when stop() is called. With the new behavior, if ID and VBUS IRQ occur together and the target mode is host, the VBUS event is queued and ci_handle_vbus_change() will call usb_gadget_vbus_connect(), after which USBMODE is switched to device mode, causing host mode to stop working. To prevent this, an additional check is added to skip handling VBUS event when current role is not device mode.
--- drivers/usb/chipidea/core.c | 45 ++++++++++++++++++++++---------------------- drivers/usb/chipidea/otg.c | 3 ++ 2 files changed, 26 insertions(+), 22 deletions(-)
drivers/usb/chipidea/core.c +23 -22
@@ -543,30 +543,31 @@ static irqreturn_t ci_irq_handler(int irif (ret ==IRQ_HANDLED )return ret; } - } -/* -* Handle id change interrupt, it indicates device/host function -* switch. -*/ -if (ci->is_otg && (otgsc &OTGSC_IDIE ) && (otgsc &OTGSC_IDIS )) { - ci->id_event = true; -/* Clear ID change irq status */ -hw_write_otgsc (ci,OTGSC_IDIS ,OTGSC_IDIS ); -ci_otg_queue_work (ci); -return IRQ_HANDLED ; - } +/* +* Handle id change interrupt, it indicates device/host function +* switch. +*/ +if ((otgsc &OTGSC_IDIE ) && (otgsc &OTGSC_IDIS )) { + ci->id_event = true; +/* Clear ID change irq status */ +hw_write_otgsc (ci,OTGSC_IDIS ,OTGSC_IDIS ); + } -/* -* Handle vbus change interrupt, it indicates device connection -* and disconnection events. -*/ -if (ci->is_otg && (otgsc &OTGSC_BSVIE ) && (otgsc &OTGSC_BSVIS )) { - ci->b_sess_valid_event = true; -/* Clear BSV irq */ -hw_write_otgsc (ci,OTGSC_BSVIS ,OTGSC_BSVIS ); -ci_otg_queue_work (ci); -return IRQ_HANDLED ; +/* +* Handle vbus change interrupt, it indicates device connection +* and disconnection events. +*/ +if ((otgsc &OTGSC_BSVIE ) && (otgsc &OTGSC_BSVIS )) { + ci->b_sess_valid_event = true; +/* Clear BSV irq */ +hw_write_otgsc (ci,OTGSC_BSVIS ,OTGSC_BSVIS ); + } + +if (ci->id_event || ci->b_sess_valid_event) { +ci_otg_queue_work (ci); +return IRQ_HANDLED ; + } }/* Handle device/host interrupt */
drivers/usb/chipidea/otg.c +3 -0
@@ -130,6 +130,9 @@ enum ci_role ci_otg_role(struct ci_hdrcvoid ci_handle_vbus_change (struct ci_hdrc *ci) { +if (ci->role !=CI_ROLE_GADGET ) +return ; +if (!ci->is_otg) {if (ci->platdata->flags &CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS )usb_gadget_vbus_connect (&ci->gadget);
Greg Kroah-Hartman
maintainerPATCH 7/474 ALSA: usb-audio: Evaluate packsize caps at the right place
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 52521e8398839105ef8eb22b3f0993f9b0d11a57 upstream.
We introduced the upper bound checks of the packet sizes by the ep->maxframesize for avoiding the URB submission errors. However, the check was applied at an incorrect place in the function snd_usb_endpoint_set_params() where ep->maxframesize isn't defined yet; the value is defined at a bit later position. So this ended up with a failure at the first run while the second run works.
For fixing it, move the check at the correct place, right after the calculation of ep->maxframesize in the same function.
--- sound/usb/endpoint.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/usb/endpoint.c +3 -3
@@ -1397,9 +1397,6 @@ int snd_usb_endpoint_set_params(struct s goto unlock; } - ep->packsize[0 ] =min (ep->packsize[0 ], ep->maxframesize); - ep->packsize[1 ] =min (ep->packsize[1 ], ep->maxframesize); -/* calculate the frequency in 16.16 format */ ep->freqm = ep->freqn; ep->freqshift =INT_MIN ;
@@ -1426,6 +1423,9 @@ int snd_usb_endpoint_set_params(struct s ep->maxframesize = ep->maxpacksize / ep->cur_frame_bytes; ep->curframesize = ep->curpacksize / ep->cur_frame_bytes; + ep->packsize[0 ] =min (ep->packsize[0 ], ep->maxframesize); + ep->packsize[1 ] =min (ep->packsize[1 ], ep->maxframesize); + err =update_clock_ref_rate (chip, ep);if (err >=0 ) { ep->need_setup = false;
Greg Kroah-Hartman
maintainerPATCH 8/474 drm/nouveau: fix u32 overflow in pushbuf reloc bounds check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 2fc87d37be1b730a149b035f9375fdb8cc5333a5 upstream.
nouveau_gem_pushbuf_reloc_apply() validates each relocation with
if (r->reloc_bo_offset + 4 > nvbo->bo.base.size)
but reloc_bo_offset is __u32 (uapi/drm/nouveau_drm.h) and the integer literal 4 promotes to unsigned int, so the addition is performed in 32 bits and wraps before the comparison against the size_t bo size.
Cast to u64 so the addition happens in 64-bit arithmetic.
--- drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +1 -1
@@ -679,7 +679,7 @@ nouveau_gem_pushbuf_reloc_apply(struct n } nvbo = (void *)(unsigned long )bo[r->reloc_bo_index].user_priv; -if (unlikely (r->reloc_bo_offset +4 > +if (unlikely ((u64 )r->reloc_bo_offset +4 > nvbo->bo.base.size)) {NV_PRINTK (err, cli,"reloc outside of bo\n" ); ret = -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 9/474 leds: qcom-lpg: Check for array overflow when selecting the high resolution
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit d45963a93c1495e9f1338fde91d0ebba8fd22474 upstream.
When selecting the high resolution values from the array, FIELD_GET() is used to pull from a 3 bit register, yet the array being indexed has only 5 values in it. Odds are the hardware is sane, but just to be safe, properly check before just overflowing and reading random data and then setting up chip values based on that.
--- drivers/leds/rgb/leds-qcom-lpg.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/leds/rgb/leds-qcom-lpg.c +6 -1
@@ -1043,7 +1043,12 @@ static int lpg_pwm_get_state(struct pwm_return ret;if (chan->subtype ==LPG_SUBTYPE_HI_RES_PWM ) { - refclk = lpg_clk_rates_hi_res[FIELD_GET (PWM_CLK_SELECT_HI_RES_MASK , val)]; +unsigned int clk_idx =FIELD_GET (PWM_CLK_SELECT_HI_RES_MASK , val); + +if (clk_idx >=ARRAY_SIZE (lpg_clk_rates_hi_res)) +return -EINVAL ; + + refclk = lpg_clk_rates_hi_res[clk_idx]; resolution = lpg_pwm_resolution_hi_res[FIELD_GET (PWM_SIZE_HI_RES_MASK , val)]; }else { refclk = lpg_clk_rates[FIELD_GET (PWM_CLK_SELECT_MASK , val)];
Greg Kroah-Hartman
maintainercover 6.6.140-rc1 review
This is the start of the stable review cycle for the 6.6.140 release. There are 474 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 17 May 2026 15:46:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.140-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.6.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.6.140-rc1
Bjoern Doebel <[email protected]>
smb: client: use kzalloc to zero-initialize security descriptor buffer
Luiz Augusto von Dentz <[email protected]>
Bluetooth: MGMT: Fix dangling pointer on mgmt_add_adv_patterns_monitor_complete
Thorsten Blum <[email protected]>
crypto: nx - fix context leak in nx842_crypto_free_ctx
Jianpeng Chang <[email protected]>
Bluetooth: MGMT: Fix memory leak in set_ssp_complete
Amit Kumar Mahapatra <[email protected]>
mtd: spi-nor: sst: Fix SST write failure
Benjamin Cheng <[email protected]>
drm/amdgpu/vcn4: Avoid overflow on msg bound check
Benjamin Cheng <[email protected]>
drm/amdgpu/vcn3: Avoid overflow on msg bound check
Eric Dumazet <[email protected]>
vsock/virtio: fix potential unbounded skb queue
Stefano Garzarella <[email protected]>
vsock/virtio: fix length and offset in tap skb for split packets
Dudu Lu <[email protected]>
vsock/virtio: fix accept queue count leak on transport mismatch
Norbert Szetei <[email protected]>
vsock: fix buffer size clamping order
Marc Zyngier <[email protected]>
KVM: arm64: Wake-up from WFI when iqrchip is in userspace
Max Kellermann <[email protected]>
ceph: only d_add() negative dentries when they are unhashed
Selvarasu Ganesan <[email protected]>
usb: dwc3: Move GUID programming after PHY initialization
Steven Rostedt <[email protected]>
tracing/probes: Limit size of event probe to 3K
Yochai Eisenrich <[email protected]>
btrfs: fix btrfs_ioctl_space_info() slot_count TOCTOU which can lead to info-leak
Sven Eckelmann <[email protected]>
batman-adv: tp_meter: fix tp_num leak on kmalloc failure
Jiexun Wang <[email protected]>
batman-adv: stop tp_meter sessions during mesh teardown
Viorel Suman (OSS) <[email protected]>
pwm: imx-tpm: Count the number of enabled channels in probe
Sanjaikumar V S <[email protected]>
mtd: spi-nor: sst: Fix write enable before AAI sequence
Bence Csókás <[email protected]>
mtd: spi-nor: sst: Factor out common write operation to sst_nor_write_data()
Namjae Jeon <[email protected]>
ksmbd: fix use-after-free in __ksmbd_close_fd() via durable scavenger
SeongJae Park <[email protected]>
mm/damon/reclaim: detect and use fresh enabled and kdamond_pid values
Amit Sunil Dhamne <[email protected]>
usb: typec: tcpm: reset internal port states on soft reset AMS
SeongJae Park <[email protected]>
mm/damon/lru_sort: detect and use fresh enabled and kdamond_pid values
SeongJae Park <[email protected]>
mm/damon/core: implement damon_kdamond_pid()
Hyunwoo Kim <[email protected]>
rxrpc: Also unshare DATA/RESPONSE packets when paged frags are present
SeongJae Park <[email protected]>
mm/damon/core: disallow time-quota setting zero esz
Nikolay Aleksandrov <[email protected]>
bonding: fix use-after-free due to enslave fail after slave array update
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_get_sndtimeo_cb()
David Howells <[email protected]>
rxrpc: Fix conn-level packet handling to unshare RESPONSE packets
Thomas Zimmermann <[email protected]>
fbcon: Avoid OOB font access if console rotation fails
Johan Hovold <[email protected]>
spi: microchip-core-qspi: fix controller deregistration
Li Zetao <[email protected]>
spi: microchip-core-qspi: Use helper function devm_clk_get_enabled()
Sang-Heon Jeon <[email protected]>
mm/hugetlb_cma: round up per_node before logging it
Johan Hovold <[email protected]>
spi: uniphier: fix controller deregistration
Pei Xiao <[email protected]>
spi: uniphier: Simplify clock handling with devm_clk_get_enabled()
Yang Yingliang <[email protected]>
spi: uniphier: switch to use modern name
Johan Hovold <[email protected]>
spi: tegra20-sflash: fix controller deregistration
Johan Hovold <[email protected]>
spi: tegra114: fix controller deregistration
Johan Hovold <[email protected]>
spi: sun6i: fix controller deregistration
Yang Yingliang <[email protected]>
spi: sun6i: switch to use modern name
Johan Hovold <[email protected]>
spi: zynq-qspi: fix controller deregistration
Pei Xiao <[email protected]>
spi: zynq-qspi: Simplify clock handling with devm_clk_get_enabled()
Yang Yingliang <[email protected]>
spi: zynq-qspi: switch to use modern name
Johan Hovold <[email protected]>
spi: ti-qspi: fix controller deregistration
Yang Yingliang <[email protected]>
spi: spi-ti-qspi: switch to use modern name
Uwe Kleine-König <[email protected]>
spi: spi-ti-qspi: Convert to platform remove callback returning void
Johan Hovold <[email protected]>
spi: sun4i: fix controller deregistration
Yang Yingliang <[email protected]>
spi: sun4i: switch to use modern name
Johan Hovold <[email protected]>
spi: syncuacer: fix controller deregistration
Yang Yingliang <[email protected]>
spi: synquacer: switch to use modern name
David Carlier <[email protected]>
Bluetooth: hci_conn: fix potential UAF in create_big_sync
Michal Kosiorek <[email protected]>
xfrm: defensively unhash xfrm_state lists in __xfrm_state_delete
Michael Bommarito <[email protected]>
xfrm: ah: account for ESN high bits in async callbacks
Eric Biggers <[email protected]>
net: ipv6: stop checking crypto_ahash_alignmask
Eric Biggers <[email protected]>
net: ipv4: stop checking crypto_ahash_alignmask
Cássio Gabriel <[email protected]>
ALSA: seq: Fix UMP group 16 filtering
Takashi Iwai <[email protected]>
ALSA: seq: Notify client and port info changes
Cássio Gabriel <[email protected]>
ALSA: core: Serialize deferred fasync state checks
Takashi Iwai <[email protected]>
ALSA: misc: Use guard() for spin locks
Cássio Gabriel <[email protected]>
ALSA: hda: cs35l56: Propagate ASP TX source control errors
David Carlier <[email protected]>
tracepoint: balance regfunc() on func_add() failure in tracepoint_add_func()
Sam Edwards <[email protected]>
net: stmmac: Prevent NULL deref when RX memory exhausted
Russell King (Oracle) <[email protected]>
net: stmmac: rename STMMAC_GET_ENTRY() -> STMMAC_NEXT_ENTRY()
Russell King (Oracle) <[email protected]>
net: stmmac: avoid shadowing global buf_sz
Thorsten Blum <[email protected]>
crypto: caam - guard HMAC key hex dumps in hash_digest_key
Thorsten Blum <[email protected]>
printk: add print_hex_dump_devel()
Junrui Luo <[email protected]>
erofs: fix unsigned underflow in z_erofs_lz4_handle_overlap()
Thorsten Blum <[email protected]>
crypto: nx - fix bounce buffer leaks in nx842_crypto_{alloc,free}_ctx
Ard Biesheuvel <[email protected]>
crypto: nx - Migrate to scomp API
Gustavo A. R. Silva <[email protected]>
crypto: nx - Avoid -Wflex-array-member-not-at-end warning
DaeMyung Kang <[email protected]>
ksmbd: reset rcount per connection in ksmbd_conn_wait_idle_sess_id()
Yi Cong <[email protected]>
wifi: rtl8xxxu: fix potential use of uninitialized value
Zilin Guan <[email protected]>
hfsplus: fix held lock freed on hfsplus_fill_super()
Deepanshu Kartikey <[email protected]>
hfsplus: fix uninit-value by validating catalog record size
Haoxiang Li <[email protected]>
xfs: fix a resource leak in xfs_alloc_buftarg()
Luke Wang <[email protected]>
mmc: core: Optimize time for secure erase/trim for some Kingston eMMCs
Seohyeon Maeng <[email protected]>
udf: fix partition descriptor append bookkeeping
Thomas Zimmermann <[email protected]>
firmware: google: framebuffer: Do not unregister platform device
Thomas Zimmermann <[email protected]>
fbdev: defio: Disconnect deferred I/O from the lifetime of struct fb_info
Johan Hovold <[email protected]>
spi: fix resource leaks on device setup failure
Manivannan Sadhasivam <[email protected]>
net: qrtr: ns: Limit the total number of nodes
Manivannan Sadhasivam <[email protected]>
net: qrtr: ns: Limit the maximum number of lookups
Manivannan Sadhasivam <[email protected]>
net: qrtr: ns: Limit the maximum server registration per node
Zhengchuan Liang <[email protected]>
net: bridge: use a stable FDB dst snapshot in RCU readers
Yuan Zhaoming <[email protected]>
net: mctp: fix don't require received header reserved bits to be zero
Long Li <[email protected]>
RDMA/mana_ib: Disable RX steering on RSS QP destroy
Joseph Salisbury <[email protected]>
sched: Use u64 for bandwidth ratio calculations
Naman Jain <[email protected]>
block: relax pgmap check in bio_add_page for compatible zone device pages
Oliver Neukum <[email protected]>
media: rc: igorplugusb: heed coherency rules
Thorsten Blum <[email protected]>
ALSA: aoa: Skip devices with no codecs in i2sbus_resume()
Oliver Neukum <[email protected]>
media: rc: ttusbir: respect DMA coherency rules
Cássio Gabriel <[email protected]>
ALSA: aoa: i2sbus: clear stale prepared state
Takashi Iwai <[email protected]>
ALSA: aoa: Use guard() for mutex locks
Corey Minyard <[email protected]>
ipmi:ssif: Clean up kthread on errors
Corey Minyard <[email protected]>
ipmi:ssif: Fix a shutdown race
Rafael J. Wysocki <[email protected]>
thermal: core: Fix thermal zone governor cleanup issues
Daniel Hodges <[email protected]>
PCI: epf-mhi: Return 0, not remaining timeout, when eDMA ops complete
Sean Wang <[email protected]>
wifi: mt76: mt792x: fix mt7925u USB WFSYS reset handling
Sean Wang <[email protected]>
wifi: mt76: mt792x: describe USB WFSYS reset with a descriptor
Deren Wu <[email protected]>
wifi: mt76: connac: introduce helper for mt7925 chipset
Anshuman Khandual <[email protected]>
arm64/mm: Enable batched TLB flush in unmap_hotplug_range()
Alistair Popple <[email protected]>
lib: test_hmm: evict device pages on file close to avoid use-after-free
Daniel Hodges <[email protected]>
wifi: mwifiex: fix use-after-free in mwifiex_adapter_cleanup()
Chao Yu <[email protected]>
f2fs: fix to do sanity check on dcc->discard_cmd_cnt conditionally
Namjae Jeon <[email protected]>
ksmbd: replace connection list with hash table
Namjae Jeon <[email protected]>
ksmbd: use msleep instaed of schedule_timeout_interruptible()
Yongpeng Yang <[email protected]>
f2fs: fix UAF caused by decrementing sbi->nr_pages[] in f2fs_write_end_io()
Michael Bommarito <[email protected]>
smb: client: validate the whole DACL before rewriting it in cifsacl
Michael Bommarito <[email protected]>
ksmbd: require minimum ACE size in smb_check_perm_dacl()
Namjae Jeon <[email protected]>
smb: common: change the data type of num_aces to le16
ChenXiaoSong <[email protected]>
smb: move some duplicate definitions to common/smbacl.h
Sven Eckelmann <[email protected]>
batman-adv: bla: put backbone reference on failed claim hash insert
Sven Eckelmann <[email protected]>
batman-adv: bla: only purge non-released claims
Sven Eckelmann <[email protected]>
batman-adv: bla: prevent use-after-free when deleting claims
Jiexun Wang <[email protected]>
batman-adv: stop caching unowned originator pointers in BAT IV
Jiexun Wang <[email protected]>
batman-adv: reject new tp_meter sessions during teardown
Lyes Bourennani <[email protected]>
batman-adv: fix integer overflow on buff_pos
Ben Morris <[email protected]>
sctp: revalidate list cursor after sctp_sendmsg_to_asoc() in SCTP_SENDALL
Alex Deucher <[email protected]>
drm/amdgpu/pm: align Hawaii mclk workaround with radeon
Alex Deucher <[email protected]>
drm/amdgpu/pm: add missing revision check for CI
John B. Moore <[email protected]>
drm/amdgpu/sdma4: replace BUG_ON with WARN_ON in fence emission
John B. Moore <[email protected]>
drm/amdgpu/gfx9: drop unnecessary 64-bit fence flag check in KIQ
Philip Yang <[email protected]>
drm/amdgpu: zero-initialize GART table on allocation
Alex Deucher <[email protected]>
drm/radeon: add missing revision check for CI
Alysa Liu <[email protected]>
drm/amdkfd: validate SVM ioctl nattr against buffer size
Ashutosh Desai <[email protected]>
drm/gem: Fix inconsistent plane dimension calculation in drm_gem_fb_init_with_funcs()
Benjamin Cheng <[email protected]>
drm/amdgpu/vcn3: Prevent OOB reads when parsing dec msg
Benjamin Cheng <[email protected]>
drm/amdgpu/vcn4: Prevent OOB reads when parsing dec msg
Benjamin Cheng <[email protected]>
drm/amdgpu/vce: Prevent partial address patches
Benjamin Cheng <[email protected]>
drm/amdgpu/vcn4: Prevent OOB reads when parsing IB
Benjamin Cheng <[email protected]>
drm/amdgpu: Add bounds checking to ib_{get,set}_value
Alysa Liu <[email protected]>
drm/amdkfd: Add upper bound check for num_of_nodes
Amir Shetaia <[email protected]>
drm/amdkfd: Clear VRAM on allocation to prevent stale data exposure
Johan Hovold <[email protected]>
spi: cadence: fix unclocked access on unbind
Johan Hovold <[email protected]>
spi: cadence: fix controller deregistration
Johan Hovold <[email protected]>
spi: mpc52xx: fix use-after-free on unbind
Johan Hovold <[email protected]>
spi: orion: fix clock imbalance on registration failure
Johan Hovold <[email protected]>
spi: orion: fix runtime pm leak on unbind
Johan Hovold <[email protected]>
spi: imx: fix runtime pm leak on probe deferral
Johan Hovold <[email protected]>
spi: img-spfi: fix controller deregistration
Johan Hovold <[email protected]>
spi: rspi: fix controller deregistration
Johan Hovold <[email protected]>
spi: sprd: fix controller deregistration
Johan Hovold <[email protected]>
spi: coldfire-qspi: fix controller deregistration
Johan Hovold <[email protected]>
spi: bcmbca-hsspi: fix controller deregistration
Johan Hovold <[email protected]>
spi: fsl: fix controller deregistration
Johan Hovold <[email protected]>
spi: sh-hspi: fix controller deregistration
Johan Hovold <[email protected]>
spi: mtk-nor: fix controller deregistration
Johan Hovold <[email protected]>
spi: omap2-mcspi: fix controller deregistration
Johan Hovold <[email protected]>
spi: fsl-espi: fix controller deregistration
Johan Hovold <[email protected]>
spi: s3c64xx: fix controller deregistration
Johan Hovold <[email protected]>
spi: dln2: fix controller deregistration
Haoxiang Li <[email protected]>
media: omap3isp: drop the use count of v4l2 pipeline
Matthias Fend <[email protected]>
media: i2c: ov08d10: fix image vertical start setting
Michael Tretter <[email protected]>
media: staging: imx: request mbus_config in csi_start
Wenmeng Liu <[email protected]>
media: i2c: imx412: Assert reset GPIO during probe
Sergey Shtylyov <[email protected]>
media: dib8000: avoid division by 0 in dib8000_set_dds()
Abdun Nihaal <[email protected]>
media: pci: zoran: fix potential memory leak in zoran_probe()
Krishna Chomal <[email protected]>
platform/x86: hp-wmi: Ignore backlight and FnLock events
Wang Jun <[email protected]>
media: saa7164: add ioremap return checks and cleanups
Johan Hovold <[email protected]>
spi: at91-usart: fix controller deregistration
Johan Hovold <[email protected]>
spi: qup: fix controller deregistration
Johan Hovold <[email protected]>
spi: lantiq-ssc: fix controller deregistration
Johan Hovold <[email protected]>
regulator: bd9571mwv: fix OF node reference imbalance
Johan Hovold <[email protected]>
regulator: act8945a: fix OF node reference imbalance
Janne Grunau <[email protected]>
media: videobuf2: Set vma_flags in vb2_dma_sg_mmap
Johan Hovold <[email protected]>
regulator: rk808: fix OF node reference imbalance
Oliver Neukum <[email protected]>
media: rc: streamzap: Error handling in probe
Oliver Neukum <[email protected]>
media: rc: xbox_remote: heed DMA restrictions
Johan Hovold <[email protected]>
regulator: max77650: fix OF node reference imbalance
Johan Hovold <[email protected]>
regulator: mt6357: fix OF node reference imbalance
Sakari Ailus <[email protected]>
staging: media: atomisp: Disallow all private IOCTLs
Johan Hovold <[email protected]>
spi: atmel: fix controller deregistration
Johan Hovold <[email protected]>
spi: bcm63xx: fix controller deregistration
Alexander Koskovich <[email protected]>
media: i2c: ov8856: free control handler on error in ov8856_init_controls()
Ricardo Ribalda <[email protected]>
media: uvcvideo: Enable VB2_DMABUF for metadata stream
T.J. Mercier <[email protected]>
HID: playstation: Clamp num_touch_reports
Paul E. McKenney <[email protected]>
exit: Sleep at TASK_IDLE when waiting for application core dump
Huacai Chen <[email protected]>
LoongArch: Use per-root-bridge PCIH flag to skip mem resource fixup
Wentao Guan <[email protected]>
LoongArch: Fix potential ADE in loongson_gpu_fixup_dma_hang()
Quentin Perret <[email protected]>
KVM: arm64: Fix initialisation order in __pkvm_init_finalise()
David Woodhouse <[email protected]>
KVM: arm64: vgic: Fix IIDR revision field extracted from wrong value
Yongpeng Yang <[email protected]>
f2fs: fix node_cnt race between extent node destroy and writeback
Yongpeng Yang <[email protected]>
f2fs: fix incorrect multidevice info in trace_f2fs_map_blocks()
Yongpeng Yang <[email protected]>
f2fs: fix fiemap boundary handling when read extent cache is incomplete
Cen Zhang <[email protected]>
f2fs: add READ_ONCE() for i_blocks in f2fs_update_inode()
Gang Yan <[email protected]>
mptcp: fix scheduling with atomic in timestamp sockopt
Gang Yan <[email protected]>
mptcp: sockopt: set timestamp flags on subflow socket, not msk
Shardul Bankar <[email protected]>
mptcp: use MPTCP_RST_EMPTCP for ACK HMAC validation failure
Shardul Bankar <[email protected]>
mptcp: use MPJoinSynAckHMacFailure for SynAck HMAC failure
Matthieu Baerts (NGI0) <[email protected]>
mptcp: fastclose msk when linger time is 0
Jason Gunthorpe <[email protected]>
RDMA/vmw_pvrdma: Fix double free on pvrdma_alloc_ucontext() error path
Michael Bommarito <[email protected]>
RDMA/rxe: Reject unknown opcodes before ICRC processing
Michael Bommarito <[email protected]>
RDMA/rxe: Reject non-8-byte ATOMIC_WRITE payloads
Jason Gunthorpe <[email protected]>
RDMA/ocrdma: Don't NULL deref uctx on errors in ocrdma_copy_pd_uresp()
Junrui Luo <[email protected]>
RDMA/mlx5: Fix error path fall-through in mlx5_ib_dev_res_srq_init()
Jason Gunthorpe <[email protected]>
RDMA/mlx4: Fix resource leak on error in mlx4_ib_create_srq()
André Draszik <[email protected]>
power: supply: max17042: avoid overflow when determining health
Lukas Wunner <[email protected]>
PCI/AER: Stop ruling out unbound devices as error source
Shuai Xue <[email protected]>
PCI/AER: Clear only error bits in PCIe Device Status
SeongJae Park <[email protected]>
mm/damon/sysfs-schemes: protect memcg_path kfree() with damon_sysfs_lock
Paolo Bonzini <[email protected]>
KVM: x86: check for nEPT/nNPT in slow flush hypercalls
Michael Bommarito <[email protected]>
smb: client: validate dacloffset before building DACL pointers
Zisen Ye <[email protected]>
smb/client: fix out-of-bounds read in symlink_data()
Zisen Ye <[email protected]>
smb/client: fix out-of-bounds read in smb2_compound_op()
Vasily Gorbik <[email protected]>
s390/debug: Reject zero-length input in debug_input_flush_fn()
Jason Gunthorpe <[email protected]>
RDMA/hns: Fix unlocked call to hns_roce_qp_remove()
Ilya Maximets <[email protected]>
openvswitch: vport: fix self-deadlock on release of tunnel ports
Chaitanya Kulkarni <[email protected]>
nvmet: avoid recursive nvmet-wq flush in nvmet_ctrl_free
Fedor Pchelkin <[email protected]>
nvme-apple: drop invalid put of admin queue reference count
Junrui Luo <[email protected]>
md/raid10: fix divide-by-zero in setup_geo() with zero far_copies
Raphael Zimmer <[email protected]>
libceph: Fix slab-out-of-bounds access in auth message processing
Christian A. Ehrhardt <[email protected]>
lib/scatterlist: fix temp buffer in extract_user_to_sg()
Christian A. Ehrhardt <[email protected]>
lib/scatterlist: fix length calculations in extract_kvec_to_sg
Lukas Wunner <[email protected]>
lib/crypto: mpi: Fix integer underflow in mpi_read_raw_from_sgl()
Michael Bommarito <[email protected]>
isofs: validate block number from NFS file handle in isofs_export_iget
Michael Bommarito <[email protected]>
isofs: validate Rock Ridge CE continuation extent against volume size
Eric Biggers <[email protected]>
dm-verity-fec: correctly reject too-small hash devices
Eric Biggers <[email protected]>
dm-verity-fec: correctly reject too-small FEC devices
David Carlier <[email protected]>
eventfs: Hold eventfs_mutex and SRCU when remount walks events
Mikulas Patocka <[email protected]>
dm: fix a buffer overflow in ioctl processing
Mikulas Patocka <[email protected]>
dm: don't report warning when doing deferred remove
Mikulas Patocka <[email protected]>
dm-thin: fix metadata refcount underflow
Guangshuo Li <[email protected]>
btrfs: fix double free in create_space_info() error path
Srinivas Kandagatla <[email protected]>
ASoC: qcom: q6apm: remove child devices when apm is removed
Srinivas Kandagatla <[email protected]>
ASoC: qcom: q6apm-lpass-dai: Fix multiple graph opens
Srinivas Kandagatla <[email protected]>
ASoC: qcom: q6apm-dai: reset queue ptr on trigger stop
Cássio Gabriel <[email protected]>
ASoC: Intel: bytcr_wm5102: Fix MCLK leak on platform_clock_control error
Joseph Salisbury <[email protected]>
ASoC: fsl_easrc: fix comment typo
Tommaso Soncin <[email protected]>
ASoC: amd: yc: Add HP OMEN Gaming Laptop 16-ap0xxx product line in quirk table
Shrikanth Hegde <[email protected]>
cpuidle: powerpc: avoid double clear when breaking snooze
Conor Dooley <[email protected]>
clk: microchip: mpfs-ccc: fix out of bounds access during output registration
Stefan Eichenberger <[email protected]>
clk: imx: imx8-acm: fix flags for acm clocks
Johan Hovold <[email protected]>
spi: topcliff-pch: fix use-after-free on unbind
Thorsten Blum <[email protected]>
thermal/drivers/sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp
Thorsten Blum <[email protected]>
thermal/drivers/sprd: Fix temperature clamping in sprd_thm_temp_to_rawdata
Michael Bommarito <[email protected]>
udf: reject descriptors with oversized CRC length
Mingming Cao <[email protected]>
ibmveth: Disable GSO for packets with small MSS
Hamza Mahfooz <[email protected]>
hv_sock: fix ARM64 support
Bartosz Golaszewski <[email protected]>
gpio: of: clear OF_POPULATED on hog nodes in remove path
Xu Yang <[email protected]>
extcon: ptn5150: handle pending IRQ events during system resume
Shyam Prasad N <[email protected]>
cifs: change_conf needs to be called for session setup
Shyam Prasad N <[email protected]>
cifs: abort open_cached_dir if we don't request leases
Naman Jain <[email protected]>
block: add pgmap check to biovec_phys_mergeable
Jiexun Wang <[email protected]>
af_unix: Reject SIOCATMARK on non-stream sockets
Myeonghun Pak <[email protected]>
hwmon: (corsair-psu) Close HID device on probe errors
Johan Hovold <[email protected]>
clk: rk808: fix OF node reference imbalance
Sanman Pradhan <[email protected]>
hwmon: (ltc2992) Fix u32 overflow in power read path
Sanman Pradhan <[email protected]>
hwmon: (ltc2992) Clamp threshold writes to hardware range
Hongling Zeng <[email protected]>
parisc: Fix IRQ leak in LASI driver
Pavitra Jha <[email protected]>
net: wwan: t7xx: validate port_count against message length in t7xx_port_enum_msg_handler
Nan Li <[email protected]>
net/rds: handle zerocopy send cleanup before the message is queued
Maoyi Xie <[email protected]>
ip6_gre: Use cached t->net in ip6erspan_changelink().
Jiawen Wu <[email protected]>
net: libwx: fix VF illegal register access
SeungJu Cheon <[email protected]>
sound: ua101: fix division by zero at probe
Kai Zen <[email protected]>
net: rtnetlink: zero ifla_vf_broadcast to avoid stack infoleak in rtnl_fill_vfinfo
Tudor Ambarus <[email protected]>
mtd: spi-nor: debugfs: fix out-of-bounds read in spi_nor_params_show()
Miklos Szeredi <[email protected]>
fanotify: fix false positive on permission events
Johan Hovold <[email protected]>
staging: vme_user: fix root device leak on init failure
Johan Hovold <[email protected]>
spi: s3c64xx: fix NULL-deref on driver unbind
Johan Hovold <[email protected]>
spi: zynqmp-gqspi: fix controller deregistration
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_state_change_cb()
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_new_connection_cb()
Luiz Augusto von Dentz <[email protected]>
Bluetooth: hci_event: Fix OOB read and infinite loop in hci_le_create_big_complete_evt
Michael Bommarito <[email protected]>
Bluetooth: virtio_bt: validate rx pkt_type header length
Michael Bommarito <[email protected]>
Bluetooth: virtio_bt: clamp rx length before skb_put
Stephen Smalley <[email protected]>
selinux: prune /sys/fs/selinux/disable
Stephen Smalley <[email protected]>
selinux: shrink critical section in sel_write_load()
David Windsor <[email protected]>
selinux: don't reserve xattr slot when we won't fill it
Yilin Zhu <[email protected]>
ipv6: xfrm6: release dst on error in xfrm6_rcv_encap()
Ruijie Li <[email protected]>
xfrm: provide message size for XFRM_MSG_MAPPING
Sourabh Jain <[email protected]>
powerpc/kdump: fix KASAN sanitization flag for core_$(BITS).o
Cássio Gabriel <[email protected]>
ALSA: firewire-tascam: Do not drop unread control events
Felix Gu <[email protected]>
usb: ulpi: fix memory leak on ulpi_register() error paths
Fabio Porcedda <[email protected]>
USB: serial: option: add Telit Cinterion LE910Cx compositions
Aaro Koskinen <[email protected]>
USB: omap_udc: DMA: Don't enable burst 4 mode
Cássio Gabriel <[email protected]>
ALSA: usb-audio: Fix UAC3 cluster descriptor size check
Takashi Iwai <[email protected]>
ALSA: usb-audio: Avoid potential endless loop in convert_chmap_v3()
Cássio Gabriel <[email protected]>
ALSA: usb-audio: midi2: Restart output URBs on resume
Greg Kroah-Hartman <[email protected]>
usb: usblp: fix uninitialized heap leak via LPGETSTATUS ioctl
Greg Kroah-Hartman <[email protected]>
usb: usblp: fix heap leak in IEEE 1284 device ID via short response
Marek Szyprowski <[email protected]>
wifi: brcmfmac: Fix potential use-after-free issue when stopping watchdog task
Tristan Madani <[email protected]>
wifi: b43: enforce bounds check on firmware key index in b43_rx()
Johannes Berg <[email protected]>
wifi: mac80211: remove station if connection prep fails
Jiri Slaby (SUSE) <[email protected]>
wifi: ath5k: do not access array OOB
Jeongjun Park <[email protected]>
wifi: rsi: fix kthread lifetime race between self-exit and external-stop
Catherine <[email protected]>
wifi: mac80211: drop stray 'static' from fast-RX rx_result
Tristan Madani <[email protected]>
wifi: b43legacy: enforce bounds check on firmware key index in RX path
Quan Zhou <[email protected]>
wifi: mt76: mt7921: fix ROC abort flow interruption in mt7921_roc_work
Leon Yen <[email protected]>
wifi: mt76: mt7921: fix a potential clc buffer length underflow
Jann Horn <[email protected]>
exit: prevent preemption of oopsing TASK_DEAD task
Kumar Kartikeya Dwivedi <[email protected]>
bpf: Don't mark STACK_INVALID as STACK_MISC in mark_stack_slot_misc
Andrii Nakryiko <[email protected]>
selftests/bpf: validate fake register spill/fill precision backtracking logic
Andrii Nakryiko <[email protected]>
bpf: handle fake register spill to stack with BPF_ST_MEM instruction
Andrii Nakryiko <[email protected]>
selftests/bpf: validate precision logic in partial_stack_load_preserves_zeros
Andrii Nakryiko <[email protected]>
bpf: track aligned STACK_ZERO cases as imprecise spilled registers
Andrii Nakryiko <[email protected]>
selftests/bpf: validate zero preservation for sub-slot loads
Andrii Nakryiko <[email protected]>
bpf: preserve constant zero when doing partial register restore
Andrii Nakryiko <[email protected]>
selftests/bpf: validate STACK_ZERO is preserved on subreg spill
Andrii Nakryiko <[email protected]>
bpf: preserve STACK_ZERO slots on partial reg spills
Andrii Nakryiko <[email protected]>
selftests/bpf: add stack access precision test
Andrii Nakryiko <[email protected]>
bpf: support non-r10 register spill/fill to/from stack in precision tracking
Jamal Hadi Salim <[email protected]>
net/sched: sch_red: Replace direct dequeue call with peek and qdisc_dequeue_peeked
Paolo Bonzini <[email protected]>
KVM: SVM: check validity of VMCB controls when returning from SMM
Vinicius Costa Gomes <[email protected]>
dmaengine: idxd: Fix leaking event log memory
Vinicius Costa Gomes <[email protected]>
dmaengine: idxd: Fix crash when the event log is disabled
Jiawen Wu <[email protected]>
net: txgbe: fix RTNL assertion warning when remove module
Qingfang Deng <[email protected]>
flow_dissector: do not dissect PPPoE PFC frames
Dong Chenchen <[email protected]>
net: Fix icmp host relookup triggering ip_rt_bug
Ankit Soni <[email protected]>
iommu/amd: serialize sequence allocation under concurrent TLB invalidations
Uros Bizjak <[email protected]>
iommu/amd: Use atomic64_inc_return() in iommu.c
Sean Christopherson <[email protected]>
KVM: x86: Fix shadow paging use-after-free due to unexpected GFN
David Howells <[email protected]>
rxrpc: Fix rxrpc_input_call_event() to only unshare DATA packets
Tejas Bharambe <[email protected]>
ext4: validate p_idx bounds in ext4_ext_correct_indexes
David Howells <[email protected]>
rxrpc: Fix potential UAF after skb_unshare() failure
Felix Gu <[email protected]>
spi: meson-spicc: Fix double-put in remove path
Rick Edgecombe <[email protected]>
x86/shstk: Prevent deadlock during shstk sigreturn
Yussuf Khalil <[email protected]>
drm/amd/display: Do not skip unrelated mode changes in DSC validation
Linus Torvalds <[email protected]>
x86: shadow stacks: proper error handling for mmap lock
Johan Hovold <[email protected]>
spi: rockchip: fix controller deregistration
Mark Brown <[email protected]>
ASoC: SOF: Don't allow pointer operations on unconfigured streams
Sina Hassani <[email protected]>
iommufd: Fix a race with concurrent allocation and unmap
Shivam Kalra <[email protected]>
ACPI: video: force native backlight on HP OMEN 16 (8A44)
Jinjie Ruan <[email protected]>
ACPI: CPPC: Fix related_cpus inconsistency during CPU hotplug
Guangshuo Li <[email protected]>
ACPI: scan: Use acpi_dev_put() in object add error paths
Rajat Gupta <[email protected]>
fbdev: udlfb: add vm_ops to dlfb_ops_mmap to prevent use-after-free
Corey Minyard <[email protected]>
ipmi:si: Return state to normal if message allocation fails
Corey Minyard <[email protected]>
ipmi: Check event message buffer response for bad data
Corey Minyard <[email protected]>
ipmi: Add limits to event and receive message requests
Greg Kroah-Hartman <[email protected]>
scsi: target: configfs: Bound snprintf() return in tg_pt_gp_members_show()
Kai Ma <[email protected]>
netfilter: reject zero shift in nft_bitwise
Andrea Mayer <[email protected]>
net: ipv6: fix NOREF dst use in seg6 and rpl lwtunnels
Deepanshu Kartikey <[email protected]>
ALSA: caiaq: fix usb_dev refcount leak on probe failure
Arjan van de Ven <[email protected]>
drm/amdgpu: fix zero-size GDS range init on RDNA4
Greg Kroah-Hartman <[email protected]>
ipv6: rpl: reserve mac_len headroom when recompressed SRH grows
Takashi Iwai <[email protected]>
ALSA: caiaq: Don't abort when no input device is available
Takashi Iwai <[email protected]>
ALSA: caiaq: Fix potentially leftover ep1_in_urb at error path
Douglas Anderson <[email protected]>
driver core: Add kernel-doc for DEV_FLAG_COUNT enum value
Yucheng Lu <[email protected]>
crypto: authencesn - reject short ahash digests during instance creation
Andrea Mayer <[email protected]>
seg6: fix seg6 lwtunnel output redirect for L2 reduced encap mode
Yang Xiuwei <[email protected]>
scsi: sd: fix missing put_disk() when device_add(&disk_dev) fails
Keenan Dong <[email protected]>
rtmutex: Use waiter::task instead of current in remove_waiter()
Tobias Gaertner <[email protected]>
ntfs3: fix integer overflow in run_unpack() volume boundary check
Tobias Gaertner <[email protected]>
ntfs3: add buffer boundary checks to run_unpack()
Steven Rostedt <[email protected]>
ktest: Fix the month in the name of the failure directory
Chen Zhao <[email protected]>
IB/core: Fix zero dmac race in neighbor resolution
Junrui Luo <[email protected]>
dm mirror: fix integer overflow in create_dirty_log()
Thorsten Blum <[email protected]>
crypto: atmel-sha204a - Fix potential UAF and memory leak in remove path
Thorsten Blum <[email protected]>
crypto: atmel-tdes - fix DMA sync direction
Haoxiang Li <[email protected]>
crypto: ccree - fix a memory leak in cc_mac_digest()
Thomas Fourier <[email protected]>
crypto: hisilicon - Fix dma_unmap_single() direction
Thorsten Blum <[email protected]>
crypto: atmel-ecc - Release client on allocation failure
Thorsten Blum <[email protected]>
crypto: atmel-aes - Fix 3-page memory leak in atmel_aes_buff_cleanup
Eric Biggers <[email protected]>
crypto: arm64/aes - Fix 32-bit aes_mac_update() arg treated as 64-bit
Johan Hovold <[email protected]>
can: ucan: fix devres lifetime
Shuvam Pandey <[email protected]>
Bluetooth: hci_event: fix potential UAF in SSP passkey handlers
Yiyang Chen <[email protected]>
taskstats: set version in TGID exit notifications
Zhenzhong Wu <[email protected]>
tcp: call sk_data_ready() after listener migration
Chia-Ming Chang <[email protected]>
inotify: fix watch count leak when fsnotify_add_inode_mark_locked() fails
Junrui Luo <[email protected]>
md/raid5: validate payload size before accessing journal metadata
Chia-Ming Chang <[email protected]>
md/raid5: fix soft lockup in retry_aligned_read()
Sohei Koyama <[email protected]>
ext4: fix missing brelse() in ext4_xattr_inode_dec_ref_all()
Deepanshu Kartikey <[email protected]>
ext4: fix bounds check in check_xattrs() to prevent out-of-bounds access
Jens Axboe <[email protected]>
io_uring/poll: fix multishot recv missing EOF on wakeup race
James Kim <[email protected]>
mtd: docg3: fix use-after-free in docg3_release()
Uwe Kleine-König <[email protected]>
mtd: docg3: Convert to platform remove callback returning void
Yosry Ahmed <[email protected]>
KVM: nSVM: Add missing consistency check for nCR3 validity
Yosry Ahmed <[email protected]>
KVM: nSVM: Add missing consistency check for EFER, CR0, CR4, and CS
Yosry Ahmed <[email protected]>
KVM: nSVM: Clear tracking of L1->L2 NMI and soft IRQ on nested #VMEXIT
Yosry Ahmed <[email protected]>
KVM: nSVM: Clear EVENTINJ fields in vmcb12 on nested #VMEXIT
Yosry Ahmed <[email protected]>
KVM: nSVM: Clear GIF on nested #VMEXIT(INVALID)
Yosry Ahmed <[email protected]>
KVM: nSVM: Always inject a #GP if mapping VMCB12 fails on nested VMRUN
Yosry Ahmed <[email protected]>
KVM: nSVM: Use vcpu->arch.cr2 when updating vmcb12 on nested #VMEXIT
Yosry Ahmed <[email protected]>
KVM: nSVM: Ensure AVIC is inhibited when restoring a vCPU to guest mode
Sean Christopherson <[email protected]>
KVM: SVM: Explicitly mark vmcb01 dirty after modifying VMCB intercepts
Kevin Cheng <[email protected]>
KVM: SVM: Inject #UD for INVLPGA if EFER.SVME=0
Yosry Ahmed <[email protected]>
KVM: nSVM: Sync interrupt shadow to cached vmcb12 after VMRUN of L2
Yosry Ahmed <[email protected]>
KVM: nSVM: Sync NextRIP to cached vmcb12 after VMRUN of L2
Yosry Ahmed <[email protected]>
KVM: nSVM: Mark all of vmcb02 dirty when restoring nested state
Sean Christopherson <[email protected]>
KVM: x86: Defer non-architectural deliver of exception payload to userspace read
Denis M. Karpov <[email protected]>
userfaultfd: allow registration of ranges below mmap_min_addr
SeongJae Park <[email protected]>
mm/damon/core: use time_in_range_open() for damos quota window start
Johan Hovold <[email protected]>
rtc: ntxec: fix OF node reference imbalance
Jacqueline Wong <[email protected]>
tpm: tpm_tis: stop transmit if retries are exhausted
Jacqueline Wong <[email protected]>
tpm: tpm_tis: add error logging for data transfer
Paul Louvel <[email protected]>
crypto: talitos - rename first/last to first_desc/last_desc
Paul Louvel <[email protected]>
crypto: talitos - fix SEC1 32k ahash request limitation
Francesco Dolcini <[email protected]>
arm64: dts: ti: am62-verdin: Enable pullup for eMMC data pins
Shawn Lin <[email protected]>
mmc: sdhci-of-dwcmshc: Disable clock before DLL configuration
Bin Liu <[email protected]>
mmc: block: use single block write in retry
Ryan Roberts <[email protected]>
randomize_kstack: Maintain kstack_offset per task
Krzysztof Kozlowski <[email protected]>
power: supply: axp288_charger: Do not cancel work before initializing it
Huacai Chen <[email protected]>
LoongArch: Show CPU vulnerabilites correctly
Arnd Bergmann <[email protected]>
tpm: avoid -Wunused-but-set-variable
Nathan Chancellor <[email protected]>
extract-cert: Wrap key_pass with '#ifdef USE_PKCS11_ENGINE'
Raphael Zimmer <[email protected]>
libceph: Prevent potential null-ptr-deref in ceph_handle_auth_reply()
Ruide Cao <[email protected]>
ipv4: icmp: validate reply type before using icmp_pointers
hkbinbin <[email protected]>
RDMA/rxe: Validate pad and ICRC before payload_size() in rxe_rcv
Luca Ceresoli <[email protected]>
drm/arcpgu: fix device node leak
Marek Vasut <[email protected]>
net: ks8851: Avoid excess softirq scheduling
Marek Vasut <[email protected]>
net: ks8851: Reinstate disabling of BHs around IRQ handler
Ruijie Li <[email protected]>
net/smc: avoid early lgr access in smc_clc_wait_msg
Jiawen Wu <[email protected]>
net: txgbe: fix firmware version check
Ao Zhou <[email protected]>
net: rds: fix MR cleanup on copy error
Manivannan Sadhasivam <[email protected]>
net: qrtr: ns: Free the node during ctrl_cmd_bye()
Yiyang Chen <[email protected]>
tools/accounting: handle truncated taskstats netlink messages
David Howells <[email protected]>
rxrpc: Fix re-decryption of RESPONSE packets
David Howells <[email protected]>
rxrpc: Fix rxkad crypto unalignment handling
David Howells <[email protected]>
rxrpc: Fix memory leaks in rxkad_verify_response()
Jonathan Santos <[email protected]>
iio: adc: ad7768-1: fix one-shot mode data acquisition
Cássio Gabriel <[email protected]>
ALSA: pcmtest: Fix resource leaks in module init error paths
Guangshuo Li <[email protected]>
ALSA: pcmtest: fix reference leak on failed device registration
Cássio Gabriel <[email protected]>
ALSA: 6fire: Fix input volume change detection
Takashi Iwai <[email protected]>
ALSA: caiaq: Handle probe errors properly
Cássio Gabriel <[email protected]>
ALSA: caiaq: Fix control_put() result and cache rollback
Takashi Iwai <[email protected]>
ALSA: core: Fix potential data race at fasync handling
Jens Axboe <[email protected]>
io_uring/poll: ensure EPOLL_ONESHOT is propagated for EPOLL_URING_WAKE
Longxuan Yu <[email protected]>
io_uring/poll: fix signed comparison in io_poll_get_ownership()
David Lechner <[email protected]>
iio: adc: ti-ads7950: use iio_push_to_buffers_with_ts_unaligned()
Pavel Begunkov <[email protected]>
io_uring/timeout: check unused sqe fields
Dawei Feng <[email protected]>
rbd: fix null-ptr-deref when device_add_disk() fails
Simon Liebold <[email protected]>
selftests/mqueue: Fix incorrectly named file
Ben Levinsky <[email protected]>
remoteproc: xlnx: Only access buffer information if IPI is buffered
Helge Deller <[email protected]>
parisc: _llseek syscall is only available for 32-bit userspace
Robert Beckett <[email protected]>
nvme: respect NVME_QUIRK_DISABLE_WRITE_ZEROES when wzsl is set
Robert Beckett <[email protected]>
nvme-pci: add NVME_QUIRK_DISABLE_WRITE_ZEROES for Kingston OM3SGP4
Marek Vasut <[email protected]>
mfd: stpmic1: Attempt system shutdown twice in case PMIC is confused
Josh Hunt <[email protected]>
md/raid10: fix deadlock with check operation and nowait requests
Gao Xiang <[email protected]>
erofs: fix the out-of-bounds nameoff handling for trailing dirents
Cássio Gabriel <[email protected]>
ALSA: seq_oss: return full count for successful SEQ_FULLSIZE writes
Harin Lee <[email protected]>
ALSA: ctxfi: Add fallback to default RSR for S/PDIF
Cássio Gabriel <[email protected]>
ALSA: aoa: i2sbus: fix OF node lifetime handling
Vasiliy Kovalev <[email protected]>
ext2: reject inodes with zero i_nlink and valid mode in ext2_iget()
Manivannan Sadhasivam <[email protected]>
net: qrtr: ns: Fix use-after-free in driver remove()
Chen Ni <[email protected]>
media: i2c: imx219: Check return value of devm_gpiod_get_optional() in imx219_probe()
Josh Law <[email protected]>
lib/ts_kmp: fix integer overflow in pattern length calculation
Rong Zhang <[email protected]>
Revert "ALSA: usb: Increase volume range that triggers a warning"
Koichiro Den <[email protected]>
PCI: endpoint: pci-epf-ntb: Remove duplicate resource teardown
Fan Wu <[email protected]>
media: mtk-jpeg: fix use-after-free in release path due to uncancelled work
Luxiao Xu <[email protected]>
net: strparser: fix skb_head leak in strp_abort_strp()
Zhengchuan Liang <[email protected]>
net: caif: clear client service pointer on teardown
Ziqing Chen <[email protected]>
ALSA: control: Validate buf_len before strnlen() in snd_ctl_elem_init_enum_names()
Ming Qian <[email protected]>
media: amphion: Fix race between m2m job_abort and device_run
Wentao Liang <[email protected]>
of: unittest: fix use-after-free in testdrv_probe()
Herbert Xu <[email protected]>
crypto: pcrypt - Fix handling of MAY_BACKLOG requests
Chao Yu <[email protected]>
f2fs: fix to detect potential corrupted nid in free_nid_list
Johan Hovold <[email protected]>
spi: imx: fix use-after-free on unbind
Michael Bommarito <[email protected]>
um: drivers: call kernel_strrchr() explicitly in cow_user.c
Fedor Pchelkin <[email protected]>
wifi: rtw88: check for PCI upstream bridge existence
Sergey Senozhatsky <[email protected]>
zram: do not forget to endio for partial discard requests
Greg Kroah-Hartman <[email protected]>
LoongArch: Add spectre boundry for syscall dispatch table
Douglas Anderson <[email protected]>
driver core: Don't let a device probe until it's ready
Heming Zhao <[email protected]>
ocfs2: split transactions in dio completion to avoid credit exhaustion
Douglas Anderson <[email protected]>
device property: Make modifications of fwnode "flags" thread safe
Douglas Anderson <[email protected]>
regset: use kvzalloc() for regset_get_alloc()
Jesse.Zhang <[email protected]>
drm/amdgpu: Limit BO list entry count to prevent resource exhaustion
Tvrtko Ursulin <[email protected]>
drm/amdgpu: Use vmemdup_array_user in amdgpu_bo_create_list_entry_array
Herbert Xu <[email protected]>
padata: Remove comment for reorder_work
Herbert Xu <[email protected]>
padata: Fix pd UAF once and for all
Luiz Augusto von Dentz <[email protected]>
Bluetooth: MGMT: Fix possible UAFs
Thomas Zimmermann <[email protected]>
firmware: google: framebuffer: Do not mark framebuffer as busy
Tyllis Xu <[email protected]>
ibmasm: fix heap over-read in ibmasm_send_i2o_message()
Tyllis Xu <[email protected]>
ibmasm: fix OOB reads in command_file_write due to missing size checks
Tyllis Xu <[email protected]>
misc: ibmasm: fix OOB MMIO read in ibmasm_handle_mouse_interrupt()
Greg Kroah-Hartman <[email protected]>
leds: qcom-lpg: Check for array overflow when selecting the high resolution
Greg Kroah-Hartman <[email protected]>
drm/nouveau: fix u32 overflow in pushbuf reloc bounds check
Takashi Iwai <[email protected]>
ALSA: usb-audio: Evaluate packsize caps at the right place
Xu Yang <[email protected]>
usb: chipidea: core: allow ci_irq_handler() handle both ID and VBUS change
Xu Yang <[email protected]>
usb: chipidea: otg: not wait vbus drop if use role_switch
Michal Pecio <[email protected]>
usb: xhci: Make usb_host_endpoint.hcpriv survive endpoint_disable()
Cássio Gabriel <[email protected]>
ALSA: usb-audio: Fix Audio Advantage Micro II SPDIF switch
Cássio Gabriel <[email protected]>
ALSA: usb-audio: Avoid false E-MU sample-rate notifications
Cássio Gabriel <[email protected]>
ALSA: usb-audio: stop parsing UAC2 rates at MAX_NR_RATES
-------------
Diffstat:
Makefile | 4 +-
arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi | 20 +-
arch/arm64/crypto/aes-modes.S | 4 +-
arch/arm64/kvm/arm.c | 5 +
arch/arm64/kvm/hyp/nvhe/setup.c | 8 +-
arch/arm64/kvm/vgic/vgic-mmio-v2.c | 2 +-
arch/arm64/kvm/vgic/vgic-mmio-v3.c | 2 +-
arch/arm64/mm/mmu.c | 36 ++-
arch/loongarch/kernel/cpu-probe.c | 7 +
arch/loongarch/kernel/syscall.c | 3 +-
arch/loongarch/pci/acpi.c | 5 +
arch/loongarch/pci/pci.c | 3 +
arch/parisc/kernel/syscalls/syscall.tbl | 2 +-
arch/powerpc/kexec/Makefile | 2 +-
arch/s390/kernel/debug.c | 5 +
arch/um/drivers/cow_user.c | 8 +-
arch/x86/kernel/shstk.c | 45 ++-
arch/x86/kvm/hyperv.c | 2 +-
arch/x86/kvm/mmu/mmu.c | 35 +--
arch/x86/kvm/svm/nested.c | 56 +++-
arch/x86/kvm/svm/svm.c | 17 ++
arch/x86/kvm/svm/svm.h | 2 +
arch/x86/kvm/x86.c | 62 ++--
block/bio-integrity.c | 2 +
block/bio.c | 14 +-
block/blk.h | 21 ++
certs/extract-cert.c | 6 +-
crypto/authencesn.c | 5 +
crypto/pcrypt.c | 7 +-
drivers/acpi/cppc_acpi.c | 6 +-
drivers/acpi/power.c | 2 +-
drivers/acpi/scan.c | 2 +-
drivers/acpi/video_detect.c | 8 +
drivers/base/core.c | 39 ++-
drivers/base/dd.c | 20 ++
drivers/block/rbd.c | 6 +-
drivers/block/zram/zram_drv.c | 3 +-
drivers/bluetooth/virtio_bt.c | 39 ++-
drivers/bus/imx-weim.c | 2 +-
drivers/char/ipmi/ipmi_si_intf.c | 70 ++++-
drivers/char/ipmi/ipmi_ssif.c | 36 ++-
drivers/char/tpm/tpm_tis_core.c | 11 +-
drivers/clk/clk-rk808.c | 2 +-
drivers/clk/imx/clk-imx8-acm.c | 3 +-
drivers/clk/microchip/clk-mpfs-ccc.c | 6 +-
drivers/cpuidle/cpuidle-powernv.c | 5 +-
drivers/cpuidle/cpuidle-pseries.c | 5 +-
drivers/crypto/atmel-aes.c | 2 +-
drivers/crypto/atmel-ecc.c | 1 +
drivers/crypto/atmel-sha204a.c | 6 +-
drivers/crypto/atmel-tdes.c | 8 +-
drivers/crypto/caam/caamalg_qi2.c | 4 +-
drivers/crypto/caam/caamhash.c | 4 +-
drivers/crypto/ccree/cc_hash.c | 1 +
drivers/crypto/hisilicon/sec/sec_algs.c | 2 +-
drivers/crypto/nx/nx-842.c | 47 +--
drivers/crypto/nx/nx-842.h | 25 +-
drivers/crypto/nx/nx-common-powernv.c | 31 +-
drivers/crypto/nx/nx-common-pseries.c | 33 +-
drivers/crypto/talitos.c | 340 +++++++++++++--------
drivers/dma/idxd/device.c | 3 +-
drivers/extcon/extcon-ptn5150.c | 14 +
drivers/firmware/google/framebuffer-coreboot.c | 12 +-
drivers/gpio/gpiolib-of.c | 9 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 43 ++-
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 13 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 11 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 3 +
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 -
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 +-
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 25 +-
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 46 ++-
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 29 +-
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 4 +
drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 11 +
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 1 +
.../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 7 +-
.../gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c | 13 +-
drivers/gpu/drm/drm_gem_framebuffer_helper.c | 4 +-
drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +-
drivers/gpu/drm/radeon/ci_dpm.c | 9 +-
drivers/gpu/drm/tiny/arcpgu.c | 3 +-
drivers/hid/hid-playstation.c | 6 +-
drivers/hwmon/corsair-psu.c | 4 +-
drivers/hwmon/ltc2992.c | 41 ++-
drivers/i2c/i2c-core-of.c | 2 +-
drivers/iio/adc/ad7768-1.c | 9 +-
drivers/iio/adc/ti-ads7950.c | 11 +-
drivers/infiniband/core/addr.c | 3 +
drivers/infiniband/hw/hns/hns_roce_qp.c | 7 +
drivers/infiniband/hw/mana/qp.c | 15 +
drivers/infiniband/hw/mlx4/srq.c | 4 +-
drivers/infiniband/hw/mlx5/main.c | 1 +
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 4 +-
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c | 2 +-
drivers/infiniband/sw/rxe/rxe_recv.c | 14 +-
drivers/infiniband/sw/rxe/rxe_resp.c | 14 +-
drivers/iommu/amd/amd_iommu_types.h | 2 +-
drivers/iommu/amd/init.c | 2 +-
drivers/iommu/amd/iommu.c | 18 +-
drivers/iommu/iommufd/io_pagetable.c | 10 +
drivers/leds/rgb/leds-qcom-lpg.c | 7 +-
drivers/md/dm-ioctl.c | 6 +-
drivers/md/dm-raid1.c | 6 +-
drivers/md/dm-verity-fec.c | 8 +-
drivers/md/persistent-data/dm-btree-remove.c | 8 +
drivers/md/raid10.c | 6 +-
drivers/md/raid5-cache.c | 48 ++-
drivers/md/raid5.c | 8 +-
drivers/media/common/videobuf2/videobuf2-dma-sg.c | 1 +
drivers/media/dvb-frontends/dib8000.c | 4 +-
drivers/media/i2c/imx219.c | 3 +
drivers/media/i2c/imx412.c | 2 +-
drivers/media/i2c/ov08d10.c | 10 +-
drivers/media/i2c/ov8856.c | 10 +-
drivers/media/pci/saa7164/saa7164-core.c | 47 ++-
drivers/media/pci/zoran/zoran_card.c | 2 +-
drivers/media/platform/amphion/vpu_v4l2.c | 9 +-
.../media/platform/mediatek/jpeg/mtk_jpeg_core.c | 1 +
drivers/media/platform/ti/omap3isp/ispvideo.c | 1 +
drivers/media/rc/igorplugusb.c | 16 +-
drivers/media/rc/streamzap.c | 12 +-
drivers/media/rc/ttusbir.c | 13 +-
drivers/media/rc/xbox_remote.c | 9 +-
drivers/media/usb/uvc/uvc_queue.c | 3 +-
drivers/mfd/stpmic1.c | 20 +-
drivers/misc/ibmasm/ibmasmfs.c | 7 +
drivers/misc/ibmasm/lowlevel.c | 12 +-
drivers/misc/ibmasm/remote.c | 5 +
drivers/mmc/core/block.c | 12 +-
drivers/mmc/core/card.h | 5 +
drivers/mmc/core/queue.c | 8 +-
drivers/mmc/core/queue.h | 3 +
drivers/mmc/core/quirks.h | 9 +
drivers/mmc/host/sdhci-of-dwcmshc.c | 19 +-
drivers/mtd/devices/docg3.c | 8 +-
drivers/mtd/spi-nor/debugfs.c | 4 +-
drivers/mtd/spi-nor/sst.c | 50 +--
drivers/net/bonding/bond_main.c | 6 +-
drivers/net/can/usb/ucan.c | 2 +-
drivers/net/ethernet/ibm/ibmveth.c | 22 ++
drivers/net/ethernet/ibm/ibmveth.h | 1 +
drivers/net/ethernet/micrel/ks8851.h | 6 +-
drivers/net/ethernet/micrel/ks8851_common.c | 69 ++---
drivers/net/ethernet/micrel/ks8851_par.c | 15 +-
drivers/net/ethernet/micrel/ks8851_spi.c | 11 +-
drivers/net/ethernet/microsoft/mana/mana_en.c | 11 +-
drivers/net/ethernet/stmicro/stmmac/chain_mode.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/common.h | 2 +-
drivers/net/ethernet/stmicro/stmmac/ring_mode.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 47 +--
drivers/net/ethernet/wangxun/libwx/wx_hw.c | 7 +-
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 3 +-
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 2 +
drivers/net/phy/mdio_bus.c | 4 +-
drivers/net/wireless/ath/ath5k/base.c | 3 +-
drivers/net/wireless/broadcom/b43/xmit.c | 3 +-
drivers/net/wireless/broadcom/b43legacy/xmit.c | 3 +-
.../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 6 +-
drivers/net/wireless/marvell/mwifiex/init.c | 2 +-
drivers/net/wireless/mediatek/mt76/mt76_connac.h | 6 +
.../net/wireless/mediatek/mt76/mt76_connac_mac.c | 4 +-
.../net/wireless/mediatek/mt76/mt76_connac_mcu.c | 3 +-
.../net/wireless/mediatek/mt76/mt76_connac_mcu.h | 2 +-
drivers/net/wireless/mediatek/mt76/mt7921/main.c | 7 +-
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 3 +
drivers/net/wireless/mediatek/mt76/mt792x_regs.h | 4 +
drivers/net/wireless/mediatek/mt76/mt792x_usb.c | 51 +++-
.../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 28 +-
drivers/net/wireless/realtek/rtw88/pci.c | 3 +-
drivers/net/wireless/rsi/rsi_common.h | 5 +-
drivers/net/wwan/t7xx/t7xx_modem_ops.c | 20 +-
drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c | 18 +-
drivers/net/wwan/t7xx/t7xx_port_proxy.h | 2 +-
drivers/nvme/host/apple.c | 6 +-
drivers/nvme/host/core.c | 2 +-
drivers/nvme/host/pci.c | 2 +
drivers/nvme/target/core.c | 2 +-
drivers/of/base.c | 2 +-
drivers/of/dynamic.c | 2 +-
drivers/of/platform.c | 2 +-
drivers/of/unittest.c | 1 -
drivers/parisc/lasi.c | 12 +-
drivers/pci/endpoint/functions/pci-epf-mhi.c | 4 +
drivers/pci/endpoint/functions/pci-epf-ntb.c | 56 +---
drivers/pci/pci.c | 7 +-
drivers/pci/pcie/aer.c | 2 -
drivers/platform/x86/hp/hp-wmi.c | 5 +
drivers/power/supply/axp288_charger.c | 19 +-
drivers/power/supply/max17042_battery.c | 2 +-
drivers/pwm/pwm-imx-tpm.c | 8 +
drivers/regulator/act8945a-regulator.c | 3 +-
drivers/regulator/bd9571mwv-regulator.c | 3 +-
drivers/regulator/max77650-regulator.c | 2 +-
drivers/regulator/mt6357-regulator.c | 2 +-
drivers/regulator/rk808-regulator.c | 3 +-
drivers/remoteproc/xlnx_r5_remoteproc.c | 20 +-
drivers/rtc/rtc-ntxec.c | 2 +-
drivers/scsi/sd.c | 1 +
drivers/spi/spi-at91-usart.c | 8 +-
drivers/spi/spi-atmel.c | 8 +-
drivers/spi/spi-bcm63xx.c | 8 +-
drivers/spi/spi-bcmbca-hsspi.c | 4 +-
drivers/spi/spi-cadence.c | 15 +-
drivers/spi/spi-coldfire-qspi.c | 10 +-
drivers/spi/spi-dln2.c | 8 +-
drivers/spi/spi-fsl-espi.c | 10 +-
drivers/spi/spi-fsl-spi.c | 14 +-
drivers/spi/spi-img-spfi.c | 8 +-
drivers/spi/spi-imx.c | 5 +
drivers/spi/spi-lantiq-ssc.c | 8 +-
drivers/spi/spi-meson-spicc.c | 2 -
drivers/spi/spi-microchip-core-qspi.c | 41 +--
drivers/spi/spi-mpc52xx.c | 3 +-
drivers/spi/spi-mtk-nor.c | 4 +-
drivers/spi/spi-omap2-mcspi.c | 8 +-
drivers/spi/spi-orion.c | 9 +
drivers/spi/spi-qup.c | 8 +-
drivers/spi/spi-rockchip.c | 4 +-
drivers/spi/spi-rspi.c | 10 +-
drivers/spi/spi-s3c64xx.c | 9 +-
drivers/spi/spi-sh-hspi.c | 10 +-
drivers/spi/spi-sprd.c | 8 +-
drivers/spi/spi-sun4i.c | 80 ++---
drivers/spi/spi-sun6i.c | 154 +++++-----
drivers/spi/spi-synquacer.c | 88 +++---
drivers/spi/spi-tegra114.c | 8 +-
drivers/spi/spi-tegra20-sflash.c | 8 +-
drivers/spi/spi-ti-qspi.c | 97 +++---
drivers/spi/spi-topcliff-pch.c | 6 +-
drivers/spi/spi-uniphier.c | 212 +++++++------
drivers/spi/spi-zynq-qspi.c | 79 ++---
drivers/spi/spi-zynqmp-gqspi.c | 4 +-
drivers/spi/spi.c | 63 ++--
drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 4 +
drivers/staging/media/imx/imx-media-csi.c | 40 ++-
drivers/staging/vme_user/vme_fake.c | 2 +
drivers/target/target_core_configfs.c | 2 +-
drivers/thermal/sprd_thermal.c | 4 +-
drivers/thermal/thermal_core.c | 7 +-
drivers/usb/chipidea/core.c | 45 +--
drivers/usb/chipidea/otg.c | 7 +-
drivers/usb/class/usblp.c | 3 +-
drivers/usb/common/ulpi.c | 5 +-
drivers/usb/dwc3/core.c | 12 +-
drivers/usb/gadget/udc/omap_udc.c | 4 -
drivers/usb/host/xhci.c | 1 -
drivers/usb/serial/option.c | 4 +
drivers/usb/typec/tcpm/tcpm.c | 2 +
drivers/video/fbdev/core/fb_defio.c | 179 ++++++++---
drivers/video/fbdev/core/fbcon_rotate.c | 5 +-
drivers/video/fbdev/udlfb.c | 31 +-
fs/binfmt_elf.c | 2 +-
fs/btrfs/ioctl.c | 5 +-
fs/btrfs/space-info.c | 2 +-
fs/ceph/dir.c | 6 +-
fs/erofs/decompressor.c | 1 +
fs/erofs/dir.c | 28 +-
fs/ext2/inode.c | 14 +-
fs/ext4/extents.c | 15 +
fs/ext4/xattr.c | 6 +-
fs/f2fs/data.c | 32 +-
fs/f2fs/extent_cache.c | 17 +-
fs/f2fs/f2fs.h | 2 +-
fs/f2fs/inode.c | 2 +-
fs/f2fs/node.c | 17 +-
fs/f2fs/segment.c | 6 +-
fs/f2fs/super.c | 11 +-
fs/hfsplus/bfind.c | 51 ++++
fs/hfsplus/catalog.c | 4 +-
fs/hfsplus/dir.c | 2 +-
fs/hfsplus/hfsplus_fs.h | 9 +
fs/hfsplus/super.c | 6 +-
fs/isofs/export.c | 2 +-
fs/isofs/rock.c | 9 +
fs/notify/fsnotify.c | 2 +-
fs/notify/inotify/inotify_user.c | 1 +
fs/notify/mark.c | 18 +-
fs/ntfs3/run.c | 18 +-
fs/ocfs2/aops.c | 74 +++--
fs/smb/client/cached_dir.c | 8 +
fs/smb/client/cifsacl.c | 177 ++++++++---
fs/smb/client/cifsacl.h | 91 +-----
fs/smb/client/smb2inode.c | 12 +-
fs/smb/client/smb2misc.c | 3 +-
fs/smb/client/smb2ops.c | 11 +
fs/smb/common/smbacl.h | 122 ++++++++
fs/smb/server/connection.c | 28 +-
fs/smb/server/connection.h | 6 +-
fs/smb/server/smb2pdu.c | 4 +-
fs/smb/server/smbacl.c | 48 +--
fs/smb/server/smbacl.h | 113 +------
fs/smb/server/transport_rdma.c | 5 +
fs/smb/server/transport_tcp.c | 25 +-
fs/smb/server/vfs_cache.c | 40 ++-
fs/tracefs/event_inode.c | 14 +
fs/tracefs/inode.c | 5 +-
fs/tracefs/internal.h | 3 +
fs/udf/misc.c | 8 +-
fs/udf/super.c | 4 +-
fs/userfaultfd.c | 2 -
fs/xfs/xfs_buf.c | 1 +
include/linux/bpf_verifier.h | 31 +-
include/linux/damon.h | 2 +
include/linux/device.h | 45 +++
include/linux/f2fs_fs.h | 1 +
include/linux/fb.h | 4 +-
include/linux/fsnotify_backend.h | 1 +
include/linux/fwnode.h | 44 ++-
include/linux/mmap_lock.h | 6 +-
include/linux/mmc/card.h | 1 +
include/linux/padata.h | 4 -
include/linux/printk.h | 13 +
include/linux/randomize_kstack.h | 26 +-
include/linux/sched.h | 4 +
include/linux/tpm_eventlog.h | 9 +-
include/linux/usb.h | 3 +-
include/net/mana/mana.h | 1 +
include/net/mctp.h | 3 +
include/trace/events/rxrpc.h | 6 +-
include/video/udlfb.h | 1 +
init/main.c | 1 -
io_uring/poll.c | 14 +-
io_uring/timeout.c | 4 +
kernel/bpf/verifier.c | 236 +++++++++-----
kernel/exit.c | 3 +-
kernel/fork.c | 2 +
kernel/locking/rtmutex.c | 13 +-
kernel/padata.c | 136 +++------
kernel/regset.c | 6 +-
kernel/sched/core.c | 2 +-
kernel/sched/rt.c | 2 +-
kernel/sched/sched.h | 2 +-
kernel/taskstats.c | 1 +
kernel/trace/trace_probe.c | 6 +
kernel/trace/trace_probe.h | 4 +-
kernel/tracepoint.c | 2 +
lib/crypto/mpi/mpicoder.c | 2 +-
lib/scatterlist.c | 8 +-
lib/test_hmm.c | 86 +++---
lib/ts_kmp.c | 18 +-
mm/damon/core.c | 37 ++-
mm/damon/lru_sort.c | 88 ++++--
mm/damon/reclaim.c | 88 ++++--
mm/damon/sysfs-schemes.c | 12 +-
mm/hugetlb.c | 1 +
net/batman-adv/bat_iv_ogm.c | 85 ++++--
net/batman-adv/bridge_loop_avoidance.c | 11 +-
net/batman-adv/main.c | 1 +
net/batman-adv/tp_meter.c | 116 +++++--
net/batman-adv/tp_meter.h | 1 +
net/batman-adv/types.h | 4 +
net/bluetooth/hci_conn.c | 19 +-
net/bluetooth/hci_event.c | 47 ++-
net/bluetooth/l2cap_sock.c | 9 +
net/bluetooth/mgmt.c | 262 +++++++++++-----
net/bluetooth/mgmt_util.c | 46 +++
net/bluetooth/mgmt_util.h | 3 +
net/bridge/br_arp_nd_proxy.c | 8 +-
net/bridge/br_fdb.c | 28 +-
net/caif/cfsrvl.c | 14 +-
net/ceph/auth.c | 4 +-
net/ceph/mon_client.c | 2 +
net/core/flow_dissector.c | 13 +-
net/core/rtnetlink.c | 1 +
net/ipv4/ah4.c | 29 +-
net/ipv4/icmp.c | 8 +-
net/ipv4/inet_connection_sock.c | 3 +
net/ipv6/ah6.c | 27 +-
net/ipv6/exthdrs.c | 9 +-
net/ipv6/ip6_gre.c | 5 +-
net/ipv6/rpl_iptunnel.c | 9 +
net/ipv6/seg6_iptunnel.c | 12 +-
net/ipv6/xfrm6_protocol.c | 4 +-
net/mac80211/mlme.c | 9 +-
net/mac80211/rx.c | 2 +-
net/mctp/route.c | 8 +-
net/mptcp/protocol.c | 3 +-
net/mptcp/sockopt.c | 12 +-
net/mptcp/subflow.c | 4 +-
net/netfilter/nft_bitwise.c | 3 +-
net/openvswitch/vport-netdev.c | 6 +-
net/qrtr/ns.c | 86 +++++-
net/rds/message.c | 20 +-
net/rds/rdma.c | 4 -
net/rxrpc/ar-internal.h | 1 -
net/rxrpc/call_event.c | 27 +-
net/rxrpc/conn_event.c | 44 ++-
net/rxrpc/io_thread.c | 24 +-
net/rxrpc/rxkad.c | 112 +++----
net/rxrpc/skbuff.c | 9 -
net/sched/sch_red.c | 2 +-
net/sctp/socket.c | 9 +
net/smc/smc_clc.c | 4 +-
net/strparser/strparser.c | 8 +
net/unix/af_unix.c | 3 +
net/vmw_vsock/af_vsock.c | 6 +-
net/vmw_vsock/hyperv_transport.c | 4 +-
net/vmw_vsock/virtio_transport_common.c | 15 +-
net/xfrm/xfrm_state.c | 12 +-
net/xfrm/xfrm_user.c | 1 +
security/selinux/hooks.c | 3 +-
security/selinux/selinuxfs.c | 54 +---
sound/aoa/codecs/onyx.c | 104 ++-----
sound/aoa/codecs/tas.c | 113 +++----
sound/aoa/core/gpio-feature.c | 20 +-
sound/aoa/core/gpio-pmf.c | 26 +-
sound/aoa/soundbus/i2sbus/core.c | 12 +-
sound/aoa/soundbus/i2sbus/pcm.c | 143 ++++-----
sound/core/control.c | 4 +
sound/core/misc.c | 44 +--
sound/core/seq/oss/seq_oss_rw.c | 6 +-
sound/core/seq/seq_clientmgr.c | 9 +-
sound/core/seq/seq_clientmgr.h | 5 +-
sound/core/seq/seq_ump_client.c | 4 +-
sound/drivers/pcmtest.c | 19 +-
sound/firewire/tascam/tascam-hwdep.c | 1 +
sound/pci/ctxfi/ctatc.c | 3 +-
sound/pci/hda/cs35l56_hda.c | 19 +-
sound/soc/amd/yc/acp6x-mach.c | 14 +
sound/soc/fsl/fsl_easrc.c | 2 +-
sound/soc/intel/boards/bytcr_wm5102.c | 1 +
sound/soc/qcom/qdsp6/q6apm-dai.c | 1 +
sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 2 +-
sound/soc/qcom/qdsp6/q6apm.c | 3 +
sound/soc/sof/compress.c | 3 +
sound/usb/6fire/control.c | 10 +-
sound/usb/caiaq/control.c | 52 +++-
sound/usb/caiaq/device.c | 35 ++-
sound/usb/caiaq/input.c | 2 +-
sound/usb/endpoint.c | 6 +-
sound/usb/format.c | 2 +-
sound/usb/midi2.c | 9 +-
sound/usb/misc/ua101.c | 7 +
sound/usb/mixer.c | 7 +-
sound/usb/mixer_quirks.c | 12 +-
sound/usb/stream.c | 4 +-
tools/accounting/getdelays.c | 41 ++-
tools/accounting/procacct.c | 40 ++-
tools/testing/ktest/ktest.pl | 2 +-
.../selftests/bpf/progs/verifier_spill_fill.c | 281 +++++++++++++++++
.../bpf/progs/verifier_subprog_precision.c | 87 +++++-
tools/testing/selftests/bpf/verifier/precise.c | 38 ++-
.../testing/selftests/mqueue/{setting => settings} | 0
447 files changed, 5555 insertions(+), 2927 deletions(-)Greg Kroah-Hartman
maintainerPATCH 21/474 ocfs2: split transactions in dio completion to avoid credit exhaustion
6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heming Zhao <[email protected]>
commit d647c5b2fbf81560818dacade360abc8c00a9665 upstream.
During ocfs2 dio operations, JBD2 may report warnings via following
call trace:ocfs2_dio_end_io_write
ocfs2_mark_extent_written
ocfs2_change_extent_flag
ocfs2_split_extent
ocfs2_try_to_merge_extent
ocfs2_extend_rotate_transaction
ocfs2_extend_trans
jbd2__journal_restart
start_this_handle
output: JBD2: kworker/6:2 wants too many credits credits:5450 rsv_credits:0 max:5449
To prevent exceeding the credits limit, modify ocfs2_dio_end_io_write() to handle extents in a batch of transaction.
Additionally, relocate ocfs2_del_inode_from_orphan(). The orphan inode should only be removed from the orphan list after the extent tree update is complete. This ensures that if a crash occurs in the middle of extent tree updates, we won't leave stale blocks beyond EOF.
This patch also changes the logic for updating the inode size and removing orphan, making it similar to ext4_dio_write_end_io(). Both operations are performed only when everything looks good.
Finally, thanks to Jans and Joseph for providing the bug fix prototype and suggestions.
--- fs/ocfs2/aops.c | 74 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 29 deletions(-)
fs/ocfs2/aops.c +45 -29
@@ -37,6 +37,8 @@#include "namei.h" #include "sysfile.h" +#define OCFS2_DIO_MARK_EXTENT_BATCH 200 +static int ocfs2_symlink_get_block (struct inode *inode,sector_t iblock,struct buffer_head *bh_result,int create) {
@@ -2305,7 +2307,7 @@ static int ocfs2_dio_end_io_write(structstruct ocfs2_alloc_context *meta_ac =NULL ;handle_t *handle =NULL ;loff_t end = offset + bytes; -int ret =0 , credits =0 ; +int ret =0 , credits =0 , batch =0 ;ocfs2_init_dealloc_ctxt (&dealloc);
@@ -2322,18 +2324,6 @@ static int ocfs2_dio_end_io_write(struct goto out; } -/* Delete orphan before acquire i_rwsem. */ -if (dwc->dw_orphaned) { -BUG_ON (dwc->dw_writer_pid !=task_pid_nr (current)); - - end = end >i_size_read (inode) ? end :0 ; - - ret =ocfs2_del_inode_from_orphan (osb, inode, di_bh, - !!end, end); -if (ret <0 ) -mlog_errno (ret); - } -down_write (&oi->ip_alloc_sem); di = (struct ocfs2_dinode *)di_bh->b_data;
@@ -2354,24 +2344,25 @@ static int ocfs2_dio_end_io_write(struct credits =ocfs2_calc_extend_credits (inode->i_sb, &di->id2.i_list); - handle =ocfs2_start_trans (osb, credits); -if (IS_ERR (handle)) { - ret =PTR_ERR (handle); -mlog_errno (ret); - goto unlock; - } - ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), di_bh, -OCFS2_JOURNAL_ACCESS_WRITE ); -if (ret) { -mlog_errno (ret); - goto commit; - } -list_for_each_entry (ue, &dwc->dw_zero_list, ue_node) { +if (!handle) { + handle =ocfs2_start_trans (osb, credits); +if (IS_ERR (handle)) { + ret =PTR_ERR (handle); +mlog_errno (ret); + goto unlock; + } + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), di_bh, +OCFS2_JOURNAL_ACCESS_WRITE ); +if (ret) { +mlog_errno (ret); + goto commit; + } + } ret =ocfs2_assure_trans_credits (handle, credits);if (ret <0 ) {mlog_errno (ret); -break ; + goto commit; } ret = ocfs2_mark_extent_written(inode, &et, handle, ue->ue_cpos, 1,
@@ -2379,19 +2370,44 @@ static int ocfs2_dio_end_io_write(struct meta_ac, &dealloc);if (ret <0 ) {mlog_errno (ret); -break ; + goto commit; + } + +if (++batch ==OCFS2_DIO_MARK_EXTENT_BATCH ) { +ocfs2_commit_trans (osb, handle); + handle =NULL ; + batch =0 ; } }if (end >i_size_read (inode)) { +if (!handle) { + handle =ocfs2_start_trans (osb, credits); +if (IS_ERR (handle)) { + ret =PTR_ERR (handle); +mlog_errno (ret); + goto unlock; + } + } ret =ocfs2_set_inode_size (handle, inode, di_bh, end);if (ret <0 )mlog_errno (ret); } + commit: -ocfs2_commit_trans (osb, handle); +if (handle) +ocfs2_commit_trans (osb, handle); unlock:up_write (&oi->ip_alloc_sem); + +/* everything looks good, let's start the cleanup */ +if (!ret && dwc->dw_orphaned) { +BUG_ON (dwc->dw_writer_pid !=task_pid_nr (current)); + + ret =ocfs2_del_inode_from_orphan (osb, inode, di_bh,0 ,0 ); +if (ret <0 ) +mlog_errno (ret); + }ocfs2_inode_unlock (inode,1 );brelse (di_bh); out:
Greg Kroah-Hartman
maintainerPATCH 30/474 of: unittest: fix use-after-free in testdrv_probe()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit 07fd339b2c253205794bea5d9b4b7548a4546c56 upstream.
The function testdrv_probe() retrieves the device_node from the PCI device, applies an overlay, and then immediately calls of_node_put(dn). This releases the reference held by the PCI core, potentially freeing the node if the reference count drops to zero. Later, the same freed pointer 'dn' is passed to of_platform_default_populate(), leading to a use-after-free.
The reference to pdev->dev.of_node is owned by the device model and should not be released by the driver. Remove the erroneous of_node_put() to prevent premature freeing.
--- drivers/of/unittest.c | 1 - 1 file changed, 1 deletion(-)
drivers/of/unittest.c +0 -1
@@ -3862,7 +3862,6 @@ static int testdrv_probe(struct pci_dev size = info->dtbo_end - info->dtbo_begin; ret =of_overlay_fdt_apply (info->dtbo_begin, size, &ovcs_id, dn); -of_node_put (dn);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 31/474 media: amphion: Fix race between m2m job_abort and device_run
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Qian <[email protected]>
commit 8cd35ceadcfc8c5da2eb7f7ce24525ce9d4ee62e upstream.
Fix kernel panic caused by race condition where v4l2_m2m_ctx_release() frees m2m_ctx while v4l2_m2m_try_run() is about to call device_run with the same context.
Race sequence:
v4l2_m2m_try_run(): v4l2_m2m_ctx_release():
lock/unlock v4l2_m2m_cancel_job()
job_abort()
v4l2_m2m_job_finish()
kfree(m2m_ctx) <- frees ctx
device_run() <- use-after-free crash at 0x538Crash trace:
Unable to handle kernel read from unreadable memory at virtual address 0000000000000538 v4l2_m2m_try_run+0x78/0x138 v4l2_m2m_device_run_work+0x14/0x20
The amphion vpu driver does not rely on the m2m framework's device_run callback to perform encode/decode operations.
Fix the race by preventing m2m framework job scheduling entirely:
- Add job_ready callback returning 0 (no jobs ready for m2m framework)
- Remove job_abort callback to avoid the race condition
--- drivers/media/platform/amphion/vpu_v4l2.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/media/platform/amphion/vpu_v4l2.c +3 -6
@@ -441,17 +441,14 @@ static void vpu_m2m_device_run(void *pri { } -static void vpu_m2m_job_abort (void *priv) +static int vpu_m2m_job_ready (void *priv) { -struct vpu_inst *inst = priv; -struct v4l2_m2m_ctx *m2m_ctx = inst->fh.m2m_ctx; - -v4l2_m2m_job_finish (m2m_ctx->m2m_dev, m2m_ctx); +return 0 ; }static const struct v4l2_m2m_ops vpu_m2m_ops = { .device_run = vpu_m2m_device_run, - .job_abort = vpu_m2m_job_abort + .job_ready = vpu_m2m_job_ready, }; static int vpu_vb2_queue_setup(struct vb2_queue *vq,
Greg Kroah-Hartman
maintainerPATCH 32/474 ALSA: control: Validate buf_len before strnlen() in snd_ctl_elem_init_enum_names()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziqing Chen <[email protected]>
commit e0da8a8cac74f4b9f577979d131f0d2b88a84487 upstream.
snd_ctl_elem_init_enum_names() advances pointer p through the names buffer while decrementing buf_len. If buf_len reaches zero but items remain, the next iteration calls strnlen(p, 0).
While strnlen(p, 0) returns 0 and would hit the existing name_len == 0 error path, CONFIG_FORTIFY_SOURCE's fortified strnlen() first checks maxlen against __builtin_dynamic_object_size(). When Clang loses track of p's object size inside the loop, this triggers a BRK exception panic before the return value is examined.
Add a buf_len == 0 guard at the loop entry to prevent calling fortified strnlen() on an exhausted buffer.
Found by kernel fuzz testing through Xiaomi Smartphone.
--- sound/core/control.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/core/control.c +4 -0
@@ -1672,6 +1672,10 @@ static int snd_ctl_elem_init_enum_names(/* check that there are enough valid names */ p = names;for (i =0 ; i < ue->info.value.enumerated.items; ++i) { +if (buf_len ==0 ) { +kvfree (names); +return -EINVAL ; + } name_len =strnlen (p, buf_len);if (name_len ==0 || name_len >=64 || name_len == buf_len) {kvfree (names);
Greg Kroah-Hartman
maintainerPATCH 33/474 net: caif: clear client service pointer on teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchuan Liang <[email protected]>
commit f7cf8ece8cee3c1ee361991470cdb1eb65ab02e8 upstream.
caif_connect() can tear down an existing client after remote shutdown by calling caif_disconnect_client() followed by caif_free_client(). caif_free_client() releases the service layer referenced by adap_layer->dn, but leaves that pointer stale.
When the socket is later destroyed, caif_sock_destructor() calls caif_free_client() again and dereferences the freed service pointer.
Clear the client/service links before releasing the service object so repeated teardown becomes harmless.
--- net/caif/cfsrvl.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/caif/cfsrvl.c +12 -2
@@ -197,10 +197,20 @@ bool cfsrvl_phyid_match(struct cflayer *void caif_free_client (struct cflayer *adap_layer) { +struct cflayer *serv_layer;struct cfsrvl *servl; -if (adap_layer ==NULL || adap_layer->dn ==NULL ) + +if (!adap_layer) +return ; + + serv_layer = adap_layer->dn; +if (!serv_layer)return ; - servl =container_obj (adap_layer->dn); + +layer_set_dn (adap_layer,NULL ); +layer_set_up (serv_layer,NULL ); + + servl =container_obj (serv_layer); servl->release (&servl->layer); }EXPORT_SYMBOL (caif_free_client);
Greg Kroah-Hartman
maintainerPATCH 34/474 net: strparser: fix skb_head leak in strp_abort_strp()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luxiao Xu <[email protected]>
commit fe72340daaf1af588be88056faf98965f39e6032 upstream.
When the stream parser is aborted, for example after a message assembly timeout, it can still hold a reference to a partially assembled message in strp->skb_head.
That skb is not released in strp_abort_strp(), which leaks the partially assembled message and can be triggered repeatedly to exhaust memory.
Fix this by freeing strp->skb_head and resetting the parser state in the abort path. Leave strp_stop() unchanged so final cleanup still happens in strp_done() after the work and timer have been synchronized.
--- net/strparser/strparser.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/strparser/strparser.c +8 -0
@@ -45,6 +45,14 @@ static void strp_abort_strp(struct strpa strp->stopped =1 ; +if (strp->skb_head) { +kfree_skb (strp->skb_head); + strp->skb_head =NULL ; + } + + strp->skb_nextp =NULL ; + strp->need_bytes =0 ; +if (strp->sk) {struct sock *sk = strp->sk;
Greg Kroah-Hartman
maintainerPATCH 35/474 media: mtk-jpeg: fix use-after-free in release path due to uncancelled work
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fan Wu <[email protected]>
commit 34c519feef3e4fcff1078dc8bdb25fbbbd10303f upstream.
The mtk_jpeg_release() function frees the context structure (ctx) without first cancelling any pending or running work in ctx->jpeg_work. This creates a race window where the workqueue callback may still be accessing the context memory after it has been freed.
Race condition:
CPU 0 (release) CPU 1 (workqueue)
---------------- ------------------
close()
mtk_jpeg_release()
mtk_jpegenc_worker()
ctx = work->data
// accessing ctx
kfree(ctx) // freed!
access ctx // UAF!The work is queued via queue_work() during JPEG encode/decode operations (via mtk_jpeg_device_run). If the device is closed while work is pending or running, the work handler will access freed memory.
Fix this by calling cancel_work_sync() BEFORE acquiring the mutex. This ordering is critical: if cancel_work_sync() is called after mutex_lock(), and the work handler also tries to acquire the same mutex, it would cause a deadlock.
Note: The open error path does NOT need cancel_work_sync() because INIT_WORK() only initializes the work structure - it does not schedule it. Work is only scheduled later during ioctl operations.
--- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +1 -0
@@ -1214,6 +1214,7 @@ static int mtk_jpeg_release(struct filestruct mtk_jpeg_dev *jpeg =video_drvdata (file);struct mtk_jpeg_ctx *ctx =mtk_jpeg_fh_to_ctx (file->private_data); +cancel_work_sync (&ctx->jpeg_work);mutex_lock (&jpeg->lock);v4l2_m2m_ctx_release (ctx->fh.m2m_ctx);v4l2_ctrl_handler_free (&ctx->ctrl_hdl);
Greg Kroah-Hartman
maintainerPATCH 36/474 PCI: endpoint: pci-epf-ntb: Remove duplicate resource teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <[email protected]>
commit 3446beddba450c8d6f9aca2f028712ac527fead3 upstream.
epf_ntb_epc_destroy() duplicates the teardown that the caller is supposed to do later. This leads to an oops when .allow_link fails or when .drop_link is performed. Remove the helper.
Also drop pci_epc_put(). EPC device refcounting is tied to configfs EPC group lifetime, and pci_epc_put() in the .drop_link path is sufficient.
--- drivers/pci/endpoint/functions/pci-epf-ntb.c | 56 --------------------------- 1 file changed, 2 insertions(+), 54 deletions(-)
drivers/pci/endpoint/functions/pci-epf-ntb.c +2 -54
@@ -1495,47 +1495,6 @@ err_alloc_peer_mem: }/** -* epf_ntb_epc_destroy_interface() - Cleanup NTB EPC interface -* @ntb: NTB device that facilitates communication between HOST1 and HOST2 -* @type: PRIMARY interface or SECONDARY interface -* -* Unbind NTB function device from EPC and relinquish reference to pci_epc -* for each of the interface. -*/ -static void epf_ntb_epc_destroy_interface (struct epf_ntb *ntb, -enum pci_epc_interface_type type) -{ -struct epf_ntb_epc *ntb_epc; -struct pci_epc *epc; -struct pci_epf *epf; - -if (type <0 ) -return ; - - epf = ntb->epf; - ntb_epc = ntb->epc[type]; -if (!ntb_epc) -return ; - epc = ntb_epc->epc; -pci_epc_remove_epf (epc, epf, type); -pci_epc_put (epc); -} - -/** -* epf_ntb_epc_destroy() - Cleanup NTB EPC interface -* @ntb: NTB device that facilitates communication between HOST1 and HOST2 -* -* Wrapper for epf_ntb_epc_destroy_interface() to cleanup all the NTB interfaces -*/ -static void epf_ntb_epc_destroy (struct epf_ntb *ntb) -{ -enum pci_epc_interface_type type; - -for (type =PRIMARY_INTERFACE ; type <=SECONDARY_INTERFACE ; type++) -epf_ntb_epc_destroy_interface (ntb, type); -} - -/** * epf_ntb_epc_create_interface() - Create and initialize NTB EPC interface * @ntb: NTB device that facilitates communication between HOST1 and HOST2 * @epc: struct pci_epc to which a particular NTB interface should be associated
@@ -1614,15 +1573,8 @@ static int epf_ntb_epc_create(struct epf ret =epf_ntb_epc_create_interface (ntb, epf->sec_epc,SECONDARY_INTERFACE ); -if (ret) { +if (ret)dev_err (dev,"SECONDARY intf: Fail to create NTB EPC\n" ); - goto err_epc_create; - } - -return 0 ; - -err_epc_create: -epf_ntb_epc_destroy_interface (ntb,PRIMARY_INTERFACE );return ret; }
@@ -1887,7 +1839,7 @@ static int epf_ntb_bind(struct pci_epf * ret =epf_ntb_init_epc_bar (ntb);if (ret) {dev_err (dev,"Failed to create NTB EPC\n" ); - goto err_bar_init; +return ret; } ret =epf_ntb_config_spad_bar_alloc_interface (ntb);
@@ -1909,9 +1861,6 @@ static int epf_ntb_bind(struct pci_epf * err_bar_alloc:epf_ntb_config_spad_bar_free (ntb); -err_bar_init: -epf_ntb_epc_destroy (ntb); -return ret; }
@@ -1927,7 +1876,6 @@ static void epf_ntb_unbind(struct pci_epepf_ntb_epc_cleanup (ntb);epf_ntb_config_spad_bar_free (ntb); -epf_ntb_epc_destroy (ntb); }#define EPF_NTB_R (_name) \
Greg Kroah-Hartman
maintainerPATCH 37/474 Revert "ALSA: usb: Increase volume range that triggers a warning"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rong Zhang <[email protected]>
commit 41d78cb724f4b40b7548af420ccfe524b14023bb upstream.
UAC uses 2 bytes to store volume values, so the maximum volume range is 0xFFFF (65535, val = -32768/32767/1).
The reverted commit bumpped the range of triggering the warning to > 65535, effectively making the range check a no-op. It didn't fix anything but covered any potential problems and deviated from the original intention of the range check.
This reverts commit 6b971191fcfc9e3c2c0143eea22534f1f48dbb62.
--- sound/usb/mixer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/usb/mixer.c +4 -3
@@ -1814,10 +1814,11 @@ static void __build_feature_ctl(struct u range = (cval->max - cval->min) / cval->res;/* -* There are definitely devices with a range of ~20,000, so let's be -* conservative and allow for a bit more. +* Are there devices with volume range more than 255? I use a bit more +* to be sure. 384 is a resolution magic number found on Logitech +* devices. It will definitively catch all buggy Logitech devices. */ -if (range >65535 ) { +if (range >384 ) {usb_audio_warn (mixer->chip,"Warning! Unlikely big volume range (=%u), cval->res is probably wrong." , range);
Greg Kroah-Hartman
maintainerPATCH 38/474 lib/ts_kmp: fix integer overflow in pattern length calculation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Law <[email protected]>
commit 8cdf30813ea8ce881cecc08664144416dbdb3e16 upstream.
The ts_kmp algorithm stores its prefix_tbl[] table and pattern in a single allocation sized from the pattern length. If the prefix_tbl[] size calculation wraps, the resulting allocation can be too small and subsequent pattern copies can overflow it.
Fix this by rejecting zero-length patterns and by using overflow helpers before calculating the combined allocation size.
This fixes a potential heap overflow. The pattern length calculation can wrap during a size_t addition, leading to an undersized allocation. Because the textsearch library is reachable from userspace via Netfilter's xt_string module, this is a security risk that should be backported to LTS kernels.
--- lib/ts_kmp.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
lib/ts_kmp.c +16 -2
@@ -94,8 +94,22 @@ static struct ts_config *kmp_init(conststruct ts_config *conf;struct ts_kmp *kmp;int i; -unsigned int prefix_tbl_len = len *sizeof (unsigned int ); -size_t priv_size =sizeof (*kmp) + len + prefix_tbl_len; +unsigned int prefix_tbl_len; +size_t priv_size; + +/* Zero-length patterns would make kmp_find() read beyond kmp->pattern. */ +if (unlikely (!len)) +return ERR_PTR (-EINVAL ); + +/* +* kmp->pattern is stored immediately after the prefix_tbl[] table. +* Reject lengths that would wrap while sizing either region. +*/ +if (unlikely (check_mul_overflow (len,sizeof (*kmp->prefix_tbl), + &prefix_tbl_len) || +check_add_overflow (sizeof (*kmp), (size_t )len, &priv_size) || +check_add_overflow (priv_size, prefix_tbl_len, &priv_size))) +return ERR_PTR (-EINVAL ); conf =alloc_ts_config (priv_size, gfp_mask);if (IS_ERR (conf))
Greg Kroah-Hartman
maintainerPATCH 39/474 media: i2c: imx219: Check return value of devm_gpiod_get_optional() in imx219_probe()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
commit 943b1f27a3eead21b22e2531a5432ea5910b60eb upstream.
The devm_gpiod_get_optional() function may return an error pointer (ERR_PTR) in case of a genuine failure during GPIO acquisition, not just NULL which indicates the legitimate absence of an optional GPIO.
Add an IS_ERR() check after the function call to catch such errors and propagate them to the probe function, ensuring the driver fails to load safely rather than proceeding with an invalid pointer.
--- drivers/media/i2c/imx219.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/i2c/imx219.c +3 -0
@@ -1274,6 +1274,9 @@ static int imx219_probe(struct i2c_clien/* Request optional enable pin */ imx219->reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (imx219->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (imx219->reset_gpio), +"failed to get reset gpio\n" );/* * The sensor must be powered for imx219_identify_module()
Greg Kroah-Hartman
maintainerPATCH 22/474 driver core: Dont let a device probe until its ready
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit a2225b6e834a838ae3c93709760edc0a169eb2f2 ]
The moment we link a "struct device" into the list of devices for the bus, it's possible probe can happen. This is because another thread can load the driver at any time and that can cause the device to probe. This has been seen in practice with a stack crawl that looks like this [1]:
really_probe()
__driver_probe_device()
driver_probe_device()
__driver_attach()
bus_for_each_dev()
driver_attach()
bus_add_driver()
driver_register()
__platform_driver_register()
init_module() [some module]
do_one_initcall()
do_init_module()
load_module()
__arm64_sys_finit_module()
invoke_syscall()
As a result of the above, it was seen that device_links_driver_bound() could be called for the device before "dev->fwnode->dev" was assigned. This prevented __fw_devlink_pickup_dangling_consumers() from being called which meant that other devices waiting on our driver's sub-nodes were stuck deferring forever.
It's believed that this problem is showing up suddenly for two reasons:
1. Android has recently (last ~1 year) implemented an optimization to the order it loads modules [2]. When devices opt-in to this faster loading, modules are loaded one-after-the-other very quickly. This is unlike how other distributions do it. The reproduction of this problem has only been seen on devices that opt-in to Android's "parallel module loading".
2. Android devices typically opt-in to fw_devlink, and the most noticeable issue is the NULL "dev->fwnode->dev" in device_links_driver_bound(). fw_devlink is somewhat new code and also not in use by all Linux devices.
Even though the specific symptom where "dev->fwnode->dev" wasn't assigned could be fixed by moving that assignment higher in device_add(), other parts of device_add() (like the call to device_pm_add()) are also important to run before probe. Only moving the "dev->fwnode->dev" assignment would likely fix the current symptoms but lead to difficult-to-debug problems in the future.
Fix the problem by preventing probe until device_add() has run far enough that the device is ready to probe. If somehow we end up trying to probe before we're allowed, __driver_probe_device() will return -EPROBE_DEFER which will make certain the device is noticed.
In the race condition that was seen with Android's faster module loading, we will temporarily add the device to the deferred list and then take it off immediately when device_add() probes the device.
Instead of adding another flag to the bitfields already in "struct device", instead add a new "flags" field and use that. This allows us to freely change the bit from different thread without worrying about corrupting nearby bits (and means threads changing other bit won't corrupt us).
[1] Captured on a machine running a downstream 6.6 kernel
[2] https://cs.android.com/android/platform/superproject/main/+/main:system/core/libmodprobe/libmodprobe.cpp?q=LoadModulesParallel
--- drivers/base/core.c | 15 ++++++++++++++ drivers/base/dd.c | 20 +++++++++++++++++++ include/linux/device.h | 44 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+)
drivers/base/core.c +15 -0
@@ -3680,6 +3680,21 @@ int device_add(struct device *dev)fw_devlink_link_device (dev); } +/* +* The moment the device was linked into the bus's "klist_devices" in +* bus_add_device() then it's possible that probe could have been +* attempted in a different thread via userspace loading a driver +* matching the device. "ready_to_probe" being unset would have +* blocked those attempts. Now that all of the above initialization has +* happened, unblock probe. If probe happens through another thread +* after this point but before bus_probe_device() runs then it's fine. +* bus_probe_device() -> device_initial_probe() -> __device_attach() +* will notice (under device_lock) that the device is already bound. +*/ +device_lock (dev); +dev_set_ready_to_probe (dev); +device_unlock (dev); +bus_probe_device (dev);/*
drivers/base/dd.c +20 -0
@@ -785,6 +785,26 @@ static int __driver_probe_device(struct device_driver *drv, struct device *dev)if (dev->driver)return -EBUSY ; +/* +* In device_add(), the "struct device" gets linked into the subsystem's +* list of devices and broadcast to userspace (via uevent) before we're +* quite ready to probe. Those open pathways to driver probe before +* we've finished enough of device_add() to reliably support probe. +* Detect this and tell other pathways to try again later. device_add() +* itself will also try to probe immediately after setting +* "ready_to_probe". +*/ +if (!dev_ready_to_probe (dev)) +return dev_err_probe (dev, -EPROBE_DEFER ,"Device not ready to probe\n" ); + +/* +* Set can_match = true after calling dev_ready_to_probe(), so +* driver_deferred_probe_add() won't actually add the device to the +* deferred probe list when dev_ready_to_probe() returns false. +* +* When dev_ready_to_probe() returns false, it means that device_add() +* will do another probe() attempt for us. +*/ dev->can_match = true;pr_debug ("bus: '%s': %s: matched device %s with driver %s\n" , drv->bus->name, __func__,dev_name (dev), drv->name);
include/linux/device.h +44 -0
64 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 40/474 net: qrtr: ns: Fix use-after-free in driver remove()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
commit 7809fea20c9404bfcfa6112ec08d1fe1d3520beb upstream.
In the remove callback, if a packet arrives after destroy_workqueue() is called, but before sock_release(), the qrtr_ns_data_ready() callback will try to queue the work, causing use-after-free issue.
Fix this issue by saving the default 'sk_data_ready' callback during qrtr_ns_init() and use it to replace the qrtr_ns_data_ready() callback at the start of remove(). This ensures that even if a packet arrives after destroy_workqueue(), the work struct will not be dereferenced.
Note that it is also required to ensure that the RX threads are completed before destroying the workqueue, because the threads could be using the qrtr_ns_data_ready() callback.
--- net/qrtr/ns.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/qrtr/ns.c +11 -0
@@ -24,6 +24,7 @@ static struct {struct list_head lookups;struct workqueue_struct *workqueue;struct work_struct work; +void (*saved_data_ready)(struct sock *sk);int local_node; } qrtr_ns;
@@ -706,6 +707,7 @@ int qrtr_ns_init(void) goto err_sock; } + qrtr_ns.saved_data_ready = qrtr_ns.sock->sk->sk_data_ready; qrtr_ns.sock->sk->sk_data_ready = qrtr_ns_data_ready; sq.sq_port =QRTR_PORT_CTRL ;
@@ -746,6 +748,10 @@ int qrtr_ns_init(void)return 0 ; err_wq: +write_lock_bh (&qrtr_ns.sock->sk->sk_callback_lock); + qrtr_ns.sock->sk->sk_data_ready = qrtr_ns.saved_data_ready; +write_unlock_bh (&qrtr_ns.sock->sk->sk_callback_lock); +destroy_workqueue (qrtr_ns.workqueue); err_sock:sock_release (qrtr_ns.sock);
@@ -755,7 +761,12 @@ EXPORT_SYMBOL_GPL(qrtr_ns_init);void qrtr_ns_remove (void ) { +write_lock_bh (&qrtr_ns.sock->sk->sk_callback_lock); + qrtr_ns.sock->sk->sk_data_ready = qrtr_ns.saved_data_ready; +write_unlock_bh (&qrtr_ns.sock->sk->sk_callback_lock); +cancel_work_sync (&qrtr_ns.work); +synchronize_net ();destroy_workqueue (qrtr_ns.workqueue);/* sock_release() expects the two references that were put during
Greg Kroah-Hartman
maintainerPATCH 41/474 ext2: reject inodes with zero i_nlink and valid mode in ext2_iget()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
commit 25947cc5b2374cd5bf627fe3141496444260d04f upstream.
ext2_iget() already rejects inodes with i_nlink == 0 when i_mode is zero or i_dtime is set, treating them as deleted. However, the case of i_nlink == 0 with a non-zero mode and zero dtime slips through. Since ext2 has no orphan list, such a combination can only result from filesystem corruption - a legitimate inode deletion always sets either i_dtime or clears i_mode before freeing the inode.
A crafted image can exploit this gap to present such an inode to the VFS, which then triggers WARN_ON inside drop_nlink() (fs/inode.c) via ext2_unlink(), ext2_rename() and ext2_rmdir():
WARNING: CPU: 3 PID: 609 at fs/inode.c:336 drop_nlink+0xad/0xd0 fs/inode.c:336 CPU: 3 UID: 0 PID: 609 Comm: syz-executor Not tainted 6.12.77+ #1 Call Trace: <TASK> inode_dec_link_count include/linux/fs.h:2518 [inline] ext2_unlink+0x26c/0x300 fs/ext2/namei.c:295 vfs_unlink+0x2fc/0x9b0 fs/namei.c:4477 do_unlinkat+0x53e/0x730 fs/namei.c:4541 __x64_sys_unlink+0xc6/0x110 fs/namei.c:4587 do_syscall_64+0xf5/0x220 arch/x86/entry/common.c:78 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK> WARNING: CPU: 0 PID: 646 at fs/inode.c:336 drop_nlink+0xad/0xd0 fs/inode.c:336 CPU: 0 UID: 0 PID: 646 Comm: syz.0.17 Not tainted 6.12.77+ #1 Call Trace: <TASK> inode_dec_link_count include/linux/fs.h:2518 [inline] ext2_rename+0x35e/0x850 fs/ext2/namei.c:374 vfs_rename+0xf2f/0x2060 fs/namei.c:5021 do_renameat2+0xbe2/0xd50 fs/namei.c:5178 __x64_sys_rename+0x7e/0xa0 fs/namei.c:5223 do_syscall_64+0xf5/0x220 arch/x86/entry/common.c:78 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK> WARNING: CPU: 0 PID: 634 at fs/inode.c:336 drop_nlink+0xad/0xd0 fs/inode.c:336 CPU: 0 UID: 0 PID: 634 Comm: syz-executor Not tainted 6.12.77+ #1 Call Trace: <TASK> inode_dec_link_count include/linux/fs.h:2518 [inline] ext2_rmdir+0xca/0x110 fs/ext2/namei.c:311 vfs_rmdir+0x204/0x690 fs/namei.c:4348 do_rmdir+0x372/0x3e0 fs/namei.c:4407 __x64_sys_unlinkat+0xf0/0x130 fs/namei.c:4577 do_syscall_64+0xf5/0x220 arch/x86/entry/common.c:78 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK>
Extend the existing i_nlink == 0 check to also catch this case, reporting the corruption via ext2_error() and returning -EFSCORRUPTED. This rejects the inode at load time and prevents it from reaching any of the namei.c paths.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- fs/ext2/inode.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/ext2/inode.c +11 -3
@@ -1432,9 +1432,17 @@ struct inode *ext2_iget (struct super_bl* the test is that same one that e2fsck uses * NeilBrown 1999oct15 */ -if (inode->i_nlink ==0 && (inode->i_mode ==0 || ei->i_dtime)) { -/* this inode is deleted */ - ret = -ESTALE ; +if (inode->i_nlink ==0 ) { +if (inode->i_mode ==0 || ei->i_dtime) { +/* this inode is deleted */ + ret = -ESTALE ; + }else { +ext2_error (sb, __func__, +"inode %lu has zero i_nlink with mode 0%o and no dtime, " +"filesystem may be corrupt" , + ino, inode->i_mode); + ret = -EFSCORRUPTED ; + } goto bad_inode; } inode->i_blocks =le32_to_cpu (raw_inode->i_blocks);
Greg Kroah-Hartman
maintainerPATCH 42/474 ALSA: aoa: i2sbus: fix OF node lifetime handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit 4ec93f070eda6b765b62efcaed9241c3b3b0b6ad upstream.
i2sbus_add_dev() keeps the matched "sound" child pointer after for_each_child_of_node() has dropped the iterator reference. Take an extra reference before saving that node and drop it after the layout-id/device-id lookup is complete.
The function also stores np in dev->sound.ofdev.dev.of_node without taking a reference for the embedded soundbus device. Since i2sbus overrides the embedded platform device release callback, balance that reference explicitly in the local error path and in i2sbus_release_dev().
--- sound/aoa/soundbus/i2sbus/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
sound/aoa/soundbus/i2sbus/core.c +6 -3
@@ -83,6 +83,7 @@ static void i2sbus_release_dev(struct defor (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++)free_irq (i2sdev->interrupts[i], i2sdev);i2sbus_control_remove_dev (i2sdev->control, i2sdev); +of_node_put (i2sdev->sound.ofdev.dev.of_node);mutex_destroy (&i2sdev->lock);kfree (i2sdev); }
@@ -148,7 +149,6 @@ static int i2sbus_get_and_fixup_rsrc(str }/* Returns 1 if added, 0 for otherwise; don't return a negative value! */ -/* FIXME: look at device node refcounting */ static int i2sbus_add_dev (struct macio_dev *macio,struct i2sbus_control *control,struct device_node *np)
@@ -179,8 +179,9 @@ static int i2sbus_add_dev(struct macio_d i =0 ;for_each_child_of_node (np, child) {if (of_node_name_eq (child,"sound" )) { +of_node_put (sound); i++; - sound = child; + sound =of_node_get (child); } }if (i ==1 ) {
@@ -206,6 +207,7 @@ static int i2sbus_add_dev(struct macio_d } } } +of_node_put (sound);/* for the time being, until we can handle non-layout-id * things in some fabric, refuse to attach if there is no * layout-id property or we haven't been forced to attach.
@@ -220,7 +222,7 @@ static int i2sbus_add_dev(struct macio_dmutex_init (&dev->lock);spin_lock_init (&dev->low_lock); dev->sound.ofdev.archdata.dma_mask = macio->ofdev.archdata.dma_mask; - dev->sound.ofdev.dev.of_node = np; + dev->sound.ofdev.dev.of_node =of_node_get (np); dev->sound.ofdev.dev.dma_mask = &dev->sound.ofdev.archdata.dma_mask; dev->sound.ofdev.dev.parent = &macio->ofdev.dev; dev->sound.ofdev.dev.release = i2sbus_release_dev;
@@ -328,6 +330,7 @@ static int i2sbus_add_dev(struct macio_dfor (i=0 ;i<3 ;i++)release_and_free_resource (dev->allocated_resource[i]);mutex_destroy (&dev->lock); +of_node_put (dev->sound.ofdev.dev.of_node);kfree (dev);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 43/474 ALSA: ctxfi: Add fallback to default RSR for S/PDIF
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harin Lee <[email protected]>
commit 7d61662197ecdc458e33e475b6ada7f6da61d364 upstream.
spdif_passthru_playback_get_resources() uses atc->pll_rate as the RSR for the MSR calculation loop. However, pll_rate is only updated in atc_pll_init() and not in hw_pll_init(), so it remains 0 after the card init.
When spdif_passthru_playback_setup() skips atc_pll_init() for 32000 Hz, (rsr * desc.msr) always becomes 0, causing the loop to spin indefinitely.
Add fallback to use atc->rsr when atc->pll_rate is 0. This reflects the hardware state, since hw_card_init() already configures the PLL to the default RSR.
--- sound/pci/ctxfi/ctatc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ctxfi/ctatc.c +2 -1
@@ -791,7 +791,8 @@ static int spdif_passthru_playback_get_rstruct src *src;int err;int n_amixer = apcm->substream->runtime->channels, i; -unsigned int pitch, rsr = atc->pll_rate; +unsigned int pitch; +unsigned int rsr = atc->pll_rate ? atc->pll_rate : atc->rsr;/* first release old resources */ atc_pcm_release_resources (atc, apcm);
Greg Kroah-Hartman
maintainerPATCH 44/474 ALSA: seq_oss: return full count for successful SEQ_FULLSIZE writes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit bbc6c0dda54fc0ad8f8aed0b796c23e186e1a188 upstream.
snd_seq_oss_write() currently returns the raw load_patch() callback result for SEQ_FULLSIZE events.
That callback is documented as returning 0 on success and -errno on failure, but snd_seq_oss_write() is the file write path and should report the number of user bytes consumed on success. Some in-tree backends also return backend-specific positive values, which can still be shorter than the original write size.
Return the full byte count for successful SEQ_FULLSIZE writes. Preserve negative errors and convert any nonnegative completion to the original count.
--- sound/core/seq/oss/seq_oss_rw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/core/seq/oss/seq_oss_rw.c +3 -3
@@ -101,9 +101,9 @@ snd_seq_oss_write(struct seq_oss_devinfobreak ; } fmt = (*(unsigned short *)rec.c) &0xffff ; -/* FIXME the return value isn't correct */ -return snd_seq_oss_synth_load_patch (dp, rec.s.dev, - fmt, buf,0 , count); + err =snd_seq_oss_synth_load_patch (dp, rec.s.dev, + fmt, buf,0 , count); +return err <0 ? err : count; }if (ev_is_long (&rec)) {/* extended code */
Greg Kroah-Hartman
maintainerPATCH 45/474 erofs: fix the out-of-bounds nameoff handling for trailing dirents
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
commit d18a3b5d337fa412a38e776e6b4b857a58836575 upstream.
Currently we already have boundary-checks for nameoffs, but the trailing dirents are special since the namelens are calculated with strnlen() with unchecked nameoffs.
If a crafted EROFS has a trailing dirent with nameoff >= maxsize, maxsize - nameoff can underflow, causing strnlen() to read past the directory block.
nameoff0 should also be verified to be a multiple of sizeof(struct erofs_dirent) as well [1].
[1] https://sashiko.dev/#/patchset/20260416063511.3173774-1-hsiangkao%40linux.alibaba.com
--- fs/erofs/dir.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
fs/erofs/dir.c +15 -13
@@ -22,20 +22,18 @@ static int erofs_fill_dentries(struct in nameoff =le16_to_cpu (de->nameoff); de_name = (char *)dentry_blk + nameoff; -/* the last dirent in the block? */ -if (de +1 >= end) - de_namelen =strnlen (de_name, maxsize - nameoff); -else +/* non-trailing dirent in the directory block? */ +if (de +1 < end) de_namelen =le16_to_cpu (de[1 ].nameoff) - nameoff; +else if (maxsize <= nameoff) + goto err_bogus; +else + de_namelen =strnlen (de_name, maxsize - nameoff); -/* a corrupted entry is found */ -if (nameoff + de_namelen > maxsize || - de_namelen >EROFS_NAME_LEN ) { -erofs_err (dir->i_sb,"bogus dirent @ nid %llu" , -EROFS_I (dir)->nid); -DBG_BUGON (1 ); -return -EFSCORRUPTED ; - } +/* a corrupted entry is found (including negative namelen) */ +if (!in_range32 (de_namelen,1 ,EROFS_NAME_LEN ) || + nameoff + de_namelen > maxsize) + goto err_bogus;if (!dir_emit (ctx, de_name, de_namelen,le64_to_cpu (de->nid), d_type))
@@ -44,6 +42,10 @@ static int erofs_fill_dentries(struct in ctx->pos +=sizeof (struct erofs_dirent ); }return 0 ; +err_bogus: +erofs_err (dir->i_sb,"bogus dirent @ nid %llu" ,EROFS_I (dir)->nid); +DBG_BUGON (1 ); +return -EFSCORRUPTED ; }static int erofs_readdir (struct file *f,struct dir_context *ctx)
@@ -72,7 +74,7 @@ static int erofs_readdir(struct file *f, } nameoff =le16_to_cpu (de->nameoff); -if (nameoff <sizeof (struct erofs_dirent ) || nameoff >= bsz) { +if (!nameoff || nameoff >= bsz || (nameoff %sizeof (*de))) {erofs_err (sb,"invalid de[0].nameoff %u @ nid %llu" , nameoff,EROFS_I (dir)->nid); err = -EFSCORRUPTED ;
Greg Kroah-Hartman
maintainerPATCH 46/474 md/raid10: fix deadlock with check operation and nowait requests
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Hunt <[email protected]>
commit 7d96f3120a7fb7210d21b520c5b6f495da6ba436 upstream.
When an array check is running it will raise the barrier at which point normal requests will become blocked and increment the nr_pending value to signal there is work pending inside of wait_barrier(). NOWAIT requests do not block and so will return immediately with an error, and additionally do not increment nr_pending in wait_barrier(). Upstream change commit 43806c3d5b9b ("raid10: cleanup memleak at raid10_make_request") added a call to raid_end_bio_io() to fix a memory leak when NOWAIT requests hit this condition. raid_end_bio_io() eventually calls allow_barrier() and it will unconditionally do an atomic_dec_and_test(&conf->nr_pending) even though the corresponding increment on nr_pending didn't happen in the NOWAIT case.
This can be easily seen by starting a check operation while an application is doing nowait IO on the same array. This results in a deadlocked state due to nr_pending value underflowing and so the md resync thread gets stuck waiting for nr_pending to == 0.
Output of r10conf state of the array when we hit this condition:
crash> struct r10conf
barrier = 1,
nr_pending = {
counter = -41
},
nr_waiting = 15,
nr_queued = 0,Example of md_sync thread stuck waiting on raise_barrier() and other requests stuck in wait_barrier():
md1_resync
[<0>] raise_barrier+0xce/0x1c0 [<0>] raid10_sync_request+0x1ca/0x1ed0 [<0>] md_do_sync+0x779/0x1110 [<0>] md_thread+0x90/0x160 [<0>] kthread+0xbe/0xf0 [<0>] ret_from_fork+0x34/0x50 [<0>] ret_from_fork_asm+0x1a/0x30
kworker/u1040:2+flush-253:4
[<0>] wait_barrier+0x1de/0x220 [<0>] regular_request_wait+0x30/0x180 [<0>] raid10_make_request+0x261/0x1000 [<0>] md_handle_request+0x13b/0x230 [<0>] __submit_bio+0x107/0x1f0 [<0>] submit_bio_noacct_nocheck+0x16f/0x390 [<0>] ext4_io_submit+0x24/0x40 [<0>] ext4_do_writepages+0x254/0xc80 [<0>] ext4_writepages+0x84/0x120 [<0>] do_writepages+0x7a/0x260 [<0>] __writeback_single_inode+0x3d/0x300 [<0>] writeback_sb_inodes+0x1dd/0x470 [<0>] __writeback_inodes_wb+0x4c/0xe0 [<0>] wb_writeback+0x18b/0x2d0 [<0>] wb_workfn+0x2a1/0x400 [<0>] process_one_work+0x149/0x330 [<0>] worker_thread+0x2d2/0x410 [<0>] kthread+0xbe/0xf0 [<0>] ret_from_fork+0x34/0x50 [<0>] ret_from_fork_asm+0x1a/0x30
--- drivers/md/raid10.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/raid10.c +2 -2
@@ -1204,7 +1204,7 @@ static void raid10_read_request(struct m }if (!regular_request_wait (mddev, conf, bio, r10_bio->sectors)) { -raid_end_bio_io (r10_bio); +free_r10bio (r10_bio);return ; }
@@ -1425,7 +1425,7 @@ static void raid10_write_request(struct sectors = r10_bio->sectors;if (!regular_request_wait (mddev, conf, bio, sectors)) { -raid_end_bio_io (r10_bio); +free_r10bio (r10_bio);return ; }
Greg Kroah-Hartman
maintainerPATCH 47/474 mfd: stpmic1: Attempt system shutdown twice in case PMIC is confused
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit ffdc5c51f8bcd0e5e8255ca275a0a3b958475d99 upstream.
Attempt to shut down again, in case the first attempt failed. The STPMIC1 might get confused and the first regmap_update_bits() returns with -ETIMEDOUT / -110 . If that or similar transient failure occurs, try to shut down again. If the second attempt fails, there is some bigger problem, report it to user.
--- drivers/mfd/stpmic1.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/mfd/stpmic1.c +18 -2
@@ -16,6 +16,8 @@#include <dt-bindings/mfd/st,stpmic1.h> +#define STPMIC1_MAX_RETRIES 2 +#define STPMIC1_MAIN_IRQ 0static const struct regmap_range stpmic1_readable_ranges[] = {
@@ -121,9 +123,23 @@ static const struct regmap_irq_chip stpmstatic int stpmic1_power_off (struct sys_off_data *data) {struct stpmic1 *ddata = data->cb_data; +int ret; + +/* +* Attempt to shut down again, in case the first attempt failed. +* The STPMIC1 might get confused and the first regmap_update_bits() +* returns with -ETIMEDOUT / -110 . If that or similar transient +* failure occurs, try to shut down again. If the second attempt +* fails, there is some bigger problem, report it to user. +*/ +for (int retries =0 ; retries <STPMIC1_MAX_RETRIES ; retries++) { + ret =regmap_update_bits (ddata->regmap,MAIN_CR ,SOFTWARE_SWITCH_OFF , +SOFTWARE_SWITCH_OFF ); +if (!ret) +return NOTIFY_DONE ; + } -regmap_update_bits (ddata->regmap,MAIN_CR , -SOFTWARE_SWITCH_OFF ,SOFTWARE_SWITCH_OFF ); +dev_err (ddata->dev,"Failed to access PMIC I2C bus (%d)\n" , ret);return NOTIFY_DONE ; }
Greg Kroah-Hartman
maintainerPATCH 48/474 nvme-pci: add NVME_QUIRK_DISABLE_WRITE_ZEROES for Kingston OM3SGP4
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Beckett <[email protected]>
commit a8eebf9699d69987cc49cec4e4fdb4111ab32423 upstream.
The Kingston OM3SGP42048K2-A00 (PCI ID 2646:502f) firmware has a race condition when processing concurrent write zeroes and DSM (discard) commands, causing spurious "LBA Out of Range" errors and IOMMU page faults at address 0x0.
The issue is reliably triggered by running two concurrent mkfs commands on different partitions of the same drive, which generates interleaved write zeroes and discard operations.
Disable write zeroes for this device, matching the pattern used for other Kingston OM* drives that have similar firmware issues.
--- drivers/nvme/host/pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/pci.c +2 -0
@@ -3589,6 +3589,8 @@ static const struct pci_device_id nvme_i .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, { PCI_DEVICE(0x2646, 0x501E), /* KINGSTON OM3PGP4xxxxQ OS21011 NVMe SSD */ .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, + { PCI_DEVICE(0x2646, 0x502F), /* KINGSTON OM3SGP4xxxxK NVMe SSD */ + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, { PCI_DEVICE(0x1f40, 0x1202), /* Netac Technologies Co. NV3000 NVMe SSD */ .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1f40, 0x5236), /* Netac Technologies Co. NV7000 NVMe SSD */
Greg Kroah-Hartman
maintainerPATCH 49/474 nvme: respect NVME_QUIRK_DISABLE_WRITE_ZEROES when wzsl is set
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Beckett <[email protected]>
commit 40f0496b617b431f8d2dd94d7f785c1121f8a68a upstream.
The NVM Command Set Identify Controller data may report a non-zero Write Zeroes Size Limit (wzsl). When present, nvme_init_non_mdts_limits() unconditionally overrides max_zeroes_sectors from wzsl, even if NVME_QUIRK_DISABLE_WRITE_ZEROES previously set it to zero.
This effectively re-enables write zeroes for devices that need it disabled, defeating the quirk. Several Kingston OM* drives rely on this quirk to avoid firmware issues with write zeroes commands.
Check for the quirk before applying the wzsl override.
--- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -2943,7 +2943,7 @@ static int nvme_init_non_mdts_limits(strif (id->dmrl) ctrl->max_discard_segments = id->dmrl; ctrl->dmrsl =le32_to_cpu (id->dmrsl); -if (id->wzsl) +if (id->wzsl && !(ctrl->quirks &NVME_QUIRK_DISABLE_WRITE_ZEROES )) ctrl->max_zeroes_sectors =nvme_mps_to_sectors (ctrl, id->wzsl); free_data:
Greg Kroah-Hartman
maintainerPATCH 23/474 LoongArch: Add spectre boundry for syscall dispatch table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
[ Upstream commit 0c965d2784fbbd7f8e3b96d875c9cfdf7c00da3d ]
The LoongArch syscall number is directly controlled by userspace, but does not have a array_index_nospec() boundry to prevent access past the syscall function pointer tables.
--- arch/loongarch/kernel/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/loongarch/kernel/syscall.c +2 -1
@@ -9,6 +9,7 @@#include <linux/entry-common.h> #include <linux/errno.h> #include <linux/linkage.h> +#include <linux/nospec.h> #include <linux/syscalls.h> #include <linux/unistd.h>
@@ -55,7 +56,7 @@ void noinstr do_syscall(struct pt_regs *regs) nr =syscall_enter_from_user_mode (regs, nr);if (nr < NR_syscalls) { - syscall_fn = sys_call_table[nr]; + syscall_fn = sys_call_table[array_index_nospec (nr, NR_syscalls)]; regs->regs[4 ] =syscall_fn (regs->orig_a0, regs->regs[5 ], regs->regs[6 ], regs->regs[7 ], regs->regs[8 ], regs->regs[9 ]); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 50/474 parisc: _llseek syscall is only available for 32-bit userspace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit da3680f564bd787ce974f9931e6e924d908b3b2a upstream.
--- arch/parisc/kernel/syscalls/syscall.tbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/syscalls/syscall.tbl +1 -1
@@ -154,7 +154,7 @@ # 137 was afs_syscall 138 common setfsuid sys_setfsuid 139 common setfsgid sys_setfsgid -140 common _llseek sys_llseek +140 32 _llseek sys_llseek 141 common getdents sys_getdents compat_sys_getdents 142 common _newselect sys_select compat_sys_select 143 common flock sys_flock
Greg Kroah-Hartman
maintainerPATCH 51/474 remoteproc: xlnx: Only access buffer information if IPI is buffered
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Levinsky <[email protected]>
commit 38dd6ccfdfbbe865569a52fe1ba9fa1478f672e6 upstream.
In the receive callback check if message is NULL to prevent possibility of crash by NULL pointer dereferencing.
--- drivers/remoteproc/xlnx_r5_remoteproc.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/remoteproc/xlnx_r5_remoteproc.c +11 -9
@@ -179,17 +179,19 @@ static void zynqmp_r5_mb_rx_cb(struct mb ipi = container_of(cl, struct mbox_info, mbox_cl); -/* copy data from ipi buffer to r5_core */ +/* copy data from ipi buffer to r5_core if IPI is buffered. */ ipi_msg = (struct zynqmp_ipi_message *)msg; - buf_msg = (struct zynqmp_ipi_message *)ipi->rx_mc_buf; - len = ipi_msg->len; -if (len >IPI_BUF_LEN_MAX ) { -dev_warn (cl->dev,"msg size exceeded than %d\n" , -IPI_BUF_LEN_MAX ); - len =IPI_BUF_LEN_MAX ; +if (ipi_msg) { + buf_msg = (struct zynqmp_ipi_message *)ipi->rx_mc_buf; + len = ipi_msg->len; +if (len >IPI_BUF_LEN_MAX ) { +dev_warn (cl->dev,"msg size exceeded than %d\n" , +IPI_BUF_LEN_MAX ); + len =IPI_BUF_LEN_MAX ; + } + buf_msg->len = len; +memcpy (buf_msg->data, ipi_msg->data, len); } - buf_msg->len = len; -memcpy (buf_msg->data, ipi_msg->data, len);/* received and processed interrupt ack */ if (mbox_send_message (ipi->rx_chan,NULL ) <0 )
Greg Kroah-Hartman
maintainerPATCH 52/474 selftests/mqueue: Fix incorrectly named file
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Liebold <[email protected]>
commit 64fac99037689020ad97e472ae898e96ea3616dc upstream.
Commit 85506aca2eb4 ("selftests/mqueue: Set timeout to 180 seconds") intended to increase the timeout for mq_perf_tests from the default kselftest limit of 45 seconds to 180 seconds.
Unfortunately, the file storing this information was incorrectly named setting instead of settings, causing the kselftest runner not to pick up the limit and keep using the default 45 seconds limit.
Fix this by renaming it to settings to ensure that the kselftest runner uses the increased timeout of 180 seconds for this test.
---
tools/testing/selftests/mqueue/{setting => settings} | 0
tools/testing/selftests/mqueue/setting | 1 -
tools/testing/selftests/mqueue/settings | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
rename tools/testing/selftests/mqueue/{setting => settings} (100%)tools/testing/selftests/mqueue/setting deleted +0 -1
@@ -1 +0,0 @@ -timeout=180
tools/testing/selftests/mqueue/settings new file +1 -0
@@ -0,0 +1 @@ +timeout=180
Greg Kroah-Hartman
maintainerPATCH 53/474 rbd: fix null-ptr-deref when device_add_disk() fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dawei Feng <[email protected]>
commit d1fef92e414433ca7b89abf85cb0df42b8d475eb upstream.
do_rbd_add() publishes the device with device_add() before calling device_add_disk(). If device_add_disk() fails after device_add() succeeds, the error path calls rbd_free_disk() directly and then later falls through to rbd_dev_device_release(), which calls rbd_free_disk() again. This double teardown can leave blk-mq cleanup operating on invalid state and trigger a null-ptr-deref in __blk_mq_free_map_and_rqs(), reached from blk_mq_free_tag_set().
Fix this by following the normal remove ordering: call device_del() before rbd_dev_device_release() when device_add_disk() fails after device_add(). That keeps the teardown sequence consistent and avoids re-entering disk cleanup through the wrong path.
The bug was first flagged by an experimental analysis tool we are developing for kernel memory-management bugs while analyzing v6.13-rc1. The tool is still under development and is not yet publicly available.
We reproduced the bug on v7.0 with a real Ceph backend and a QEMU x86_64 guest booted with KASAN and CONFIG_FAILSLAB enabled. The reproducer confines failslab injections to the __add_disk() range and injects fail-nth while mapping an RBD image through /sys/bus/rbd/add_single_major.
On the unpatched kernel, fail-nth=4 reliably triggered the fault:
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 0 UID: 0 PID: 273 Comm: bash Not tainted 7.0.0-01247-gd60bc1401583 #6 PREEMPT(lazy) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014 RIP: 0010:__blk_mq_free_map_and_rqs+0x8c/0x240 Code: 00 00 48 8b 6b 60 41 89 f4 49 c1 e4 03 4c 01 e5 45 85 ed 0f 85 0a 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 e9 48 c1 e9 03 <80> 3c 01 00 0f 85 31 01 00 00 4c 8b 6d 00 4d 85 ed 0f 84 e2 00 00 RSP: 0018:ff1100000ab0fac8 EFLAGS: 00000246 RAX: dffffc0000000000 RBX: ff1100000c4806a0 RCX: 0000000000000000 RDX: 0000000000000002 RSI: 0000000000000000 RDI: ff1100000c4806f4 RBP: 0000000000000000 R08: 0000000000000001 R09: ffe21c000189001b R10: ff1100000c4800df R11: ff1100006cf37be0 R12: 0000000000000000 R13: 0000000000000000 R14: ff1100000c480700 R15: ff1100000c480004 FS: 00007f0fbe8fe740(0000) GS:ff110000e5851000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fe53473b2e0 CR3: 0000000012eef000 CR4: 00000000007516f0 PKRU: 55555554 Call Trace: <TASK> blk_mq_free_tag_set+0x77/0x460 do_rbd_add+0x1446/0x2b80 ? __pfx_do_rbd_add+0x10/0x10 ? lock_acquire+0x18c/0x300 ? find_held_lock+0x2b/0x80 ? sysfs_file_kobj+0xb6/0x1b0 ? __pfx_sysfs_kf_write+0x10/0x10 kernfs_fop_write_iter+0x2f4/0x4a0 vfs_write+0x98e/0x1000 ? expand_files+0x51f/0x850 ? __pfx_vfs_write+0x10/0x10 ksys_write+0xf2/0x1d0 ? __pfx_ksys_write+0x10/0x10 do_syscall_64+0x115/0x690 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f0fbea15907 Code: 10 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24 RSP: 002b:00007ffe22346ea8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000058 RCX: 00007f0fbea15907 RDX: 0000000000000058 RSI: 0000563ace6c0ef0 RDI: 0000000000000001 RBP: 0000563ace6c0ef0 R08: 0000563ace6c0ef0 R09: 6b6435726d694141 R10: 5250337279762f78 R11: 0000000000000246 R12: 0000000000000058 R13: 00007f0fbeb1c780 R14: ff1100000c480700 R15: ff1100000c480004 </TASK>
With this fix applied, rerunning the reproducer over fail-nth=1..256 yields no KASAN reports.
[ idryomov: rename err_out_device_del -> err_out_device ]
--- drivers/block/rbd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/rbd.c +3 -3
@@ -7172,7 +7172,7 @@ static ssize_t do_rbd_add(const char *bu rc =device_add_disk (&rbd_dev->dev, rbd_dev->disk,NULL );if (rc) - goto err_out_cleanup_disk; + goto err_out_device;spin_lock (&rbd_dev_list_lock);list_add_tail (&rbd_dev->node, &rbd_dev_list);
@@ -7186,8 +7186,8 @@ out:module_put (THIS_MODULE );return rc; -err_out_cleanup_disk: -rbd_free_disk (rbd_dev); +err_out_device: +device_del (&rbd_dev->dev); err_out_image_lock:rbd_dev_image_unlock (rbd_dev);rbd_dev_device_release (rbd_dev);
Greg Kroah-Hartman
maintainerPATCH 54/474 io_uring/timeout: check unused sqe fields
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit 484ae637a3e3d909718de7c07afd3bb34b6b8504 upstream.
Zero check unused SQE fields addr3 and pad2 for timeout and timeout update requests. They're not needed now, but could be used sometime in the future.
--- io_uring/timeout.c | 4 ++++ 1 file changed, 4 insertions(+)
io_uring/timeout.c +4 -0
@@ -428,6 +428,8 @@ int io_timeout_remove_prep(struct io_kioif (unlikely (req->flags & (REQ_F_FIXED_FILE |REQ_F_BUFFER_SELECT )))return -EINVAL ; +if (sqe->addr3 || sqe->__pad2[0 ]) +return -EINVAL ;if (sqe->buf_index || sqe->len || sqe->splice_fd_in)return -EINVAL ;
@@ -500,6 +502,8 @@ static int __io_timeout_prep(struct io_kunsigned flags;u32 off =READ_ONCE (sqe->off); +if (sqe->addr3 || sqe->__pad2[0 ]) +return -EINVAL ;if (sqe->buf_index || sqe->len !=1 || sqe->splice_fd_in)return -EINVAL ;if (off && is_timeout_link)
Greg Kroah-Hartman
maintainerPATCH 55/474 iio: adc: ti-ads7950: use iio_push_to_buffers_with_ts_unaligned()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
commit 7806c060cceb2d6895efbb6cff2f2f17cf1ec5de upstream.
Use iio_push_to_buffers_with_ts_unaligned() to avoid unaligned access when writing the timestamp in the rx_buf.
The previous implementation would have been fine on architectures that support 4-byte alignment of 64-bit integers but could cause issues on architectures that require 8-byte alignment.
--- drivers/iio/adc/ti-ads7950.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/iio/adc/ti-ads7950.c +5 -6
@@ -47,8 +47,6 @@#define TI_ADS7950_MAX_CHAN 16#define TI_ADS7950_NUM_GPIOS 4 -#define TI_ADS7950_TIMESTAMP_SIZE (sizeof(int64_t) / sizeof(__be16)) -/* val = value, dec = left shift, bits = number of bits of the mask */ #define TI_ADS7950_EXTRACT (val, dec, bits) \ (((val) >> (dec)) & ((1 << (bits)) - 1))
@@ -105,8 +103,7 @@ struct ti_ads7950_state {* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ -u16 rx_buf[TI_ADS7950_MAX_CHAN +2 +TI_ADS7950_TIMESTAMP_SIZE ] -__aligned(IIO_DMA_MINALIGN) ; +u16 rx_buf[TI_ADS7950_MAX_CHAN +2 ]__aligned(IIO_DMA_MINALIGN) ;u16 tx_buf[TI_ADS7950_MAX_CHAN +2 ];u16 single_tx;u16 single_rx;
@@ -313,8 +310,10 @@ static irqreturn_t ti_ads7950_trigger_haif (ret <0 ) goto out; -iio_push_to_buffers_with_timestamp (indio_dev, &st->rx_buf[2 ], -iio_get_time_ns (indio_dev)); +iio_push_to_buffers_with_ts_unaligned (indio_dev, &st->rx_buf[2 ], +sizeof (*st->rx_buf) * +TI_ADS7950_MAX_CHAN , +iio_get_time_ns (indio_dev)); out:mutex_unlock (&st->slock);
Greg Kroah-Hartman
maintainerPATCH 56/474 io_uring/poll: fix signed comparison in io_poll_get_ownership()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Longxuan Yu <[email protected]>
commit 326941b22806cbf2df1fbfe902b7908b368cce42 upstream.
io_poll_get_ownership() uses a signed comparison to check whether poll_refs has reached the threshold for the slowpath:
if (unlikely(atomic_read(&req->poll_refs) >= IO_POLL_REF_BIAS))
atomic_read() returns int (signed). When IO_POLL_CANCEL_FLAG (BIT(31)) is set in poll_refs, the value becomes negative in signed arithmetic, so the >= 128 comparison always evaluates to false and the slowpath is never taken.
Fix this by casting the atomic_read() result to unsigned int before the comparison, so that the cancel flag is treated as a large positive value and correctly triggers the slowpath.
--- io_uring/poll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/poll.c +1 -1
@@ -91,7 +91,7 @@ static bool io_poll_get_ownership_slowpa*/ static inline bool io_poll_get_ownership (struct io_kiocb *req) { -if (unlikely (atomic_read (&req->poll_refs) >=IO_POLL_REF_BIAS )) +if (unlikely ((unsigned int )atomic_read (&req->poll_refs) >=IO_POLL_REF_BIAS ))return io_poll_get_ownership_slowpath (req);return !(atomic_fetch_inc (&req->poll_refs) &IO_POLL_REF_MASK ); }
Greg Kroah-Hartman
maintainerPATCH 57/474 io_uring/poll: ensure EPOLL_ONESHOT is propagated for EPOLL_URING_WAKE
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit 1967f0b1cafdde37aa9e08e6021c14bcc484b7a5 upstream.
Commit:
aacf2f9f382c ("io_uring: fix req->apoll_events")
fixed an issue where poll->events and req->apoll_events weren't synchronized, but then when the commit referenced in Fixes got added, it didn't ensure the same thing.
If we mask in EPOLLONESHOT in the regular EPOLL_URING_WAKE path, then ensure it's done for both. Including a link to the original report below, even though it's mostly nonsense. But it includes a reproducer that does show that IORING_CQE_F_MORE is set in the previous CQE, while no more CQEs will be generated for this request. Just ignore anything that pretends this is security related in any way, it's just the typical AI nonsense.
--- io_uring/poll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
io_uring/poll.c +3 -1
@@ -441,8 +441,10 @@ static int io_poll_wake(struct wait_queu* disable multishot as there is a circular dependency between * CQ posting and triggering the event. */ -if (mask &EPOLL_URING_WAKE ) +if (mask &EPOLL_URING_WAKE ) { poll->events |=EPOLLONESHOT ; + req->apoll_events |=EPOLLONESHOT ; + }/* optional, saves extra locking for removal in tw handler */ if (mask && poll->events &EPOLLONESHOT ) {
Greg Kroah-Hartman
maintainerPATCH 58/474 ALSA: core: Fix potential data race at fasync handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 8146cd333d235ed32d48bb803fdf743472d7c783 upstream.
In snd_fasync_work_fn(), which is the offload work for traversing and processing the pending fasync list, the call of kill_fasync() is done outside the snd_fasync_lock for avoiding deadlocks. The problem is that its the references of fasync->on, fasync->signal and fasync->poll are done there also outside the lock. Since these may be modified by snd_kill_fasync() call concurrently from other process, inconsistent values might be passed to kill_fasync(). Although there shouldn't be critical UAF, it's still better to be addressed.
This patch moves the kill_fasync() argument evaluations inside the snd_fasync_lock for avoiding the data races above. The handling in fasync->on flag is optimized in the loop to skip directly.
Also, for more clarity, snd_fasync_free() takes the lock and unlink the pending entry more directly instead of clearing fasync->on flag.
--- sound/core/misc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
sound/core/misc.c +10 -3
@@ -171,14 +171,18 @@ static LIST_HEAD(snd_fasync_list);static void snd_fasync_work_fn (struct work_struct *work) {struct snd_fasync *fasync; +int signal, poll;spin_lock_irq (&snd_fasync_lock);while (!list_empty (&snd_fasync_list)) { fasync = list_first_entry(&snd_fasync_list, struct snd_fasync, list);list_del_init (&fasync->list); +if (!fasync->on) +continue ; + signal = fasync->signal; + poll = fasync->poll;spin_unlock_irq (&snd_fasync_lock); -if (fasync->on) -kill_fasync (&fasync->fasync, fasync->signal, fasync->poll); +kill_fasync (&fasync->fasync, signal, poll);spin_lock_irq (&snd_fasync_lock); }spin_unlock_irq (&snd_fasync_lock);
@@ -234,7 +238,10 @@ void snd_fasync_free(struct snd_fasync * {if (!fasync)return ; - fasync->on =0 ; + + scoped_guard(spinlock_irq, &snd_fasync_lock) +list_del_init (&fasync->list); +flush_work (&snd_fasync_work);kfree (fasync); }
Greg Kroah-Hartman
maintainerPATCH 59/474 ALSA: caiaq: Fix control_put() result and cache rollback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit a3542d1b30f92307f545f2def14e8d988dffdff0 upstream.
control_put() always returns 1 and updates cdev->control_state[] before sending the USB command. It also ignores transport errors from usb_bulk_msg(), snd_usb_caiaq_send_command(), and snd_usb_caiaq_send_command_bank().
That breaks the ALSA .put() contract and can leave control_get() reporting a cached value the device never accepted.
Return 0 for unchanged values, propagate transport failures, and restore the cached byte when the write fails.
--- sound/usb/caiaq/control.c | 54 +++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 17 deletions(-)
sound/usb/caiaq/control.c +37 -17
@@ -87,6 +87,7 @@ static int control_put(struct snd_kcontrstruct snd_usb_caiaqdev *cdev =caiaqdev (chip->card);int pos = kcontrol->private_value;int v = ucontrol->value.integer.value[0 ]; +int ret;unsigned char cmd;switch (cdev->chip.usb_id) {
@@ -103,6 +104,10 @@ static int control_put(struct snd_kcontrif (pos &CNT_INTVAL ) {int i = pos & ~CNT_INTVAL ; +unsigned char old = cdev->control_state[i]; + +if (old == v) +return 0 ; cdev->control_state[i] = v;
@@ -113,10 +118,11 @@ static int control_put(struct snd_kcontr cdev->ep8_out_buf[0 ] = i; cdev->ep8_out_buf[1 ] = v; -usb_bulk_msg (cdev->chip.dev, -usb_sndbulkpipe (cdev->chip.dev,8 ), - cdev->ep8_out_buf,sizeof (cdev->ep8_out_buf), - &actual_len,200 ); + ret =usb_bulk_msg (cdev->chip.dev, +usb_sndbulkpipe (cdev->chip.dev,8 ), + cdev->ep8_out_buf, +sizeof (cdev->ep8_out_buf), + &actual_len,200 ); }else if (cdev->chip.usb_id ==USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_MASCHINECONTROLLER )) {
@@ -128,21 +134,36 @@ static int control_put(struct snd_kcontr offset =MASCHINE_BANK_SIZE ; } -snd_usb_caiaq_send_command_bank (cdev, cmd, bank, - cdev->control_state + offset, -MASCHINE_BANK_SIZE ); + ret =snd_usb_caiaq_send_command_bank (cdev, cmd, bank, + cdev->control_state + offset, +MASCHINE_BANK_SIZE ); }else { -snd_usb_caiaq_send_command (cdev, cmd, - cdev->control_state,sizeof (cdev->control_state)); + ret =snd_usb_caiaq_send_command (cdev, cmd, + cdev->control_state, +sizeof (cdev->control_state)); } - }else { -if (v) - cdev->control_state[pos /8 ] |=1 << (pos %8 ); -else - cdev->control_state[pos /8 ] &= ~(1 << (pos %8 )); -snd_usb_caiaq_send_command (cdev, cmd, - cdev->control_state,sizeof (cdev->control_state)); +if (ret <0 ) { + cdev->control_state[i] = old; +return ret; + } + }else { +int idx = pos /8 ; +unsigned char mask =1 << (pos %8 ); +unsigned char old = cdev->control_state[idx]; +unsigned char val = v ? (old | mask) : (old & ~mask); + +if (old == val) +return 0 ; + + cdev->control_state[idx] = val; + ret =snd_usb_caiaq_send_command (cdev, cmd, + cdev->control_state, +sizeof (cdev->control_state)); +if (ret <0 ) { + cdev->control_state[idx] = old; +return ret; + } }return 1 ;
@@ -640,4 +661,3 @@ int snd_usb_caiaq_control_init(struct snreturn ret; } -
Greg Kroah-Hartman
maintainerPATCH 24/474 zram: do not forget to endio for partial discard requests
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Senozhatsky <[email protected]>
commit e3668b371329ea036ff022ce8ecc82f8befcf003 upstream.
As reported by Qu Wenruo and Avinesh Kumar, the following
getconf PAGESIZE
65536
blkdiscard -p 4k /dev/zram0
takes literally forever to complete. zram doesn't support partial discards and just returns immediately w/o doing any discard work in such cases. The problem is that we forget to endio on our way out, so blkdiscard sleeps forever in submit_bio_wait(). Fix this by jumping to end_bio label, which does bio_endio().
--- drivers/block/zram/zram_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/zram/zram_drv.c +2 -1
@@ -1880,7 +1880,7 @@ static void zram_bio_discard(struct zram*/ if (offset) {if (n <= (PAGE_SIZE - offset)) -return ; + goto end_bio; n -= (PAGE_SIZE - offset); index++;
@@ -1895,6 +1895,7 @@ static void zram_bio_discard(struct zram n -=PAGE_SIZE ; } +end_bio:bio_endio (bio); }
Greg Kroah-Hartman
maintainerPATCH 60/474 ALSA: caiaq: Handle probe errors properly
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 28abd224db4a49560b452115bca3672a20e45b2f upstream.
The probe procedure of setup_card() in caiaq driver doesn't treat the error cases gracefully, e.g. the error from snd_card_register() calls snd_card_free() but continues. This would lead to a UAF for the further calls like snd_usb_caiaq_control_init(), as Berk suggested in another patch in the link below.
However, the problem is not only that; in general, this function drops the all error handlings (as it's a void function) although its caller can propagate an error to snd_probe(), which eventually calls snd_card_free() as a proper error path. That said, we should treat each error case in setup_card(), and just return the error code promptly, which is then handled later as a fatal error in snd_probe().
This patch achieves it by changing the setup_card() to return an error code. Also, the superfluous snd_card_free() call is removed, too.
Note that card->private_free can be set still safely at returning an error. All called functions in card_free() have checks of the unassigned resources or NULL checks.
--- sound/usb/caiaq/device.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-)
sound/usb/caiaq/device.c +24 -9
@@ -290,7 +290,7 @@ int snd_usb_caiaq_set_auto_msg(struct sn tmp, sizeof(tmp)); } -static void setup_card (struct snd_usb_caiaqdev *cdev) +static int setup_card (struct snd_usb_caiaqdev *cdev) {int ret;char val[4 ];
@@ -325,8 +325,10 @@ static void setup_card(struct snd_usb_casnd_usb_caiaq_send_command (cdev,EP1_CMD_READ_IO ,NULL ,0 );if (!wait_event_timeout (cdev->ep1_wait_queue, - cdev->control_state[0 ] !=0xff ,HZ )) -return ; + cdev->control_state[0 ] !=0xff ,HZ )) { +dev_err (dev,"Read timeout for control state\n" ); +return -EINVAL ; + }/* fix up some defaults */ if ((cdev->control_state[1] != 2) ||
@@ -347,33 +349,43 @@ static void setup_card(struct snd_usb_ca cdev->spec.num_digital_audio_out + cdev->spec.num_digital_audio_in > 0) { ret =snd_usb_caiaq_audio_init (cdev); -if (ret <0 ) +if (ret <0 ) {dev_err (dev,"Unable to set up audio system (ret=%d)\n" , ret); +return ret; + } }if (cdev->spec.num_midi_in + cdev->spec.num_midi_out >0 ) { ret =snd_usb_caiaq_midi_init (cdev); -if (ret <0 ) +if (ret <0 ) {dev_err (dev,"Unable to set up MIDI system (ret=%d)\n" , ret); +return ret; + } }#ifdef CONFIG_SND_USB_CAIAQ_INPUT ret =snd_usb_caiaq_input_init (cdev); -if (ret <0 ) +if (ret <0 ) {dev_err (dev,"Unable to set up input system (ret=%d)\n" , ret); +return ret; + }#endif /* finally, register the card and all its sub-instances */ ret =snd_card_register (cdev->chip.card);if (ret <0 ) {dev_err (dev,"snd_card_register() returned %d\n" , ret); -snd_card_free (cdev->chip.card); +return ret; } ret =snd_usb_caiaq_control_init (cdev); -if (ret <0 ) +if (ret <0 ) {dev_err (dev,"Unable to set up control system (ret=%d)\n" , ret); +return ret; + } + +return 0 ; }static void card_free (struct snd_card *card)
@@ -499,8 +511,11 @@ static int init_card(struct snd_usb_caiascnprintf (card->longname,sizeof (card->longname),"%s %s (%s)" , cdev->vendor_name, cdev->product_name, usbpath); -setup_card (cdev); card->private_free = card_free; + err =setup_card (cdev); +if (err <0 ) +return err; +return 0 ; err_kill_urb:
Greg Kroah-Hartman
maintainerPATCH 61/474 ALSA: 6fire: Fix input volume change detection
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit dc88eef8f55e85e92d016cdf7e291f5560efd79b upstream.
usb6fire_control_input_vol_put() stores the analog capture volume as a signed offset in rt->input_vol[] (-15..+15), but it compares the cached value against the user-visible mixer value (0..30) before subtracting 15.
This mixes two domains in the change detection path. Since the runtime is zero-initialized, the visible default is 15; writing 0 right after probe is ignored, while writing 15 is reported as a change even though the cached value remains 0.
Normalize the user value before comparing it with the cached offset.
--- sound/usb/6fire/control.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
sound/usb/6fire/control.c +6 -4
@@ -290,15 +290,17 @@ static int usb6fire_control_input_vol_pu struct snd_ctl_elem_value *ucontrol) {struct control_runtime *rt =snd_kcontrol_chip (kcontrol); +int vol0 = ucontrol->value.integer.value[0 ] -15 ; +int vol1 = ucontrol->value.integer.value[1 ] -15 ;int changed =0 ; -if (rt->input_vol[0 ] != ucontrol->value.integer.value[0 ]) { - rt->input_vol[0 ] = ucontrol->value.integer.value[0 ] -15 ; +if (rt->input_vol[0 ] != vol0) { + rt->input_vol[0 ] = vol0; rt->ivol_updated &= ~(1 <<0 ); changed =1 ; } -if (rt->input_vol[1 ] != ucontrol->value.integer.value[1 ]) { - rt->input_vol[1 ] = ucontrol->value.integer.value[1 ] -15 ; +if (rt->input_vol[1 ] != vol1) { + rt->input_vol[1 ] = vol1; rt->ivol_updated &= ~(1 <<1 ); changed =1 ; }
Greg Kroah-Hartman
maintainerPATCH 62/474 ALSA: pcmtest: fix reference leak on failed device registration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <[email protected]>
commit 4ff036f95238f02c87e5d7c0a9d93748582a8950 upstream.
When platform_device_register() fails in mod_init(), the embedded struct device in pcmtst_pdev has already been initialized by device_initialize(), but the failure path returns the error without dropping the device reference for the current platform device:
mod_init()
-> platform_device_register(&pcmtst_pdev)
-> device_initialize(&pcmtst_pdev.dev)
-> setup_pdev_dma_masks(&pcmtst_pdev)
-> platform_device_add(&pcmtst_pdev)This leads to a reference leak when platform_device_register() fails. Fix this by calling platform_device_put() before returning the error.
The issue was identified by a static analysis tool I developed and confirmed by manual review.
--- sound/drivers/pcmtest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/drivers/pcmtest.c +3 -1
@@ -755,8 +755,10 @@ static int __init mod_init(void)if (err)return err; err =platform_device_register (&pcmtst_pdev); -if (err) +if (err) { +platform_device_put (&pcmtst_pdev);return err; + } err =platform_driver_register (&pcmtst_pdrv);if (err)platform_device_unregister (&pcmtst_pdev);
Greg Kroah-Hartman
maintainerPATCH 63/474 ALSA: pcmtest: Fix resource leaks in module init error paths
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit d5d5f80416a3a749906c04d56575e2290792654b upstream.
pcmtest allocates its pattern buffers and creates its debugfs tree before registering the platform device and driver, but mod_init() does not release those resources when a later init step fails.
As a result, a debugfs directory creation failure leaks the pattern buffers, while platform_device_register() and platform_driver_register() failures leave both the pattern buffers and the debugfs tree behind. The recent fix for failed device registration only dropped the embedded device reference.
Add the missing cleanup for the debugfs tree and pattern buffers in the remaining module init error paths.
--- sound/drivers/pcmtest.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
sound/drivers/pcmtest.c +12 -3
@@ -753,15 +753,24 @@ static int __init mod_init(void) err =init_debug_files (buf_allocated);if (err) -return err; + goto err_free_patterns; err =platform_device_register (&pcmtst_pdev);if (err) {platform_device_put (&pcmtst_pdev); -return err; + goto err_clear_debug; } err =platform_driver_register (&pcmtst_pdrv); -if (err) +if (err) {platform_device_unregister (&pcmtst_pdev); + goto err_clear_debug; + } + +return 0 ; + +err_clear_debug: +clear_debug_files (); +err_free_patterns: +free_pattern_buffers ();return err; }
Greg Kroah-Hartman
maintainerPATCH 64/474 iio: adc: ad7768-1: fix one-shot mode data acquisition
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Santos <[email protected]>
commit 8be19e233744961db6069da9c9ab63eb085a0447 upstream.
According to the datasheet, one-shot mode requires a SYNC_IN pulse to trigger a new sample conversion. In the current implementation, No sync pulse was sent after switching to one-shot mode and reinit_completion() was called before mode switching, creating a race condition where spurious interrupts during mode change could trigger completion prematurely.
Fix by sending a sync pulse after configuring one-shot mode and reinit_completion() to ensure it only waits for the actual conversion completion.
--- drivers/iio/adc/ad7768-1.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/iio/adc/ad7768-1.c +7 -2
@@ -241,12 +241,17 @@ static int ad7768_scan_direct(struct iiostruct ad7768_state *st =iio_priv (indio_dev);int readval, ret; -reinit_completion (&st->completion); - ret =ad7768_set_mode (st,AD7768_ONE_SHOT );if (ret <0 )return ret; +reinit_completion (&st->completion); + +/* One-shot mode requires a SYNC pulse to generate a new sample */ + ret =ad7768_send_sync_pulse (st); +if (ret) +return ret; + ret =wait_for_completion_timeout (&st->completion,msecs_to_jiffies (1000 ));if (!ret)
Greg Kroah-Hartman
maintainerPATCH 25/474 wifi: rtw88: check for PCI upstream bridge existence
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit eb101d2abdcccb514ca4fccd3b278dd8267374f6 upstream.
pci_upstream_bridge() returns NULL if the device is on a root bus. If 8821CE is installed in the system with such a PCI topology, the probing routine will crash. This has probably been unnoticed as 8821CE is mostly supplied in laptops where there is a PCI-to-PCI bridge located upstream from the device. However the card might be installed on a system with different configuration.
Check if the bridge does exist for the specific workaround to be applied.
Found by Linux Verification Center (linuxtesting.org) with Svace static analysis tool.
--- drivers/net/wireless/realtek/rtw88/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/pci.c +2 -1
@@ -1749,7 +1749,8 @@ int rtw_pci_probe(struct pci_dev *pdev, }/* Disable PCIe ASPM L1 while doing NAPI poll for 8821CE */ -if (rtwdev->chip->id ==RTW_CHIP_TYPE_8821C && bridge->vendor ==PCI_VENDOR_ID_INTEL ) +if (rtwdev->chip->id ==RTW_CHIP_TYPE_8821C && + bridge && bridge->vendor ==PCI_VENDOR_ID_INTEL ) rtwpci->rx_no_aspm = true;rtw_pci_phy_cfg (rtwdev);
Greg Kroah-Hartman
maintainerPATCH 26/474 um: drivers: call kernel_strrchr() explicitly in cow_user.c
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
commit 91e901c65b4da02a6fd543e3f0049829ae9645b7 upstream.
Building ARCH=um on glibc >= 2.43 fails:
arch/um/drivers/cow_user.c: error: implicit declaration of function 'strrchr' [-Wimplicit-function-declaration]
glibc 2.43's C23 const-preserving strrchr() macro does not survive UML's global -Dstrrchr=kernel_strrchr remap from arch/um/Makefile. Call kernel_strrchr() directly in cow_user.c so the source no longer depends on the -D rewrite.
--- arch/um/drivers/cow_user.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/um/drivers/cow_user.c +7 -1
@@ -15,6 +15,12 @@#include "cow.h" #include "cow_sys.h" +/* +* arch/um/Makefile remaps strrchr to kernel_strrchr; call the kernel +* name directly to avoid glibc >= 2.43's C23 strrchr macro. +*/ +char *kernel_strrchr (const char *,int ); +#define PATH_LEN_V1 256/* unsigned time_t works until year 2106 */
@@ -153,7 +159,7 @@ static int absolutize(char *to, int size errno);return -1 ; } - slash =strrchr (from,'/' ); + slash =kernel_strrchr (from,'/' );if (slash !=NULL ) { *slash ='\0' ;if (chdir (from)) {
Greg Kroah-Hartman
maintainerPATCH 27/474 spi: imx: fix use-after-free on unbind
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 1c78c2002380a1fe31bfb01a3d5f29809e55a096 upstream.
The SPI subsystem frees the controller and any subsystem allocated driver data as part of deregistration (unless the allocation is device managed).
Take another reference before deregistering the controller so that the driver data is not freed until the driver is done with it.
--- drivers/spi/spi-imx.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/spi/spi-imx.c +4 -0
@@ -1898,6 +1898,8 @@ static void spi_imx_remove(struct platfostruct spi_imx_data *spi_imx =spi_controller_get_devdata (controller);int ret; +spi_controller_get (controller); +spi_unregister_controller (controller); ret =pm_runtime_get_sync (spi_imx->dev);
@@ -1911,6 +1913,8 @@ static void spi_imx_remove(struct platfopm_runtime_disable (spi_imx->dev);spi_imx_sdma_exit (spi_imx); + +spi_controller_put (controller); }static int __maybe_unused spi_imx_runtime_resume (struct device *dev)
Greg Kroah-Hartman
maintainerPATCH 28/474 f2fs: fix to detect potential corrupted nid in free_nid_list
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 8fc6056dcf79937c46c97fa4996cda65956437a9 ]
As reported, on-disk footer.ino and footer.nid is the same and out-of-range, let's add sanity check on f2fs_alloc_nid() to detect any potential corruption in free_nid_list.
--- fs/f2fs/node.c | 17 ++++++++++++++++- include/linux/f2fs_fs.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-)
fs/f2fs/node.c +16 -1
@@ -27,12 +27,17 @@ static struct kmem_cache *free_nid_slab;static struct kmem_cache *nat_entry_set_slab;static struct kmem_cache *fsync_node_entry_slab; +static inline bool is_invalid_nid (struct f2fs_sb_info *sbi,nid_t nid) +{ +return nid <F2FS_ROOT_INO (sbi) || nid >=NM_I (sbi)->max_nid; +} +/* * Check whether the given nid is within node id range. */ int f2fs_check_nid_range (struct f2fs_sb_info *sbi,nid_t nid) { -if (unlikely (nid <F2FS_ROOT_INO (sbi) || nid >=NM_I (sbi)->max_nid)) { +if (unlikely (is_invalid_nid (sbi, nid))) {set_sbi_flag (sbi,SBI_NEED_FSCK );f2fs_warn (sbi,"%s: out-of-range nid=%x, run fsck to fix." , __func__, nid);
@@ -2603,6 +2608,16 @@ bool f2fs_alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid)f2fs_bug_on (sbi,list_empty (&nm_i->free_nid_list)); i =list_first_entry (&nm_i->free_nid_list, struct free_nid, list); + +if (unlikely (is_invalid_nid (sbi, i->nid))) { +spin_unlock (&nm_i->nid_list_lock); +f2fs_err (sbi,"Corrupted nid %u in free_nid_list" , + i->nid); +f2fs_stop_checkpoint (sbi, false, +STOP_CP_REASON_CORRUPTED_NID ); +return false; + } + *nid = i->nid;__move_free_nid (sbi, i,FREE_NID ,PREALLOC_NID );
include/linux/f2fs_fs.h +1 -0
@@ -77,6 +77,7 @@ enum stop_cp_reason {STOP_CP_REASON_UPDATE_INODE ,STOP_CP_REASON_FLUSH_FAIL ,STOP_CP_REASON_NO_SEGMENT , +STOP_CP_REASON_CORRUPTED_NID , STOP_CP_REASON_MAX, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 29/474 crypto: pcrypt - Fix handling of MAY_BACKLOG requests
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit 915b692e6cb723aac658c25eb82c58fd81235110 upstream.
MAY_BACKLOG requests can return EBUSY. Handle them by checking for that value and filtering out EINPROGRESS notifications.
--- crypto/pcrypt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
crypto/pcrypt.c +5 -2
@@ -69,6 +69,9 @@ static void pcrypt_aead_done(void *data,struct pcrypt_request *preq =aead_request_ctx (req);struct padata_priv *padata =pcrypt_request_padata (preq); +if (err == -EINPROGRESS ) +return ; + padata->info = err;padata_do_serial (padata);
@@ -82,7 +85,7 @@ static void pcrypt_aead_enc(struct padat ret =crypto_aead_encrypt (req); -if (ret == -EINPROGRESS ) +if (ret == -EINPROGRESS || ret == -EBUSY )return ; padata->info = ret;
@@ -133,7 +136,7 @@ static void pcrypt_aead_dec(struct padat ret =crypto_aead_decrypt (req); -if (ret == -EINPROGRESS ) +if (ret == -EINPROGRESS || ret == -EBUSY )return ; padata->info = ret;
Greg Kroah-Hartman
maintainerPATCH 20/474 device property: Make modifications of fwnode "flags" thread safe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit f72e77c33e4b5657af35125e75bab249256030f3 upstream.
In various places in the kernel, we modify the fwnode "flags" member by doing either:
fwnode->flags |= SOME_FLAG;
fwnode->flags &= ~SOME_FLAG;
This type of modification is not thread-safe. If two threads are both mucking with the flags at the same time then one can clobber the other.
While flags are often modified while under the "fwnode_link_lock", this is not universally true.
Create some accessor functions for setting, clearing, and testing the FWNODE flags and move all users to these accessor functions. New accessor functions use set_bit() and clear_bit(), which are thread-safe.
[ Fix fwnode_clear_flag() argument alignment, restore dropped blank
line in fwnode_dev_initialized(), and remove unnecessary parentheses around fwnode_test_flag() calls. - Danilo ]
--- drivers/base/core.c | 24 ++++++++++++------------ drivers/bus/imx-weim.c | 2 +- drivers/i2c/i2c-core-of.c | 2 +- drivers/net/phy/mdio_bus.c | 4 ++-- drivers/of/base.c | 2 +- drivers/of/dynamic.c | 2 +- drivers/of/platform.c | 2 +- drivers/spi/spi.c | 2 +- include/linux/fwnode.h | 44 +++++++++++++++++++++++++++++++++----------- 9 files changed, 53 insertions(+), 31 deletions(-)
drivers/base/core.c +12 -12
@@ -182,7 +182,7 @@ void fw_devlink_purge_absent_suppliers(sif (fwnode->dev)return ; - fwnode->flags |=FWNODE_FLAG_NOT_DEVICE ; +fwnode_set_flag (fwnode,FWNODE_FLAG_NOT_DEVICE );fwnode_links_purge_consumers (fwnode);fwnode_for_each_available_child_node (fwnode, child)
@@ -228,7 +228,7 @@ static void __fw_devlink_pickup_danglingif (fwnode->dev && fwnode->dev->bus)return ; - fwnode->flags |=FWNODE_FLAG_NOT_DEVICE ; +fwnode_set_flag (fwnode,FWNODE_FLAG_NOT_DEVICE );__fwnode_links_move_consumers (fwnode, new_sup);fwnode_for_each_available_child_node (fwnode, child)
@@ -1013,7 +1013,7 @@ static void device_links_missing_suppliestatic bool dev_is_best_effort (struct device *dev) {return (fw_devlink_best_effort && dev->can_match) || - (dev->fwnode && (dev->fwnode->flags &FWNODE_FLAG_BEST_EFFORT )); + (dev->fwnode &&fwnode_test_flag (dev->fwnode,FWNODE_FLAG_BEST_EFFORT )); } static struct fwnode_handle *fwnode_links_check_suppliers(
@@ -1729,11 +1729,11 @@ bool fw_devlink_is_strict(void)static void fw_devlink_parse_fwnode (struct fwnode_handle *fwnode) { -if (fwnode->flags &FWNODE_FLAG_LINKS_ADDED ) +if (fwnode_test_flag (fwnode,FWNODE_FLAG_LINKS_ADDED ))return ;fwnode_call_int_op (fwnode, add_links); - fwnode->flags |=FWNODE_FLAG_LINKS_ADDED ; +fwnode_set_flag (fwnode,FWNODE_FLAG_LINKS_ADDED ); }static void fw_devlink_parse_fwtree (struct fwnode_handle *fwnode)
@@ -1892,7 +1892,7 @@ static bool fwnode_init_without_drv(strustruct device *dev;bool ret; -if (!(fwnode->flags &FWNODE_FLAG_INITIALIZED )) +if (!fwnode_test_flag (fwnode,FWNODE_FLAG_INITIALIZED ))return false; dev =get_dev_from_fwnode (fwnode);
@@ -1951,10 +1951,10 @@ static bool __fw_devlink_relax_cycles(st* We aren't trying to find all cycles. Just a cycle between con and * sup_handle. */ -if (sup_handle->flags &FWNODE_FLAG_VISITED ) +if (fwnode_test_flag (sup_handle,FWNODE_FLAG_VISITED ))return false; - sup_handle->flags |=FWNODE_FLAG_VISITED ; +fwnode_set_flag (sup_handle,FWNODE_FLAG_VISITED );/* Termination condition. */ if (sup_handle == con_handle) {
@@ -2024,7 +2024,7 @@ static bool __fw_devlink_relax_cycles(st } out: - sup_handle->flags &= ~FWNODE_FLAG_VISITED ; +fwnode_clear_flag (sup_handle,FWNODE_FLAG_VISITED );put_device (sup_dev);put_device (con_dev);put_device (par_dev);
@@ -2077,7 +2077,7 @@ static int fw_devlink_create_devlink(str* When such a flag is set, we can't create device links where P is the * supplier of C as that would delay the probe of C. */ -if (sup_handle->flags &FWNODE_FLAG_NEEDS_CHILD_BOUND_ON_ADD && +if (fwnode_test_flag (sup_handle,FWNODE_FLAG_NEEDS_CHILD_BOUND_ON_ADD ) &&fwnode_is_ancestor_of (sup_handle, con->fwnode))return -EINVAL ;
@@ -2100,7 +2100,7 @@ static int fw_devlink_create_devlink(strelse flags =FW_DEVLINK_FLAGS_PERMISSIVE ; -if (sup_handle->flags &FWNODE_FLAG_NOT_DEVICE ) +if (fwnode_test_flag (sup_handle,FWNODE_FLAG_NOT_DEVICE )) sup_dev =fwnode_get_next_parent_dev (sup_handle);else sup_dev =get_dev_from_fwnode (sup_handle);
@@ -2112,7 +2112,7 @@ static int fw_devlink_create_devlink(str* supplier device indefinitely. */ if (sup_dev->links.status ==DL_DEV_NO_DRIVER && - sup_handle->flags &FWNODE_FLAG_INITIALIZED ) { +fwnode_test_flag (sup_handle,FWNODE_FLAG_INITIALIZED )) {dev_dbg (con,"Not linking %pfwf - dev might never probe\n" , sup_handle);
drivers/bus/imx-weim.c +1 -1
@@ -335,7 +335,7 @@ static int of_weim_notify(struct notifie* fw_devlink doesn't skip adding consumers to this * device. */ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; +fwnode_clear_flag (&rd->dn->fwnode,FWNODE_FLAG_NOT_DEVICE );if (!of_platform_device_create (rd->dn,NULL , &pdev->dev)) { dev_err(&pdev->dev, "Failed to create child device '%pOF'\n",
drivers/i2c/i2c-core-of.c +1 -1
@@ -182,7 +182,7 @@ static int of_i2c_notify(struct notifier* Clear the flag before adding the device so that fw_devlink * doesn't skip adding consumers to this device. */ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; +fwnode_clear_flag (&rd->dn->fwnode,FWNODE_FLAG_NOT_DEVICE ); client =of_i2c_register_device (adap, rd->dn);if (IS_ERR (client)) { dev_err(&adap->dev, "failed to create client for '%pOF'\n",
drivers/net/phy/mdio_bus.c +2 -2
@@ -675,8 +675,8 @@ int __mdiobus_register(struct mii_bus *breturn -EINVAL ;if (bus->parent && bus->parent->of_node) - bus->parent->of_node->fwnode.flags |= -FWNODE_FLAG_NEEDS_CHILD_BOUND_ON_ADD ; +fwnode_set_flag (&bus->parent->of_node->fwnode, +FWNODE_FLAG_NEEDS_CHILD_BOUND_ON_ADD ); WARN(bus->state != MDIOBUS_ALLOCATED && bus->state != MDIOBUS_UNREGISTERED,
drivers/of/base.c +1 -1
@@ -1759,7 +1759,7 @@ void of_alias_scan(void * (*dt_alloc)(u6if (name) of_stdout =of_find_node_opts_by_path (name, &of_stdout_options);if (of_stdout) - of_stdout->fwnode.flags |=FWNODE_FLAG_BEST_EFFORT ; +fwnode_set_flag (&of_stdout->fwnode,FWNODE_FLAG_BEST_EFFORT ); }if (!of_aliases)
drivers/of/dynamic.c +1 -1
@@ -224,7 +224,7 @@ static void __of_attach_node(struct devi np->sibling = np->parent->child; np->parent->child = np;of_node_clear_flag (np,OF_DETACHED ); - np->fwnode.flags |=FWNODE_FLAG_NOT_DEVICE ; +fwnode_set_flag (&np->fwnode,FWNODE_FLAG_NOT_DEVICE );raw_spin_unlock_irqrestore (&devtree_lock, flags);
drivers/of/platform.c +1 -1
@@ -774,7 +774,7 @@ static int of_platform_notify(struct not* Clear the flag before adding the device so that fw_devlink * doesn't skip adding consumers to this device. */ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; +fwnode_clear_flag (&rd->dn->fwnode,FWNODE_FLAG_NOT_DEVICE );/* pdev_parent may be NULL when no bus platform device */ pdev_parent =of_find_device_by_node (rd->dn->parent); pdev = of_platform_device_create(rd->dn, NULL,
drivers/spi/spi.c +1 -1
@@ -4532,7 +4532,7 @@ static int of_spi_notify(struct notifier* Clear the flag before adding the device so that fw_devlink * doesn't skip adding consumers to this device. */ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; +fwnode_clear_flag (&rd->dn->fwnode,FWNODE_FLAG_NOT_DEVICE ); spi =of_register_spi_device (ctlr, rd->dn);put_device (&ctlr->dev);
include/linux/fwnode.h +33 -11
74 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 66/474 rxrpc: Fix rxkad crypto unalignment handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
commit def304aae2edf321d2671fd6ca766a93c21f877e upstream.
Fix handling of a packet with a misaligned crypto length. Also handle non-ENOMEM errors from decryption by aborting. Further, remove the WARN_ON_ONCE() so that it can't be remotely triggered (a trace line can still be emitted).
--- include/trace/events/rxrpc.h | 1 + net/rxrpc/rxkad.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
include/trace/events/rxrpc.h +1 -0
@@ -36,6 +36,7 @@ EM(rxkad_abort_1_short_encdata, "rxkad1-short-encdata") \ EM(rxkad_abort_1_short_header, "rxkad1-short-hdr") \ EM(rxkad_abort_2_short_check, "rxkad2-short-check") \ + EM(rxkad_abort_2_crypto_unaligned, "rxkad2-crypto-unaligned") \ EM(rxkad_abort_2_short_data, "rxkad2-short-data") \ EM(rxkad_abort_2_short_header, "rxkad2-short-hdr") \EM (rxkad_abort_2_short_len,"rxkad2-short-len" ) \
net/rxrpc/rxkad.c +7 -2
@@ -492,6 +492,9 @@ static int rxkad_verify_packet_2(structreturn rxrpc_abort_eproto (call, skb,RXKADSEALEDINCON , rxkad_abort_2_short_header); +/* Don't let the crypto algo see a misaligned length. */ + sp->len =round_down (sp->len,8 ); +/* Decrypt the skbuff in-place. TODO: We really want to decrypt * directly into the target buffer. */
@@ -525,8 +528,10 @@ static int rxkad_verify_packet_2(structif (sg != _sg)kfree (sg);if (ret <0 ) { -WARN_ON_ONCE (ret != -ENOMEM ); -return ret; +if (ret == -ENOMEM ) +return ret; +return rxrpc_abort_eproto (call, skb,RXKADSEALEDINCON , + rxkad_abort_2_crypto_unaligned); }/* Extract the decrypted packet length */
Greg Kroah-Hartman
maintainerPATCH 75/474 drm/arcpgu: fix device node leak
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Ceresoli <[email protected]>
commit ad3ac32a3893a2bbcad545efc005a8e4e7ecf10c upstream.
This function gets a device_node reference via of_graph_get_remote_port_parent() and stores it in encoder_node, but never puts that reference. Add it.
There used to be a of_node_put(encoder_node) but it has been removed by mistake during a rework in commit 3ea66a794fdc ("drm/arc: Inline arcpgu_drm_hdmi_init").
--- drivers/gpu/drm/tiny/arcpgu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/arcpgu.c +2 -1
@@ -248,7 +248,8 @@ DEFINE_DRM_GEM_DMA_FOPS(arcpgu_drm_ops);static int arcpgu_load (struct arcpgu_drm_private *arcpgu) {struct platform_device *pdev =to_platform_device (arcpgu->drm.dev); -struct device_node *encoder_node =NULL , *endpoint_node =NULL ; + struct device_node *encoder_node __free(device_node) = NULL; +struct device_node *endpoint_node =NULL ;struct drm_connector *connector =NULL ;struct drm_device *drm = &arcpgu->drm;struct resource *res;
Greg Kroah-Hartman
maintainerPATCH 76/474 RDMA/rxe: Validate pad and ICRC before payload_size() in rxe_rcv
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: hkbinbin <[email protected]>
commit 7244491dab347f648e661da96dc0febadd9daec3 upstream.
rxe_rcv() currently checks only that the incoming packet is at least header_size(pkt) bytes long before payload_size() is used.
However, payload_size() subtracts both the attacker-controlled BTH pad field and RXE_ICRC_SIZE from pkt->paylen:
payload_size = pkt->paylen - offset[RXE_PAYLOAD] - bth_pad(pkt)
- RXE_ICRC_SIZE
This means a short packet can still make payload_size() underflow even if it includes enough bytes for the fixed headers. Simply requiring header_size(pkt) + RXE_ICRC_SIZE is not sufficient either, because a packet with a forged non-zero BTH pad can still leave payload_size() negative and pass an underflowed value to later receive-path users.
Fix this by validating pkt->paylen against the full minimum length required by payload_size(): header_size(pkt) + bth_pad(pkt) + RXE_ICRC_SIZE.
--- drivers/infiniband/sw/rxe/rxe_recv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_recv.c +2 -1
@@ -330,7 +330,8 @@ void rxe_rcv(struct sk_buff *skb) pkt->qp =NULL ; pkt->mask |= rxe_opcode[pkt->opcode].mask; -if (unlikely (skb->len <header_size (pkt))) +if (unlikely (pkt->paylen <header_size (pkt) +bth_pad (pkt) + +RXE_ICRC_SIZE )) goto drop; err =hdr_check (pkt);
Greg Kroah-Hartman
maintainerPATCH 77/474 ipv4: icmp: validate reply type before using icmp_pointers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruide Cao <[email protected]>
commit 67bf002a2d7387a6312138210d0bd06e3cf4879b upstream.
Extended echo replies use ICMP_EXT_ECHOREPLY as the outbound reply type. That value is outside the range covered by icmp_pointers[], which only describes the traditional ICMP types up to NR_ICMP_TYPES.
Avoid consulting icmp_pointers[] for reply types outside that range, and use array_index_nospec() for the remaining in-range lookup. Normal ICMP replies keep their existing behavior unchanged.
--- net/ipv4/icmp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv4/icmp.c +4 -1
@@ -64,6 +64,7 @@#include <linux/jiffies.h> #include <linux/kernel.h> #include <linux/fcntl.h> +#include <linux/nospec.h> #include <linux/socket.h> #include <linux/in.h> #include <linux/inet.h>
@@ -359,7 +360,9 @@ static int icmp_glue_bits(void *from, ch to, len); skb->csum =csum_block_add (skb->csum, csum, odd); -if (icmp_pointers[icmp_param->data.icmph.type].error) +if (icmp_param->data.icmph.type <=NR_ICMP_TYPES && + icmp_pointers[array_index_nospec (icmp_param->data.icmph.type, +NR_ICMP_TYPES +1 )].error)nf_ct_attach (skb, icmp_param->skb);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 78/474 libceph: Prevent potential null-ptr-deref in ceph_handle_auth_reply()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raphael Zimmer <[email protected]>
commit 5199c125d25aeae8615c4fc31652cc0fe624338e upstream.
If a message of type CEPH_MSG_AUTH_REPLY contains a zero value for both protocol and result, this is currently not treated as an error. In case of ac->negotiating == true and ac->protocol > 0, this leads to setting ac->protocol = 0 and ac->ops = NULL. Thereafter, the check for ac->protocol != protocol returns false, and init_protocol() is not called. Subsequently, ac->ops->handle_reply() is called, which leads to a null pointer dereference, because ac->ops is still NULL.
This patch changes the check for ac->protocol != protocol to !ac->protocol, as this also includes the case when the protocol was set to zero in the message. This causes the message to be treated as containing a bad auth protocol.
--- net/ceph/auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/auth.c +1 -1
@@ -245,7 +245,7 @@ int ceph_handle_auth_reply(struct ceph_a ac->protocol =0 ; ac->ops =NULL ; } -if (ac->protocol != protocol) { +if (!ac->protocol) { ret =init_protocol (ac, protocol);if (ret) { pr_err("auth protocol '%s' init failed: %d\n",
Greg Kroah-Hartman
maintainerPATCH 79/474 extract-cert: Wrap key_pass with #ifdef USE_PKCS11_ENGINE
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 4f96b7c68a9904e01049ef610d701b382dca9574 upstream.
A recent strengthening of -Wunused-but-set-variable (enabled with -Wall) in clang under a new subwarning, -Wunused-but-set-global, points out an unused static global variable in certs/extract-cert.c:
certs/extract-cert.c:46:20: error: variable 'key_pass' set but not used [-Werror,-Wunused-but-set-global]
46 | static const char *key_pass;
| ^After commit 558bdc45dfb2 ("sign-file,extract-cert: use pkcs11 provider for OPENSSL MAJOR >= 3"), key_pass is only used with the OpenSSL engine API, not the new provider API. Wrap key_pass's declaration and assignment with '#ifdef USE_PKCS11_ENGINE' so that it is only included with its use to clear up the warning. While this is a little uglier than just marking key_pass with the unused attribute, this will make it easier to clean up all code associated with the use of the engine API if it were ever removed in the future. While in the area, use a tab for the key_pass assignment line to match the rest of the file.
--- certs/extract-cert.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
certs/extract-cert.c +5 -1
@@ -43,7 +43,9 @@ void format(void)exit (2 ); } +#ifdef USE_PKCS11_ENGINE static const char *key_pass; +#endif static BIO *wb;static char *cert_dst;static bool verbose;
@@ -135,7 +137,9 @@ int main(int argc, char **argv)if (verbose_env &&strchr (verbose_env,'1' )) verbose = true; - key_pass =getenv ("KBUILD_SIGN_PIN" ); +#ifdef USE_PKCS11_ENGINE + key_pass =getenv ("KBUILD_SIGN_PIN" ); +#endif if (argc !=3 )format ();
Greg Kroah-Hartman
maintainerPATCH 80/474 tpm: avoid -Wunused-but-set-variable
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 6f1d4d2ecfcd1b577dc87350ea965fe81f272e83 upstream.
Outside of the EFI tpm code, the TPM_MEMREMAP()/TPM_MEMUNMAP functions are defined as trivial macros, leading to the mapping_size variable ending up unused:
In file included from drivers/char/tpm/tpm-sysfs.c:16:
In file included from drivers/char/tpm/tpm.h:28:include/linux/tpm_eventlog.h:167:6: error: variable 'mapping_size' set but not used [-Werror,-Wunused-but-set-variable]
167 | int mapping_size;
Turn the stubs into inline functions to avoid this warning.
--- include/linux/tpm_eventlog.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
include/linux/tpm_eventlog.h +7 -2
@@ -131,11 +131,16 @@ struct tcg_algorithm_info { };#ifndef TPM_MEMREMAP -#define TPM_MEMREMAP (start, size) NULL +static inline void *TPM_MEMREMAP (unsigned long start,size_t size) +{ +return NULL ; +}#endif #ifndef TPM_MEMUNMAP -#define TPM_MEMUNMAP (start, size) do{} while(0) +static inline void TPM_MEMUNMAP (void *mapping,size_t size) +{ +}#endif /**
Greg Kroah-Hartman
maintainerPATCH 81/474 LoongArch: Show CPU vulnerabilites correctly
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 37e57e8ad96cdec4a57b55fd10bef50f7370a954 upstream.
Most LoongArch processors are vulnerable to Spectre-V1 Proof-of-Concept (PoC). And the generic mechanism, __user pointer sanitization, can be used as a mitigation. This means to use array_index_nospec() to prevent out of boundry access in syscall and other critical paths.
Implement the arch-specific cpu_show_spectre_v1() to show CPU Spectre-V1 vulnerabilites correctly.
--- arch/loongarch/kernel/cpu-probe.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/loongarch/kernel/cpu-probe.c +7 -0
@@ -7,6 +7,7 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/ptrace.h> +#include <linux/cpu.h> #include <linux/smp.h> #include <linux/stddef.h> #include <linux/export.h>
@@ -327,3 +328,9 @@ void cpu_probe(void)cpu_report (); } + +ssize_t cpu_show_spectre_v1 (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sysfs_emit (buf,"Mitigation: __user pointer sanitization\n" ); +}
Greg Kroah-Hartman
maintainerPATCH 82/474 power: supply: axp288_charger: Do not cancel work before initializing it
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 658342fd75b582cbb06544d513171c3d645faead upstream.
Driver registered devm handler to cancel_work_sync() before even the work was initialized, thus leading to possible warning from kernel/workqueue.c on (!work->func) check, if the error path was hit before the initialization happened.
Use devm_work_autocancel() on each work item independently, which handles the initialization and handler to cancel work.
--- drivers/power/supply/axp288_charger.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/power/supply/axp288_charger.c +8 -11
@@ -10,6 +10,7 @@#include <linux/acpi.h> #include <linux/bitops.h> #include <linux/module.h> +#include <linux/devm-helpers.h> #include <linux/device.h> #include <linux/regmap.h> #include <linux/workqueue.h>
@@ -821,14 +822,6 @@ static int charger_init_hw_regs(struct areturn 0 ; } -static void axp288_charger_cancel_work (void *data) -{ -struct axp288_chrg_info *info = data; - -cancel_work_sync (&info->otg.work); -cancel_work_sync (&info->cable.work); -} -static int axp288_charger_probe (struct platform_device *pdev) {int ret, i, pirq;
@@ -911,12 +904,12 @@ static int axp288_charger_probe(struct p }/* Cancel our work on cleanup, register this before the notifiers */ - ret =devm_add_action (dev, axp288_charger_cancel_work, info); + ret =devm_work_autocancel (dev, &info->cable.work, + axp288_charger_extcon_evt_worker);if (ret)return ret;/* Register for extcon notification */ -INIT_WORK (&info->cable.work, axp288_charger_extcon_evt_worker); info->cable.nb.notifier_call = axp288_charger_handle_cable_evt; ret =devm_extcon_register_notifier_all (dev, info->cable.edev, &info->cable.nb);
@@ -926,8 +919,12 @@ static int axp288_charger_probe(struct p }schedule_work (&info->cable.work); + ret =devm_work_autocancel (dev, &info->otg.work, + axp288_charger_otg_evt_worker); +if (ret) +return ret; +/* Register for OTG notification */ -INIT_WORK (&info->otg.work, axp288_charger_otg_evt_worker); info->otg.id_nb.notifier_call = axp288_charger_handle_otg_evt;if (info->otg.cable) { ret = devm_extcon_register_notifier(dev, info->otg.cable,
Greg Kroah-Hartman
maintainerPATCH 83/474 randomize_kstack: Maintain kstack_offset per task
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryan Roberts <[email protected]>
commit 37beb42560165869838e7d91724f3e629db64129 upstream.
kstack_offset was previously maintained per-cpu, but this caused a couple of issues. So let's instead make it per-task.
Issue 1: add_random_kstack_offset() and choose_random_kstack_offset() expected and required to be called with interrupts and preemption disabled so that it could manipulate per-cpu state. But arm64, loongarch and risc-v are calling them with interrupts and preemption enabled. I don't _think_ this causes any functional issues, but it's certainly unexpected and could lead to manipulating the wrong cpu's state, which could cause a minor performance degradation due to bouncing the cache lines. By maintaining the state per-task those functions can safely be called in preemptible context.
Issue 2: add_random_kstack_offset() is called before executing the syscall and expands the stack using a previously chosen random offset. choose_random_kstack_offset() is called after executing the syscall and chooses and stores a new random offset for the next syscall. With per-cpu storage for this offset, an attacker could force cpu migration during the execution of the syscall and prevent the offset from being updated for the original cpu such that it is predictable for the next syscall on that cpu. By maintaining the state per-task, this problem goes away because the per-task random offset is updated after the syscall regardless of which cpu it is executing on.
--- include/linux/randomize_kstack.h | 26 +++++++++++++++----------- include/linux/sched.h | 4 ++++ init/main.c | 1 - kernel/fork.c | 2 ++ 4 files changed, 21 insertions(+), 12 deletions(-)
include/linux/randomize_kstack.h +15 -11
@@ -9,7 +9,6 @@DECLARE_STATIC_KEY_MAYBE (CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT , randomize_kstack_offset); -DECLARE_PER_CPU (u32, kstack_offset);/* * Do not use this anywhere else in the kernel. This is used here because
@@ -44,15 +43,14 @@ DECLARE_PER_CPU(u32, kstack_offset);* add_random_kstack_offset - Increase stack utilization by previously * chosen random offset * -* This should be used in the syscall entry path when interrupts and -* preempt are disabled, and after user registers have been stored to -* the stack. For testing the resulting entropy, please see: -* tools/testing/selftests/lkdtm/stack-entropy.sh +* This should be used in the syscall entry path after user registers have been +* stored to the stack. Preemption may be enabled. For testing the resulting +* entropy, please see: tools/testing/selftests/lkdtm/stack-entropy.sh */ #define add_random_kstack_offset () do { \ if (static_branch_maybe(CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT, \ &randomize_kstack_offset)) { \ - u32 offset = raw_cpu_read(kstack_offset); \ + u32 offset = current->kstack_offset; \ u8 *ptr = __kstack_alloca(KSTACK_OFFSET_MAX(offset)); \/* Keep allocation even after "ptr" loses scope. */ \ asmvolatile ("" ::"r" (ptr) :"memory" ); \
@@ -63,9 +61,9 @@ DECLARE_PER_CPU(u32, kstack_offset);* choose_random_kstack_offset - Choose the random offset for the next * add_random_kstack_offset() * -* This should only be used during syscall exit when interrupts and -* preempt are disabled. This position in the syscall flow is done to -* frustrate attacks from userspace attempting to learn the next offset: +* This should only be used during syscall exit. Preemption may be enabled. This +* position in the syscall flow is done to frustrate attacks from userspace +* attempting to learn the next offset: * - Maximize the timing uncertainty visible from userspace: if the * offset is chosen at syscall entry, userspace has much more control * over the timing between choosing offsets. "How long will we be in
@@ -79,14 +77,20 @@ DECLARE_PER_CPU(u32, kstack_offset);#define choose_random_kstack_offset (rand) do { \ if (static_branch_maybe(CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT, \ &randomize_kstack_offset)) { \ - u32 offset = raw_cpu_read(kstack_offset); \ + u32 offset = current->kstack_offset; \ offset = ror32(offset, 5) ^ (rand); \ - raw_cpu_write(kstack_offset, offset); \ + current->kstack_offset = offset; \ } \ } while (0) + +static inline void random_kstack_task_init (struct task_struct *tsk) +{ + tsk->kstack_offset =0 ; +}#else /* CONFIG_RANDOMIZE_KSTACK_OFFSET */ #define add_random_kstack_offset () do { } while (0)#define choose_random_kstack_offset (rand) do { } while (0) +#define random_kstack_task_init (tsk) do { } while (0)#endif /* CONFIG_RANDOMIZE_KSTACK_OFFSET */ #endif
include/linux/sched.h +4 -0
@@ -1501,6 +1501,10 @@ struct task_struct {unsigned long prev_lowest_stack;#endif +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET +u32 kstack_offset; +#endif +#ifdef CONFIG_X86_MCE void __user *mce_vaddr;__u64 mce_kflags;
init/main.c +0 -1
@@ -816,7 +816,6 @@ static inline void initcall_debug_enable#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET DEFINE_STATIC_KEY_MAYBE_RO (CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT , randomize_kstack_offset); -DEFINE_PER_CPU (u32, kstack_offset);static int __init early_randomize_kstack_offset (char *buf) {
kernel/fork.c +2 -0
@@ -93,6 +93,7 @@#include <linux/thread_info.h> #include <linux/stackleak.h> #include <linux/kasan.h> +#include <linux/randomize_kstack.h> #include <linux/scs.h> #include <linux/io_uring.h> #include <linux/bpf.h>
@@ -2517,6 +2518,7 @@ __latent_entropy struct task_struct *copif (retval) goto bad_fork_cleanup_io; +random_kstack_task_init (p);stackleak_task_init (p);if (pid != &init_struct_pid) {
Greg Kroah-Hartman
maintainerPATCH 84/474 mmc: block: use single block write in retry
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bin Liu <[email protected]>
commit c7c6d4f5103864f73ee3a78bfd6da241f84197dd upstream.
Due to errata i2493[0], multi-block write would still fail in retries.
With i2493, the MMC interface has the potential of write failures when issuing multi-block writes operating in HS200 mode with excessive IO supply noise.
While the errata provides guidance in hardware design and layout to minimize the IO supply noise, in theory the write failure cannot be resolved in hardware. The software solution to ensure the data integrity is to add minimum 5us delay between block writes. Single-block write is the practical way to introduce the delay.
This patch reuses recovery_mode flag, and switches to single-block write in retry when multi-block write fails. It covers both CQE and non-CQE cases.
[0] https://www.ti.com/lit/pdf/sprz582
--- drivers/mmc/core/block.c | 12 ++++++++++-- drivers/mmc/core/queue.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/mmc/core/block.c +10 -2
@@ -1378,6 +1378,9 @@ static void mmc_blk_data_prep(struct mmcrq_data_dir (req) ==WRITE && (md->flags &MMC_BLK_REL_WR ); +if (mqrq->flags &MQRQ_XFER_SINGLE_BLOCK ) + recovery_mode =1 ; +memset (brq,0 ,sizeof (struct mmc_blk_request ));mmc_crypto_prepare_req (mqrq);
@@ -1517,10 +1520,13 @@ static void mmc_blk_cqe_complete_rq(stru err =0 ;if (err) { -if (mqrq->retries++ <MMC_CQE_RETRIES ) +if (mqrq->retries++ <MMC_CQE_RETRIES ) { +if (rq_data_dir (req) ==WRITE ) + mqrq->flags |=MQRQ_XFER_SINGLE_BLOCK ;blk_mq_requeue_request (req, true); -else + }else {blk_mq_end_request (req,BLK_STS_IOERR ); + } }else if (mrq->data) {if (blk_update_request (req,BLK_STS_OK , mrq->data->bytes_xfered))blk_mq_requeue_request (req, true);
@@ -2058,6 +2064,8 @@ static void mmc_blk_mq_complete_rq(struc }else if (!blk_rq_bytes (req)) {__blk_mq_end_request (req,BLK_STS_IOERR ); }else if (mqrq->retries++ <MMC_MAX_RETRIES ) { +if (rq_data_dir (req) ==WRITE ) + mqrq->flags |=MQRQ_XFER_SINGLE_BLOCK ;blk_mq_requeue_request (req, true); }else {if (mmc_card_removed (mq->card))
drivers/mmc/core/queue.h +3 -0
@@ -61,6 +61,8 @@ enum mmc_drv_op { MMC_DRV_OP_GET_EXT_CSD, }; +#define MQRQ_XFER_SINGLE_BLOCK BIT(0) +struct mmc_queue_req {struct mmc_blk_request brq;struct scatterlist *sg;
@@ -69,6 +71,7 @@ struct mmc_queue_req {void *drv_op_data;unsigned int ioc_count;int retries; +u32 flags; };struct mmc_queue {
Greg Kroah-Hartman
maintainerPATCH 67/474 rxrpc: Fix re-decryption of RESPONSE packets
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
commit 0422e7a4883f25101903f3e8105c0808aa5f4ce9 upstream.
If a RESPONSE packet gets a temporary failure during processing, it may end up in a partially decrypted state - and then get requeued for a retry.
Fix this by just discarding the packet; we will send another CHALLENGE packet and thereby elicit a further response. Similarly, discard an incoming CHALLENGE packet if we get an error whilst generating a RESPONSE; the server will send another CHALLENGE.
--- include/trace/events/rxrpc.h | 1 - net/rxrpc/conn_event.c | 14 ++------------ 2 files changed, 2 insertions(+), 13 deletions(-)
include/trace/events/rxrpc.h +0 -1
@@ -232,7 +232,6 @@ EM(rxrpc_conn_put_unidle, "PUT unidle ") \ EM(rxrpc_conn_put_work, "PUT work ") \ EM(rxrpc_conn_queue_challenge, "QUE chall ") \ - EM(rxrpc_conn_queue_retry_work, "QUE retry-wk") \ EM(rxrpc_conn_queue_rx_work, "QUE rx-work ") \ EM(rxrpc_conn_see_new_service_conn, "SEE new-svc ") \EM (rxrpc_conn_see_reap_service,"SEE reap-svc" ) \
net/rxrpc/conn_event.c +2 -12
@@ -344,7 +344,6 @@ again:static void rxrpc_do_process_connection (struct rxrpc_connection *conn) {struct sk_buff *skb; -int ret;if (test_and_clear_bit (RXRPC_CONN_EV_CHALLENGE , &conn->events))rxrpc_secure_connection (conn);
@@ -353,17 +352,8 @@ static void rxrpc_do_process_connection(* connection that each one has when we've finished with it */ while ((skb =skb_dequeue (&conn->rx_queue))) {rxrpc_see_skb (skb, rxrpc_skb_see_conn_work); - ret =rxrpc_process_event (conn, skb); -switch (ret) { -case -ENOMEM : -case -EAGAIN : -skb_queue_head (&conn->rx_queue, skb); -rxrpc_queue_conn (conn, rxrpc_conn_queue_retry_work); -break ; -default : -rxrpc_free_skb (skb, rxrpc_skb_put_conn_work); -break ; - } +rxrpc_process_event (conn, skb); +rxrpc_free_skb (skb, rxrpc_skb_put_conn_work); } }
Greg Kroah-Hartman
maintainerPATCH 85/474 mmc: sdhci-of-dwcmshc: Disable clock before DLL configuration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <[email protected]>
commit 6546a49bbe656981d99a389195560999058c89c4 upstream.
According to the ASIC design recommendations, the clock must be disabled before operating the DLL to prevent glitches that could affect the internal digital logic. In extreme cases, failing to do so may cause the controller to malfunction completely.
Adds a step to disable the clock before DLL configuration and re-enables it at the end.
--- drivers/mmc/host/sdhci-of-dwcmshc.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci-of-dwcmshc.c +16 -3
@@ -243,12 +243,15 @@ static void dwcmshc_rk3568_set_clock(str extra &= ~BIT (0 );sdhci_writel (host, extra, reg); +/* Disable clock while config DLL */ +sdhci_writew (host,0 ,SDHCI_CLOCK_CONTROL ); +if (clock <=52000000 ) {if (host->mmc->ios.timing ==MMC_TIMING_MMC_HS200 || host->mmc->ios.timing ==MMC_TIMING_MMC_HS400 ) {dev_err (mmc_dev (host->mmc),"Can't reduce the clock below 52MHz in HS200/HS400 mode" ); -return ; + goto enable_clk; }/*
@@ -268,7 +271,7 @@ static void dwcmshc_rk3568_set_clock(strDLL_STRBIN_DELAY_NUM_SEL |DLL_STRBIN_DELAY_NUM_DEFAULT <<DLL_STRBIN_DELAY_NUM_OFFSET ;sdhci_writel (host, extra,DWCMSHC_EMMC_DLL_STRBIN ); -return ; + goto enable_clk; }/* Reset DLL */
@@ -295,7 +298,7 @@ static void dwcmshc_rk3568_set_clock(str 500 * USEC_PER_MSEC);if (err) {dev_err (mmc_dev (host->mmc),"DLL lock timeout!\n" ); -return ; + goto enable_clk; } extra = 0x1 << 16 | /* tune clock stop en */
@@ -328,6 +331,16 @@ static void dwcmshc_rk3568_set_clock(strDLL_STRBIN_TAPNUM_DEFAULT |DLL_STRBIN_TAPNUM_FROM_SW ;sdhci_writel (host, extra,DWCMSHC_EMMC_DLL_STRBIN ); + +enable_clk: +/* +* The sdclk frequency select bits in SDHCI_CLOCK_CONTROL are not functional +* on Rockchip's SDHCI implementation. Instead, the clock frequency is fully +* controlled via external clk provider by calling clk_set_rate(). Consequently, +* passing 0 to sdhci_enable_clk() only re-enables the already-configured clock, +* which matches the hardware's actual behavior. +*/ +sdhci_enable_clk (host,0 ); }static void rk35xx_sdhci_reset (struct sdhci_host *host,u8 mask)
Greg Kroah-Hartman
maintainerPATCH 86/474 arm64: dts: ti: am62-verdin: Enable pullup for eMMC data pins
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Francesco Dolcini <[email protected]>
commit d5325810814ee995debfa0b6c4a22e0391598bef upstream.
Verdin AM62 board does not have external pullups on eMMC DAT1-DAT7 pins. Enable internal pullups on DAT1-DAT7 considering:
- without a host-side pullup, these lines rely solely on the eMMC device's internal pullup (R_int, 10kohm-150kohm per JEDEC), which may exceed the recommended 50kohm max for 1.8V VCCQ
- JEDEC JESD84-B51 Table 200 requires host-side pullups (R_DAT, 10kohm-100kohm) on all data lines to prevent bus floating
--- arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi +10 -10
@@ -507,16 +507,16 @@ /* On-module eMMC */ pinctrl_sdhci0: main-mmc0-default-pins { pinctrl-single,pins = < - AM62X_IOPAD(0x220, PIN_INPUT, 0) /* (Y3) MMC0_CMD */ - AM62X_IOPAD(0x218, PIN_INPUT, 0) /* (AB1) MMC0_CLK */ - AM62X_IOPAD(0x214, PIN_INPUT, 0) /* (AA2) MMC0_DAT0 */ - AM62X_IOPAD(0x210, PIN_INPUT, 0) /* (AA1) MMC0_DAT1 */ - AM62X_IOPAD(0x20c, PIN_INPUT, 0) /* (AA3) MMC0_DAT2 */ - AM62X_IOPAD(0x208, PIN_INPUT, 0) /* (Y4) MMC0_DAT3 */ - AM62X_IOPAD(0x204, PIN_INPUT, 0) /* (AB2) MMC0_DAT4 */ - AM62X_IOPAD(0x200, PIN_INPUT, 0) /* (AC1) MMC0_DAT5 */ - AM62X_IOPAD(0x1fc, PIN_INPUT, 0) /* (AD2) MMC0_DAT6 */ - AM62X_IOPAD(0x1f8, PIN_INPUT, 0) /* (AC2) MMC0_DAT7 */ + AM62X_IOPAD(0x220, PIN_INPUT, 0) /* (Y3) MMC0_CMD */ + AM62X_IOPAD(0x218, PIN_INPUT, 0) /* (AB1) MMC0_CLK */ + AM62X_IOPAD(0x214, PIN_INPUT, 0) /* (AA2) MMC0_DAT0 */ + AM62X_IOPAD(0x210, PIN_INPUT_PULLUP, 0) /* (AA1) MMC0_DAT1 */ + AM62X_IOPAD(0x20c, PIN_INPUT_PULLUP, 0) /* (AA3) MMC0_DAT2 */ + AM62X_IOPAD(0x208, PIN_INPUT_PULLUP, 0) /* (Y4) MMC0_DAT3 */ + AM62X_IOPAD(0x204, PIN_INPUT_PULLUP, 0) /* (AB2) MMC0_DAT4 */ + AM62X_IOPAD(0x200, PIN_INPUT_PULLUP, 0) /* (AC1) MMC0_DAT5 */ + AM62X_IOPAD(0x1fc, PIN_INPUT_PULLUP, 0) /* (AD2) MMC0_DAT6 */ + AM62X_IOPAD(0x1f8, PIN_INPUT_PULLUP, 0) /* (AC2) MMC0_DAT7 */ >; };
Greg Kroah-Hartman
maintainerPATCH 87/474 crypto: talitos - fix SEC1 32k ahash request limitation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Louvel <[email protected]>
commit 655ef638a2bc3cd0a9eff99a02f83cab94a3a917 upstream.
Since commit c662b043cdca ("crypto: af_alg/hash: Support MSG_SPLICE_PAGES"), the crypto core may pass large scatterlists spanning multiple pages to drivers supporting ahash operations. As a result, a driver can now receive large ahash requests.
The SEC1 engine has a limitation where a single descriptor cannot process more than 32k of data. The current implementation attempts to handle the entire request within a single descriptor, which leads to failures raised by the driver:
"length exceeds h/w max limit"
Address this limitation by splitting large ahash requests into multiple descriptors, each respecting the 32k hardware limit. This allows processing arbitrarily large requests.
--- drivers/crypto/talitos.c | 216 +++++++++++++++++++++++++++++++---------------- 1 file changed, 147 insertions(+), 69 deletions(-)
drivers/crypto/talitos.c +147 -69
@@ -12,6 +12,7 @@* All rights reserved. */ +#include <linux/workqueue.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/mod_devicetable.h>
@@ -870,10 +871,18 @@ struct talitos_ahash_req_ctx {unsigned int swinit;unsigned int first;unsigned int last; +unsigned int last_request;unsigned int to_hash_later;unsigned int nbuf;struct scatterlist bufsl[2 ];struct scatterlist *psrc; + +struct scatterlist request_bufsl[2 ]; +struct ahash_request *areq; +struct scatterlist *request_sl; +unsigned int remaining_ahash_request_bytes; +unsigned int current_ahash_request_bytes; +struct work_struct sec1_ahash_process_remaining; };struct talitos_export_state {
@@ -1759,7 +1768,20 @@ static void ahash_done(struct device *dekfree (edesc); -ahash_request_complete (areq, err); +if (err) { +ahash_request_complete (areq, err); +return ; + } + + req_ctx->remaining_ahash_request_bytes -= + req_ctx->current_ahash_request_bytes; + +if (!req_ctx->remaining_ahash_request_bytes) { +ahash_request_complete (areq,0 ); +return ; + } + +schedule_work (&req_ctx->sec1_ahash_process_remaining); }/*
@@ -1925,60 +1947,7 @@ static struct talitos_edesc *ahash_edesc nbytes, 0, 0, 0, areq->base.flags, false); } -static int ahash_init (struct ahash_request *areq) -{ -struct crypto_ahash *tfm =crypto_ahash_reqtfm (areq); -struct talitos_ctx *ctx =crypto_ahash_ctx (tfm); -struct device *dev = ctx->dev; -struct talitos_ahash_req_ctx *req_ctx =ahash_request_ctx (areq); -unsigned int size; -dma_addr_t dma; - -/* Initialize the context */ - req_ctx->buf_idx =0 ; - req_ctx->nbuf =0 ; - req_ctx->first =1 ;/* first indicates h/w must init its context */ - req_ctx->swinit =0 ;/* assume h/w init of context */ - size = (crypto_ahash_digestsize (tfm) <=SHA256_DIGEST_SIZE ) - ?TALITOS_MDEU_CONTEXT_SIZE_MD5_SHA1_SHA256 - :TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512 ; - req_ctx->hw_context_size = size; - - dma =dma_map_single (dev, req_ctx->hw_context, req_ctx->hw_context_size, -DMA_TO_DEVICE ); -dma_unmap_single (dev, dma, req_ctx->hw_context_size,DMA_TO_DEVICE ); - -return 0 ; -} - -/* -* on h/w without explicit sha224 support, we initialize h/w context -* manually with sha224 constants, and tell it to run sha256. -*/ -static int ahash_init_sha224_swinit (struct ahash_request *areq) -{ -struct talitos_ahash_req_ctx *req_ctx =ahash_request_ctx (areq); - - req_ctx->hw_context[0 ] =SHA224_H0 ; - req_ctx->hw_context[1 ] =SHA224_H1 ; - req_ctx->hw_context[2 ] =SHA224_H2 ; - req_ctx->hw_context[3 ] =SHA224_H3 ; - req_ctx->hw_context[4 ] =SHA224_H4 ; - req_ctx->hw_context[5 ] =SHA224_H5 ; - req_ctx->hw_context[6 ] =SHA224_H6 ; - req_ctx->hw_context[7 ] =SHA224_H7 ; - -/* init 64-bit count */ - req_ctx->hw_context[8 ] =0 ; - req_ctx->hw_context[9 ] =0 ; - -ahash_init (areq); - req_ctx->swinit =1 ;/* prevent h/w initting context with sha256 values*/ - -return 0 ; -} - -static int ahash_process_req (struct ahash_request *areq,unsigned int nbytes) +static int ahash_process_req_one (struct ahash_request *areq,unsigned int nbytes) {struct crypto_ahash *tfm =crypto_ahash_reqtfm (areq);struct talitos_ctx *ctx =crypto_ahash_ctx (tfm);
@@ -1997,12 +1966,12 @@ static int ahash_process_req(struct ahasif (!req_ctx->last && (nbytes + req_ctx->nbuf <= blocksize)) {/* Buffer up to one whole block */ - nents =sg_nents_for_len (areq->src, nbytes); + nents =sg_nents_for_len (req_ctx->request_sl, nbytes);if (nents <0 ) {dev_err (dev,"Invalid number of src SG.\n" );return nents; } -sg_copy_to_buffer (areq->src, nents, +sg_copy_to_buffer (req_ctx->request_sl, nents, ctx_buf + req_ctx->nbuf, nbytes); req_ctx->nbuf += nbytes;return 0 ;
@@ -2029,7 +1998,7 @@ static int ahash_process_req(struct ahassg_init_table (req_ctx->bufsl, nsg);sg_set_buf (req_ctx->bufsl, ctx_buf, req_ctx->nbuf);if (nsg >1 ) -sg_chain (req_ctx->bufsl,2 , areq->src); +sg_chain (req_ctx->bufsl,2 , req_ctx->request_sl); req_ctx->psrc = req_ctx->bufsl; }else if (is_sec1 && req_ctx->nbuf && req_ctx->nbuf < blocksize) {int offset;
@@ -2038,26 +2007,26 @@ static int ahash_process_req(struct ahas offset = blocksize - req_ctx->nbuf; else offset = nbytes_to_hash - req_ctx->nbuf; - nents =sg_nents_for_len (areq->src, offset); + nents =sg_nents_for_len (req_ctx->request_sl, offset);if (nents <0 ) {dev_err (dev,"Invalid number of src SG.\n" );return nents; } -sg_copy_to_buffer (areq->src, nents, +sg_copy_to_buffer (req_ctx->request_sl, nents, ctx_buf + req_ctx->nbuf, offset); req_ctx->nbuf += offset; - req_ctx->psrc =scatterwalk_ffwd (req_ctx->bufsl, areq->src, + req_ctx->psrc =scatterwalk_ffwd (req_ctx->bufsl, req_ctx->request_sl, offset); }else - req_ctx->psrc = areq->src; + req_ctx->psrc = req_ctx->request_sl;if (to_hash_later) { - nents =sg_nents_for_len (areq->src, nbytes); + nents =sg_nents_for_len (req_ctx->request_sl, nbytes);if (nents <0 ) {dev_err (dev,"Invalid number of src SG.\n" );return nents; } -sg_pcopy_to_buffer (areq->src, nents, +sg_pcopy_to_buffer (req_ctx->request_sl, nents, req_ctx->buf[(req_ctx->buf_idx +1 ) &1 ], to_hash_later, nbytes - to_hash_later);
@@ -2065,7 +2034,7 @@ static int ahash_process_req(struct ahas req_ctx->to_hash_later = to_hash_later;/* Allocate extended descriptor */ - edesc =ahash_edesc_alloc (areq, nbytes_to_hash); + edesc =ahash_edesc_alloc (req_ctx->areq, nbytes_to_hash);if (IS_ERR (edesc))return PTR_ERR (edesc);
@@ -2087,14 +2056,123 @@ static int ahash_process_req(struct ahasif (ctx->keylen && (req_ctx->first || req_ctx->last)) edesc->desc.hdr |=DESC_HDR_MODE0_MDEU_HMAC ; -return common_nonsnoop_hash (edesc, areq, nbytes_to_hash, ahash_done); +return common_nonsnoop_hash (edesc, req_ctx->areq, nbytes_to_hash, ahash_done); } -static int ahash_update (struct ahash_request *areq) +static void sec1_ahash_process_remaining (struct work_struct *work) { +struct talitos_ahash_req_ctx *req_ctx = + container_of(work, struct talitos_ahash_req_ctx, + sec1_ahash_process_remaining); +int err =0 ; + + req_ctx->request_sl =scatterwalk_ffwd (req_ctx->request_bufsl, + req_ctx->request_sl,TALITOS1_MAX_DATA_LEN ); + +if (req_ctx->remaining_ahash_request_bytes >TALITOS1_MAX_DATA_LEN ) + req_ctx->current_ahash_request_bytes =TALITOS1_MAX_DATA_LEN ; +else { + req_ctx->current_ahash_request_bytes = + req_ctx->remaining_ahash_request_bytes; + +if (req_ctx->last_request) + req_ctx->last =1 ; + } + + err =ahash_process_req_one (req_ctx->areq, + req_ctx->current_ahash_request_bytes); + +if (err != -EINPROGRESS ) +ahash_request_complete (req_ctx->areq, err); +} + +static int ahash_process_req (struct ahash_request *areq,unsigned int nbytes) +{ +struct crypto_ahash *tfm =crypto_ahash_reqtfm (areq); +struct talitos_ctx *ctx =crypto_ahash_ctx (tfm); +struct device *dev = ctx->dev; +struct talitos_ahash_req_ctx *req_ctx =ahash_request_ctx (areq); +struct talitos_private *priv =dev_get_drvdata (dev); +bool is_sec1 =has_ftr_sec1 (priv); + + req_ctx->areq = areq; + req_ctx->request_sl = areq->src; + req_ctx->remaining_ahash_request_bytes = nbytes; + +if (is_sec1) { +if (nbytes >TALITOS1_MAX_DATA_LEN ) + nbytes =TALITOS1_MAX_DATA_LEN ; +else if (req_ctx->last_request) + req_ctx->last =1 ; + } + + req_ctx->current_ahash_request_bytes = nbytes; + +return ahash_process_req_one (req_ctx->areq, + req_ctx->current_ahash_request_bytes); +} + +static int ahash_init (struct ahash_request *areq) +{ +struct crypto_ahash *tfm =crypto_ahash_reqtfm (areq); +struct talitos_ctx *ctx =crypto_ahash_ctx (tfm); +struct device *dev = ctx->dev;struct talitos_ahash_req_ctx *req_ctx =ahash_request_ctx (areq); +unsigned int size; +dma_addr_t dma; +/* Initialize the context */ + req_ctx->buf_idx =0 ; + req_ctx->nbuf =0 ; + req_ctx->first =1 ;/* first indicates h/w must init its context */ + req_ctx->swinit =0 ;/* assume h/w init of context */ + size = (crypto_ahash_digestsize (tfm) <=SHA256_DIGEST_SIZE ) + ?TALITOS_MDEU_CONTEXT_SIZE_MD5_SHA1_SHA256 + :TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512 ; + req_ctx->hw_context_size = size; + req_ctx->last_request =0 ; req_ctx->last =0 ; +INIT_WORK (&req_ctx->sec1_ahash_process_remaining, sec1_ahash_process_remaining); + + dma =dma_map_single (dev, req_ctx->hw_context, req_ctx->hw_context_size, +DMA_TO_DEVICE ); +dma_unmap_single (dev, dma, req_ctx->hw_context_size,DMA_TO_DEVICE ); + +return 0 ; +} + +/* +* on h/w without explicit sha224 support, we initialize h/w context +* manually with sha224 constants, and tell it to run sha256. +*/ +static int ahash_init_sha224_swinit (struct ahash_request *areq) +{ +struct talitos_ahash_req_ctx *req_ctx =ahash_request_ctx (areq); + + req_ctx->hw_context[0 ] =SHA224_H0 ; + req_ctx->hw_context[1 ] =SHA224_H1 ; + req_ctx->hw_context[2 ] =SHA224_H2 ; + req_ctx->hw_context[3 ] =SHA224_H3 ; + req_ctx->hw_context[4 ] =SHA224_H4 ; + req_ctx->hw_context[5 ] =SHA224_H5 ; + req_ctx->hw_context[6 ] =SHA224_H6 ; + req_ctx->hw_context[7 ] =SHA224_H7 ; + +/* init 64-bit count */ + req_ctx->hw_context[8 ] =0 ; + req_ctx->hw_context[9 ] =0 ; + +ahash_init (areq); + req_ctx->swinit =1 ;/* prevent h/w initting context with sha256 values*/ + +return 0 ; +} + +static int ahash_update (struct ahash_request *areq) +{ +struct talitos_ahash_req_ctx *req_ctx =ahash_request_ctx (areq); + + req_ctx->last_request =0 ;return ahash_process_req (areq, areq->nbytes); }
@@ -2103,7 +2181,7 @@ static int ahash_final(struct ahash_requ {struct talitos_ahash_req_ctx *req_ctx =ahash_request_ctx (areq); - req_ctx->last =1 ; + req_ctx->last_request =1 ;return ahash_process_req (areq,0 ); }
@@ -2112,7 +2190,7 @@ static int ahash_finup(struct ahash_requ {struct talitos_ahash_req_ctx *req_ctx =ahash_request_ctx (areq); - req_ctx->last =1 ; + req_ctx->last_request =1 ;return ahash_process_req (areq, areq->nbytes); }
Greg Kroah-Hartman
maintainerPATCH 88/474 crypto: talitos - rename first/last to first_desc/last_desc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Louvel <[email protected]>
commit a1b80018b8cec27fc06a8b04a7f8b5f6cfe86eae upstream.
Previous commit introduces a new last_request variable in the context structure.
Renaming the first/last existing member variable in the context structure to improve readability.
--- drivers/crypto/talitos.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-)
drivers/crypto/talitos.c +23 -23
@@ -869,8 +869,8 @@ struct talitos_ahash_req_ctx {u8 buf[2 ][HASH_MAX_BLOCK_SIZE ];int buf_idx;unsigned int swinit; -unsigned int first; -unsigned int last; +unsigned int first_desc; +unsigned int last_desc;unsigned int last_request;unsigned int to_hash_later;unsigned int nbuf;
@@ -889,8 +889,8 @@ struct talitos_export_state {u32 hw_context[TALITOS_MDEU_MAX_CONTEXT_SIZE /sizeof (u32)];u8 buf[HASH_MAX_BLOCK_SIZE ];unsigned int swinit; -unsigned int first; -unsigned int last; +unsigned int first_desc; +unsigned int last_desc;unsigned int to_hash_later;unsigned int nbuf; };
@@ -1722,7 +1722,7 @@ static void common_nonsnoop_hash_unmap(sif (desc->next_desc && desc->ptr[5 ].ptr != desc2->ptr[5 ].ptr)unmap_single_talitos_ptr (dev, &desc2->ptr[5 ],DMA_FROM_DEVICE ); -if (req_ctx->last) +if (req_ctx->last_desc)memcpy (areq->result, req_ctx->hw_context,crypto_ahash_digestsize (tfm));
@@ -1759,7 +1759,7 @@ static void ahash_done(struct device *de container_of(desc, struct talitos_edesc, desc);struct talitos_ahash_req_ctx *req_ctx =ahash_request_ctx (areq); -if (!req_ctx->last && req_ctx->to_hash_later) { +if (!req_ctx->last_desc && req_ctx->to_hash_later) {/* Position any partial block for next update/final/finup */ req_ctx->buf_idx = (req_ctx->buf_idx +1 ) &1 ; req_ctx->nbuf = req_ctx->to_hash_later;
@@ -1825,7 +1825,7 @@ static int common_nonsnoop_hash(struct t/* first DWORD empty */ /* hash context in */ -if (!req_ctx->first || req_ctx->swinit) { +if (!req_ctx->first_desc || req_ctx->swinit) { map_single_talitos_ptr_nosync(dev, &desc->ptr[1], req_ctx->hw_context_size, req_ctx->hw_context,
@@ -1833,7 +1833,7 @@ static int common_nonsnoop_hash(struct t req_ctx->swinit =0 ; }/* Indicate next op is not the first. */ - req_ctx->first =0 ; + req_ctx->first_desc =0 ;/* HMAC key */ if (ctx->keylen)
@@ -1866,7 +1866,7 @@ static int common_nonsnoop_hash(struct t/* fifth DWORD empty */ /* hash/HMAC out -or- hash context out */ -if (req_ctx->last) +if (req_ctx->last_desc)map_single_talitos_ptr (dev, &desc->ptr[5 ],crypto_ahash_digestsize (tfm), req_ctx->hw_context,DMA_FROM_DEVICE );
@@ -1908,7 +1908,7 @@ static int common_nonsnoop_hash(struct tif (sg_count >1 ) sync_needed = true;copy_talitos_ptr (&desc2->ptr[5 ], &desc->ptr[5 ], is_sec1); -if (req_ctx->last) +if (req_ctx->last_desc) map_single_talitos_ptr_nosync(dev, &desc->ptr[5], req_ctx->hw_context_size, req_ctx->hw_context,
@@ -1964,7 +1964,7 @@ static int ahash_process_req_one(structbool is_sec1 =has_ftr_sec1 (priv);u8 *ctx_buf = req_ctx->buf[req_ctx->buf_idx]; -if (!req_ctx->last && (nbytes + req_ctx->nbuf <= blocksize)) { +if (!req_ctx->last_desc && (nbytes + req_ctx->nbuf <= blocksize)) {/* Buffer up to one whole block */ nents =sg_nents_for_len (req_ctx->request_sl, nbytes);if (nents <0 ) {
@@ -1981,7 +1981,7 @@ static int ahash_process_req_one(struct nbytes_to_hash = nbytes + req_ctx->nbuf; to_hash_later = nbytes_to_hash & (blocksize -1 ); -if (req_ctx->last) +if (req_ctx->last_desc) to_hash_later =0 ;else if (to_hash_later)/* There is a partial block. Hash the full block(s) now */
@@ -2041,19 +2041,19 @@ static int ahash_process_req_one(struct edesc->desc.hdr = ctx->desc_hdr_template;/* On last one, request SEC to pad; otherwise continue */ -if (req_ctx->last) +if (req_ctx->last_desc) edesc->desc.hdr |=DESC_HDR_MODE0_MDEU_PAD ;else edesc->desc.hdr |=DESC_HDR_MODE0_MDEU_CONT ;/* request SEC to INIT hash. */ -if (req_ctx->first && !req_ctx->swinit) +if (req_ctx->first_desc && !req_ctx->swinit) edesc->desc.hdr |=DESC_HDR_MODE0_MDEU_INIT ;/* When the tfm context has a keylen, it's an HMAC. * A first or last (ie. not middle) descriptor must request HMAC. */ -if (ctx->keylen && (req_ctx->first || req_ctx->last)) +if (ctx->keylen && (req_ctx->first_desc || req_ctx->last_desc)) edesc->desc.hdr |=DESC_HDR_MODE0_MDEU_HMAC ;return common_nonsnoop_hash (edesc, req_ctx->areq, nbytes_to_hash, ahash_done);
@@ -2076,7 +2076,7 @@ static void sec1_ahash_process_remaining req_ctx->remaining_ahash_request_bytes;if (req_ctx->last_request) - req_ctx->last =1 ; + req_ctx->last_desc =1 ; } err = ahash_process_req_one(req_ctx->areq,
@@ -2103,7 +2103,7 @@ static int ahash_process_req(struct ahasif (nbytes >TALITOS1_MAX_DATA_LEN ) nbytes =TALITOS1_MAX_DATA_LEN ;else if (req_ctx->last_request) - req_ctx->last =1 ; + req_ctx->last_desc =1 ; } req_ctx->current_ahash_request_bytes = nbytes;
@@ -2124,14 +2124,14 @@ static int ahash_init(struct ahash_reque/* Initialize the context */ req_ctx->buf_idx =0 ; req_ctx->nbuf =0 ; - req_ctx->first =1 ;/* first indicates h/w must init its context */ + req_ctx->first_desc =1 ;/* first_desc indicates h/w must init its context */ req_ctx->swinit =0 ;/* assume h/w init of context */ size = (crypto_ahash_digestsize (tfm) <=SHA256_DIGEST_SIZE ) ?TALITOS_MDEU_CONTEXT_SIZE_MD5_SHA1_SHA256 :TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512 ; req_ctx->hw_context_size = size; req_ctx->last_request =0 ; - req_ctx->last =0 ; + req_ctx->last_desc =0 ;INIT_WORK (&req_ctx->sec1_ahash_process_remaining, sec1_ahash_process_remaining); dma = dma_map_single(dev, req_ctx->hw_context, req_ctx->hw_context_size,
@@ -2223,8 +2223,8 @@ static int ahash_export(struct ahash_req req_ctx->hw_context_size);memcpy (export->buf, req_ctx->buf[req_ctx->buf_idx], req_ctx->nbuf); export->swinit = req_ctx->swinit; - export->first = req_ctx->first; - export->last = req_ctx->last; + export->first_desc = req_ctx->first_desc; + export->last_desc = req_ctx->last_desc; export->to_hash_later = req_ctx->to_hash_later; export->nbuf = req_ctx->nbuf;
@@ -2249,8 +2249,8 @@ static int ahash_import(struct ahash_reqmemcpy (req_ctx->hw_context, export->hw_context, size);memcpy (req_ctx->buf[0 ], export->buf, export->nbuf); req_ctx->swinit = export->swinit; - req_ctx->first = export->first; - req_ctx->last = export->last; + req_ctx->first_desc = export->first_desc; + req_ctx->last_desc = export->last_desc; req_ctx->to_hash_later = export->to_hash_later; req_ctx->nbuf = export->nbuf;
Greg Kroah-Hartman
maintainerPATCH 89/474 tpm: tpm_tis: add error logging for data transfer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacqueline Wong <[email protected]>
commit 0471921e2d1043dcc6de5cffb49dd37709521abe upstream.
Add logging to more easily determine reason for transmit failure
--- drivers/char/tpm/tpm_tis_core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/char/tpm/tpm_tis_core.c +4 -0
@@ -472,6 +472,8 @@ static int tpm_tis_send_data(struct tpm_ status =tpm_tis_status (chip);if (!itpm && (status &TPM_STS_DATA_EXPECT ) ==0 ) { rc = -EIO ; +dev_err (&chip->dev,"TPM_STS_DATA_EXPECT should be set. sts = 0x%08x\n" , + status); goto out_err; } }
@@ -492,6 +494,8 @@ static int tpm_tis_send_data(struct tpm_ status =tpm_tis_status (chip);if (!itpm && (status &TPM_STS_DATA_EXPECT ) !=0 ) { rc = -EIO ; +dev_err (&chip->dev,"TPM_STS_DATA_EXPECT should be unset. sts = 0x%08x\n" , + status); goto out_err; }
Greg Kroah-Hartman
maintainerPATCH 90/474 tpm: tpm_tis: stop transmit if retries are exhausted
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacqueline Wong <[email protected]>
commit 949692da7211572fac419b2986b6abc0cd1aeb76 upstream.
tpm_tis_send_main() will attempt to retry sending data TPM_RETRY times. Currently, if those retries are exhausted, the driver will attempt to call execute. The TPM will be in the wrong state, leading to the operation simply timing out.
Instead, if there is still an error after retries are exhausted, return that error immediately.
--- drivers/char/tpm/tpm_tis_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_core.c +6 -1
@@ -557,11 +557,16 @@ static int tpm_tis_send_main(struct tpm_break ; else if (rc != -EAGAIN && rc != -EIO)/* Data transfer failed, not recoverable */ -return rc; + goto out_err;usleep_range (priv->timeout_min, priv->timeout_max); } +if (rc == -EAGAIN || rc == -EIO ) { +dev_err (&chip->dev,"Exhausted %d tpm_tis_send_data retries\n" ,TPM_RETRY ); + goto out_err; + } +/* go and do it */ rc =tpm_tis_write8 (priv,TPM_STS (priv->locality),TPM_STS_GO );if (rc <0 )
Greg Kroah-Hartman
maintainerPATCH 91/474 rtc: ntxec: fix OF node reference imbalance
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 30c4d2f26bb3538c328035cea2e6265c8320539e upstream.
The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.
Fix this by using the intended helper for reusing OF nodes.
--- drivers/rtc/rtc-ntxec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ntxec.c +1 -1
@@ -110,7 +110,7 @@ static int ntxec_rtc_probe(struct platfostruct rtc_device *dev;struct ntxec_rtc *rtc; - pdev->dev.of_node = pdev->dev.parent->of_node; +device_set_of_node_from_dev (&pdev->dev, pdev->dev.parent); rtc =devm_kzalloc (&pdev->dev,sizeof (*rtc),GFP_KERNEL );if (!rtc)
Greg Kroah-Hartman
maintainerPATCH 92/474 mm/damon/core: use time_in_range_open() for damos quota window start
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 049a57421dd67a28c45ae7e92c36df758033e5fa upstream.
damos_adjust_quota() uses time_after_eq() to show if it is time to start a new quota charge window, comparing the current jiffies and the scheduled next charge window start time. If it is, the next charge window start time is updated and the new charge window starts.
The time check and next window start time update is skipped while the scheme is deactivated by the watermarks. Let's suppose the deactivation is kept more than LONG_MAX jiffies (assuming CONFIG_HZ of 250, more than 99 days in 32 bit systems and more than one billion years in 64 bit systems), resulting in having the jiffies larger than the next charge window start time + LONG_MAX. Then, the time_after_eq() call can return false until another LONG_MAX jiffies are passed.
This means the scheme can continue working after being reactivated by the watermarks. But, soon, the quota will be exceeded and the scheme will again effectively stop working until the next charge window starts. Because the current charge window is extended to up to LONG_MAX jiffies, however, it will look like it stopped unexpectedly and indefinitely, from the user's perspective.
Fix this by using !time_in_range_open() instead.
The issue was discovered [1] by sashiko.
--- mm/damon/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/damon/core.c +2 -1
@@ -1048,7 +1048,8 @@ static void damos_adjust_quota(struct da quota->charged_from = jiffies;/* New charge window starts */ -if (time_after_eq (jiffies, quota->charged_from + +if (!time_in_range_open (jiffies, quota->charged_from, + quota->charged_from +msecs_to_jiffies (quota->reset_interval))) {if (quota->esz && quota->charged_sz >= quota->esz) s->stat.qt_exceeds++;
Greg Kroah-Hartman
maintainerPATCH 93/474 userfaultfd: allow registration of ranges below mmap_min_addr
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis M. Karpov <[email protected]>
commit 161ce69c2c89781784b945d8e281ff2da9dede9c upstream.
The current implementation of validate_range() in fs/userfaultfd.c performs a hard check against mmap_min_addr. This is redundant because UFFDIO_REGISTER operates on memory ranges that must already be backed by a VMA.
Enforcing mmap_min_addr or capability checks again in userfaultfd is unnecessary and prevents applications like binary compilers from using UFFD for valid memory regions mapped by application.
Remove the redundant check for mmap_min_addr.
We started using UFFD instead of the classic mprotect approach in the binary translator to track application writes. During development, we encountered this bug. The translator cannot control where the translated application chooses to map its memory and if the app requires a low-address area, UFFD fails, whereas mprotect would work just fine. I believe this is a genuine logic bug rather than an improvement, and I would appreciate including the fix in stable.
--- fs/userfaultfd.c | 2 -- 1 file changed, 2 deletions(-)
fs/userfaultfd.c +0 -2
@@ -1295,8 +1295,6 @@ static __always_inline int validate_unalreturn -EINVAL ;if (!len)return -EINVAL ; -if (start < mmap_min_addr) -return -EINVAL ;if (start >= task_size)return -EINVAL ;if (len > task_size - start)
Greg Kroah-Hartman
maintainerPATCH 94/474 KVM: x86: Defer non-architectural deliver of exception payload to userspace read
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit d0ad1b05bbe6f8da159a4dfb6692b3b7ce30ccc8 upstream.
When attempting to play nice with userspace that hasn't enabled KVM_CAP_EXCEPTION_PAYLOAD, defer KVM's non-architectural delivery of the payload until userspace actually reads relevant vCPU state, and more importantly, force delivery of the payload in *all* paths where userspace saves relevant vCPU state, not just KVM_GET_VCPU_EVENTS.
Ignoring userspace save/restore for the moment, delivering the payload before the exception is injected is wrong regardless of whether L1 or L2 is running. To make matters even more confusing, the flaw *currently* being papered over by the !is_guest_mode() check isn't even the same bug that commit da998b46d244 ("kvm: x86: Defer setting of CR2 until #PF delivery") was trying to avoid.
At the time of commit da998b46d244, KVM didn't correctly handle exception intercepts, as KVM would wait until VM-Entry into L2 was imminent to check if the queued exception should morph to a nested VM-Exit. I.e. KVM would deliver the payload to L2 and then synthesize a VM-Exit into L1. But the payload was only the most blatant issue, e.g. waiting to check exception intercepts would also lead to KVM incorrectly escalating a should-be-intercepted #PF into a #DF.
That underlying bug was eventually fixed by commit 7709aba8f716 ("KVM: x86:
Morph pending exceptions to pending VM-Exits at queue time"), but in the interim, commit a06230b62b89 ("KVM: x86: Deliver exception payload on KVM_GET_VCPU_EVENTS") came along and subtly added another dependency on the !is_guest_mode() check.
While not recorded in the changelog, the motivation for deferring the !exception_payload_enabled delivery was to fix a flaw where a synthesized MTF (Monitor Trap Flag) VM-Exit would drop a pending #DB and clobber DR6. On a VM-Exit, VMX CPUs save pending #DB information into the VMCS, which is emulated by KVM in nested_vmx_update_pending_dbg() by grabbing the payload from the queue/pending exception. I.e. prematurely delivering the payload would cause the pending #DB to not be recorded in the VMCS, and of course, clobber L2's DR6 as seen by L1.
Jumping back to save+restore, the quirked behavior of forcing delivery of the payload only works if userspace does KVM_GET_VCPU_EVENTS *before* CR2 or DR6 is saved, i.e. before KVM_GET_SREGS{,2} and KVM_GET_DEBUGREGS. E.g. if userspace does KVM_GET_SREGS before KVM_GET_VCPU_EVENTS, then the CR2 saved by userspace won't contain the payload for the exception save by KVM_GET_VCPU_EVENTS.
Deliberately deliver the payload in the store_regs() path, as it's the least awful option even though userspace may not be doing save+restore. Because if userspace _is_ doing save restore, it could elide KVM_GET_SREGS knowing that SREGS were already saved when the vCPU exited.
--- arch/x86/kvm/x86.c | 62 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 23 deletions(-)
arch/x86/kvm/x86.c +39 -23
@@ -695,9 +695,6 @@ static void kvm_multiple_exception(struc vcpu->arch.exception.error_code = error_code; vcpu->arch.exception.has_payload = has_payload; vcpu->arch.exception.payload = payload; -if (!is_guest_mode (vcpu)) -kvm_deliver_exception_payload (vcpu, - &vcpu->arch.exception);return ; }
@@ -5147,18 +5144,8 @@ static int kvm_vcpu_ioctl_x86_set_mce(streturn 0 ; } -static void kvm_vcpu_ioctl_x86_get_vcpu_events (struct kvm_vcpu *vcpu, -struct kvm_vcpu_events *events) +static struct kvm_queued_exception *kvm_get_exception_to_save (struct kvm_vcpu *vcpu) { -struct kvm_queued_exception *ex; - -process_nmi (vcpu); - -#ifdef CONFIG_KVM_SMM -if (kvm_check_request (KVM_REQ_SMI , vcpu)) -process_smi (vcpu); -#endif -/* * KVM's ABI only allows for one exception to be migrated. Luckily, * the only time there can be two queued exceptions is if there's a
@@ -5169,21 +5156,46 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_if (vcpu->arch.exception_vmexit.pending && !vcpu->arch.exception.pending && !vcpu->arch.exception.injected) - ex = &vcpu->arch.exception_vmexit; -else - ex = &vcpu->arch.exception; +return &vcpu->arch.exception_vmexit; + +return &vcpu->arch.exception; +} + +static void kvm_handle_exception_payload_quirk (struct kvm_vcpu *vcpu) +{ +struct kvm_queued_exception *ex =kvm_get_exception_to_save (vcpu);/* -* In guest mode, payload delivery should be deferred if the exception -* will be intercepted by L1, e.g. KVM should not modifying CR2 if L1 -* intercepts #PF, ditto for DR6 and #DBs. If the per-VM capability, -* KVM_CAP_EXCEPTION_PAYLOAD, is not set, userspace may or may not -* propagate the payload and so it cannot be safely deferred. Deliver -* the payload if the capability hasn't been requested. +* If KVM_CAP_EXCEPTION_PAYLOAD is disabled, then (prematurely) deliver +* the pending exception payload when userspace saves *any* vCPU state +* that interacts with exception payloads to avoid breaking userspace. +* +* Architecturally, KVM must not deliver an exception payload until the +* exception is actually injected, e.g. to avoid losing pending #DB +* information (which VMX tracks in the VMCS), and to avoid clobbering +* state if the exception is never injected for whatever reason. But +* if KVM_CAP_EXCEPTION_PAYLOAD isn't enabled, then userspace may or +* may not propagate the payload across save+restore, and so KVM can't +* safely defer delivery of the payload. */ if (!vcpu->kvm->arch.exception_payload_enabled && ex->pending && ex->has_payload)kvm_deliver_exception_payload (vcpu, ex); +} + +static void kvm_vcpu_ioctl_x86_get_vcpu_events (struct kvm_vcpu *vcpu, +struct kvm_vcpu_events *events) +{ +struct kvm_queued_exception *ex =kvm_get_exception_to_save (vcpu); + +process_nmi (vcpu); + +#ifdef CONFIG_KVM_SMM +if (kvm_check_request (KVM_REQ_SMI , vcpu)) +process_smi (vcpu); +#endif + +kvm_handle_exception_payload_quirk (vcpu);memset (events,0 ,sizeof (*events));
@@ -5364,6 +5376,8 @@ static void kvm_vcpu_ioctl_x86_get_debug {unsigned long val; +kvm_handle_exception_payload_quirk (vcpu); +memset (dbgregs,0 ,sizeof (*dbgregs));memcpy (dbgregs->db, vcpu->arch.db,sizeof (vcpu->arch.db));kvm_get_dr (vcpu,6 , &val);
@@ -11396,6 +11410,8 @@ static void __get_sregs_common(struct kvif (vcpu->arch.guest_state_protected) goto skip_protected_regs; +kvm_handle_exception_payload_quirk (vcpu); +kvm_get_segment (vcpu, &sregs->cs,VCPU_SREG_CS );kvm_get_segment (vcpu, &sregs->ds,VCPU_SREG_DS );kvm_get_segment (vcpu, &sregs->es,VCPU_SREG_ES );
Greg Kroah-Hartman
maintainerPATCH 68/474 tools/accounting: handle truncated taskstats netlink messages
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yiyang Chen <[email protected]>
commit cc82b3dcc6a8fa259fbda12ab00d6fc00908a49e upstream.
procacct and getdelays use a fixed receive buffer for taskstats generic netlink messages. A multi-threaded process exit can emit a single PID+TGID notification large enough to exceed that buffer on newer kernels.
Switch to recvmsg() so MSG_TRUNC is detected explicitly, increase the message buffer size, and report truncated datagrams clearly instead of misparsing them as fatal netlink errors.
Also print the taskstats version in debug output to make version mismatches easier to diagnose while inspecting taskstats traffic.
--- tools/accounting/getdelays.c | 41 +++++++++++++++++++++++++++++++++++++---- tools/accounting/procacct.c | 40 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 73 insertions(+), 8 deletions(-)
tools/accounting/getdelays.c +37 -4
@@ -59,7 +59,7 @@ int print_task_context_switch_counts; }/* Maximum size of response requested or message sent */ -#define MAX_MSG_SIZE 1024 +#define MAX_MSG_SIZE 2048/* Maximum number of cpus expected to be specified in a cpumask */ #define MAX_CPUS 32
@@ -114,6 +114,32 @@ error:return -1 ; } +static int recv_taskstats_msg (int sd,struct msgtemplate *msg) +{ +struct sockaddr_nl nladdr; +struct iovec iov = { + .iov_base = msg, + .iov_len =sizeof (*msg), + }; +struct msghdr hdr = { + .msg_name = &nladdr, + .msg_namelen =sizeof (nladdr), + .msg_iov = &iov, + .msg_iovlen =1 , + }; +int ret; + + ret =recvmsg (sd, &hdr,0 ); +if (ret <0 ) +return -1 ; +if (hdr.msg_flags &MSG_TRUNC ) { + errno =EMSGSIZE ; +return -1 ; + } + +return ret; +} + static int send_cmd(int sd, __u16 nlmsg_type, __u32 nlmsg_pid, __u8 genl_cmd, __u16 nla_type,
@@ -465,12 +491,16 @@ int main(int argc, char *argv[]) } do { - rep_len = recv(nl_sd, &msg, sizeof(msg), 0); + rep_len = recv_taskstats_msg(nl_sd, &msg); PRINTF("received %d bytes\n", rep_len); if (rep_len < 0) { - fprintf(stderr, "nonfatal reply error: errno %d\n", - errno); + if (errno == EMSGSIZE) + fprintf(stderr, + "dropped truncated taskstats netlink message, please increase MAX_MSG_SIZE\n"); + else + fprintf(stderr, "nonfatal reply error: errno %d\n", + errno); continue; } if (msg.n.nlmsg_type == NLMSG_ERROR ||
@@ -512,6 +542,9 @@ int main(int argc, char *argv[])printf ("TGID\t%d\n" , rtid);break ;case TASKSTATS_TYPE_STATS : +PRINTF ("version %u\n" , + ((struct taskstats *) +NLA_DATA (na))->version);if (print_delays)print_delayacct ((struct taskstats *)NLA_DATA (na));if (print_io_accounting)
tools/accounting/procacct.c +36 -4
@@ -71,7 +71,7 @@ int print_task_context_switch_counts; }/* Maximum size of response requested or message sent */ -#define MAX_MSG_SIZE 1024 +#define MAX_MSG_SIZE 2048/* Maximum number of cpus expected to be specified in a cpumask */ #define MAX_CPUS 32
@@ -121,6 +121,32 @@ error:return -1 ; } +static int recv_taskstats_msg (int sd,struct msgtemplate *msg) +{ +struct sockaddr_nl nladdr; +struct iovec iov = { + .iov_base = msg, + .iov_len =sizeof (*msg), + }; +struct msghdr hdr = { + .msg_name = &nladdr, + .msg_namelen =sizeof (nladdr), + .msg_iov = &iov, + .msg_iovlen =1 , + }; +int ret; + + ret =recvmsg (sd, &hdr,0 ); +if (ret <0 ) +return -1 ; +if (hdr.msg_flags &MSG_TRUNC ) { + errno =EMSGSIZE ; +return -1 ; + } + +return ret; +} + static int send_cmd(int sd, __u16 nlmsg_type, __u32 nlmsg_pid, __u8 genl_cmd, __u16 nla_type,
@@ -239,6 +265,8 @@ void handle_aggr(int mother, struct nlatPRINTF ("TGID\t%d\n" , rtid);break ;case TASKSTATS_TYPE_STATS : +PRINTF ("version %u\n" , + ((struct taskstats *)NLA_DATA (na))->version);if (mother ==TASKSTATS_TYPE_AGGR_PID )print_procacct ((struct taskstats *)NLA_DATA (na));if (fd) {
@@ -348,12 +376,16 @@ int main(int argc, char *argv[]) } do { - rep_len = recv(nl_sd, &msg, sizeof(msg), 0); + rep_len = recv_taskstats_msg(nl_sd, &msg); PRINTF("received %d bytes\n", rep_len); if (rep_len < 0) { - fprintf(stderr, "nonfatal reply error: errno %d\n", - errno); + if (errno == EMSGSIZE) + fprintf(stderr, + "dropped truncated taskstats netlink message, please increase MAX_MSG_SIZE\n"); + else + fprintf(stderr, "nonfatal reply error: errno %d\n", + errno); continue; } if (msg.n.nlmsg_type == NLMSG_ERROR ||
Greg Kroah-Hartman
maintainerPATCH 95/474 KVM: nSVM: Mark all of vmcb02 dirty when restoring nested state
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit e63fb1379f4b9300a44739964e69549bebbcdca4 upstream.
When restoring a vCPU in guest mode, any state restored before KVM_SET_NESTED_STATE (e.g. KVM_SET_SREGS) will mark the corresponding dirty bits in vmcb01, as it is the active VMCB before switching to vmcb02 in svm_set_nested_state().
Hence, mark all fields in vmcb02 dirty in svm_set_nested_state() to capture any previously restored fields.
--- arch/x86/kvm/svm/nested.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/x86/kvm/svm/nested.c +6 -0
@@ -1753,6 +1753,12 @@ static int svm_set_nested_state(struct knested_vmcb02_prepare_control (svm, svm->vmcb->save.rip, svm->vmcb->save.cs.base);/* +* Any previously restored state (e.g. KVM_SET_SREGS) would mark fields +* dirty in vmcb01 instead of vmcb02, so mark all of vmcb02 dirty here. +*/ +vmcb_mark_all_dirty (svm->vmcb); + +/* * While the nested guest CR3 is already checked and set by * KVM_SET_SREGS, it was set when nested state was yet loaded, * thus MMU might not be initialized correctly.
Greg Kroah-Hartman
maintainerPATCH 96/474 KVM: nSVM: Sync NextRIP to cached vmcb12 after VMRUN of L2
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 778d8c1b2a6ffe622ddcd3bb35b620e6e41f4da0 upstream.
After VMRUN in guest mode, nested_sync_control_from_vmcb02() syncs fields written by the CPU from vmcb02 to the cached vmcb12. This is because the cached vmcb12 is used as the authoritative copy of some of the controls, and is the payload when saving/restoring nested state.
NextRIP is also written by the CPU (in some cases) after VMRUN, but is not sync'd to the cached vmcb12. As a result, it is corrupted after save/restore (replaced by the original value written by L1 on nested VMRUN). This could cause problems for both KVM (e.g. when injecting a soft IRQ) or L1 (e.g. when using NextRIP to advance RIP after emulating an instruction).
Fix this by sync'ing NextRIP to the cache after VMRUN of L2, but only after completing interrupts (not in nested_sync_control_from_vmcb02()), as KVM may update NextRIP (e.g. when re-injecting a soft IRQ).
--- arch/x86/kvm/svm/svm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/x86/kvm/svm/svm.c +10 -0
@@ -4339,6 +4339,16 @@ static __no_kcsan fastpath_t svm_vcpu_rusvm_complete_interrupts (vcpu); +/* +* Update the cache after completing interrupts to get an accurate +* NextRIP, e.g. when re-injecting a soft interrupt. +* +* FIXME: Rework svm_get_nested_state() to not pull data from the +* cache (except for maybe int_ctl). +*/ +if (is_guest_mode (vcpu)) + svm->nested.ctl.next_rip = svm->vmcb->control.next_rip; +return svm_exit_handlers_fastpath (vcpu); }
Greg Kroah-Hartman
maintainerPATCH 97/474 KVM: nSVM: Sync interrupt shadow to cached vmcb12 after VMRUN of L2
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 03bee264f8ebfd39e0254c98e112d033a7aa9055 upstream.
After VMRUN in guest mode, nested_sync_control_from_vmcb02() syncs fields written by the CPU from vmcb02 to the cached vmcb12. This is because the cached vmcb12 is used as the authoritative copy of some of the controls, and is the payload when saving/restoring nested state.
int_state is also written by the CPU, specifically bit 0 (i.e. SVM_INTERRUPT_SHADOW_MASK) for nested VMs, but it is not sync'd to cached vmcb12. This does not cause a problem if KVM_SET_NESTED_STATE preceeds KVM_SET_VCPU_EVENTS in the restore path, as an interrupt shadow would be correctly restored to vmcb02 (KVM_SET_VCPU_EVENTS overwrites what KVM_SET_NESTED_STATE restored in int_state).
However, if KVM_SET_VCPU_EVENTS preceeds KVM_SET_NESTED_STATE, an interrupt shadow would be restored into vmcb01 instead of vmcb02. This would mostly be benign for L1 (delays an interrupt), but not for L2. For L2, the vCPU could hang (e.g. if a wakeup interrupt is delivered before a HLT that should have been in an interrupt shadow).
Sync int_state to the cached vmcb12 in nested_sync_control_from_vmcb02() to avoid this problem. With that, KVM_SET_NESTED_STATE restores the correct interrupt shadow state, and if KVM_SET_VCPU_EVENTS follows it would overwrite it with the same value.
--- arch/x86/kvm/svm/nested.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kvm/svm/nested.c +1 -0
@@ -412,6 +412,7 @@ void nested_sync_control_from_vmcb02(stru32 mask; svm->nested.ctl.event_inj = svm->vmcb->control.event_inj; svm->nested.ctl.event_inj_err = svm->vmcb->control.event_inj_err; + svm->nested.ctl.int_state = svm->vmcb->control.int_state;/* Only a few fields of int_ctl are written by the processor. */ mask =V_IRQ_MASK |V_TPR_MASK ;
Greg Kroah-Hartman
maintainerPATCH 98/474 KVM: SVM: Inject #UD for INVLPGA if EFER.SVME=0
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Cheng <[email protected]>
commit d99df02ff427f461102230f9c5b90a6c64ee8e23 upstream.
INVLPGA should cause a #UD when EFER.SVME is not set. Add a check to properly inject #UD when EFER.SVME=0.
--- arch/x86/kvm/svm/svm.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kvm/svm/svm.c +3 -0
@@ -2494,6 +2494,9 @@ static int invlpga_interception(struct kgva_t gva =kvm_rax_read (vcpu);u32 asid =kvm_rcx_read (vcpu); +if (nested_svm_check_permissions (vcpu)) +return 1 ; +/* FIXME: Handle an address size prefix. */ if (!is_long_mode (vcpu)) gva = (u32 )gva;
Greg Kroah-Hartman
maintainerPATCH 99/474 KVM: SVM: Explicitly mark vmcb01 dirty after modifying VMCB intercepts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit d5bde6113aed8315a2bfe708730b721be9c2f48b upstream.
When reacting to an intercept update, explicitly mark vmcb01's intercepts dirty, as KVM always initially operates on vmcb01, and nested_svm_vmexit() isn't guaranteed to mark VMCB_INTERCEPTS as dirty. I.e. if L2 is active, KVM will modify the intercepts for L1, but might not mark them as dirty before the next VMRUN of L1.
--- arch/x86/kvm/svm/nested.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kvm/svm/nested.c +3 -1
@@ -129,11 +129,13 @@ void recalc_intercepts(struct vcpu_svm *struct vmcb_ctrl_area_cached *g;unsigned int i; -vmcb_mark_dirty (svm->vmcb,VMCB_INTERCEPTS ); +vmcb_mark_dirty (svm->vmcb01.ptr,VMCB_INTERCEPTS );if (!is_guest_mode (&svm->vcpu))return ; +vmcb_mark_dirty (svm->vmcb,VMCB_INTERCEPTS ); + c = &svm->vmcb->control; h = &svm->vmcb01.ptr->control; g = &svm->nested.ctl;
Greg Kroah-Hartman
maintainerPATCH 100/474 KVM: nSVM: Ensure AVIC is inhibited when restoring a vCPU to guest mode
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 24f7d36b824b65cf1a2db3db478059187b2a37b0 upstream.
On nested VMRUN, KVM ensures AVIC is inhibited by requesting KVM_REQ_APICV_UPDATE, triggering a check of inhibit reasons, finding APICV_INHIBIT_REASON_NESTED, and disabling AVIC.
However, when KVM_SET_NESTED_STATE is performed on a vCPU not in guest mode with AVIC enabled, KVM_REQ_APICV_UPDATE is not requested, and AVIC is not inhibited.
Request KVM_REQ_APICV_UPDATE in the KVM_SET_NESTED_STATE path if AVIC is active, similar to the nested VMRUN path.
--- arch/x86/kvm/svm/nested.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kvm/svm/nested.c +3 -0
@@ -1774,6 +1774,9 @@ static int svm_set_nested_state(struct k svm->nested.force_msr_bitmap_recalc = true; +if (kvm_vcpu_apicv_active (vcpu)) +kvm_make_request (KVM_REQ_APICV_UPDATE , vcpu); +kvm_make_request (KVM_REQ_GET_NESTED_STATE_PAGES , vcpu); ret =0 ; out_free:
Greg Kroah-Hartman
maintainerPATCH 101/474 KVM: nSVM: Use vcpu->arch.cr2 when updating vmcb12 on nested #VMEXIT
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 5c247d08bc81bbad4c662dcf5654137a2f8483ec upstream.
KVM currently uses the value of CR2 from vmcb02 to update vmcb12 on nested #VMEXIT. This value is incorrect in some cases, causing L1 to run L2 with a corrupted CR2. This could lead to segfaults or data corruption if L2 is in the middle of handling a #PF and reads a corrupted CR2. Use the correct value in vcpu->arch.cr2 instead.
The value in vcpu->arch.cr2 is sync'd to vmcb02 shortly before a VMRUN of L2, and sync'd back to vcpu->arch.cr2 shortly after. The value are only out-of-sync in two cases: after save+restore, and after a #PF is injected into L2. In either case, if a #VMEXIT to L1 is synthesized before L2 runs, using the value in vmcb02 would be incorrect.
After save+restore, the value of CR2 is restored by KVM_SET_SREGS into vcpu->arch.cr2. It is not reflect in vmcb02 until a VMRUN of L2. Before that, it holds whatever was in vmcb02 before restore, which would be zero on a new vCPU that never ran nested. If a #VMEXIT to L1 is synthesized before L2 ever runs, using vcpu->arch.cr2 to update vmcb12 is the right thing to do.
The #PF injection case is more nuanced. Although the APM is a bit unclear about when CR2 is written during a #PF, the SDM is more clear:
Processors update CR2 whenever a page fault is detected. If a second page fault occurs while an earlier page fault is being delivered, the faulting linear address of the second fault will overwrite the contents of CR2 (replacing the previous address). These updates to CR2 occur even if the page fault results in a double fault or occurs during the delivery of a double fault.
KVM injecting the exception surely counts as the #PF being "detected". More importantly, when an exception is injected into L2 at the time of a synthesized #VMEXIT, KVM updates exit_int_info in vmcb12 accordingly, such that an L1 hypervisor can re-inject the exception. If CR2 is not written at that point, the L1 hypervisor have no way of correctly re-injecting the #PF. Hence, if a #VMEXIT to L1 is synthesized after the #PF is injected into L2 but before it actually runs, using vcpu->arch.cr2 to update vmcb12 is also the right thing to do.
Note that KVM does _not_ update vcpu->arch.cr2 when a #PF is pending for L2, only when it is injected. The distinction is important, because only injected (but not intercepted) exceptions are propagated to L1 through exit_int_info. It would be incorrect to update CR2 in vmcb12 for a pending #PF, as L1 would perceive an updated CR2 value with no #PF.
--- arch/x86/kvm/svm/nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm/nested.c +1 -1
@@ -1005,7 +1005,7 @@ int nested_svm_vmexit(struct vcpu_svm *s vmcb12->save.efer = svm->vcpu.arch.efer; vmcb12->save.cr0 =kvm_read_cr0 (vcpu); vmcb12->save.cr3 =kvm_read_cr3 (vcpu); - vmcb12->save.cr2 = vmcb02->save.cr2; + vmcb12->save.cr2 = vcpu->arch.cr2; vmcb12->save.cr4 = svm->vcpu.arch.cr4; vmcb12->save.rflags =kvm_get_rflags (vcpu); vmcb12->save.rip =kvm_rip_read (vcpu);
Greg Kroah-Hartman
maintainerPATCH 102/474 KVM: nSVM: Always inject a #GP if mapping VMCB12 fails on nested VMRUN
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 01ddcdc55e097ca38c28ae656711b8e6d1df71f8 upstream.
nested_svm_vmrun() currently only injects a #GP if kvm_vcpu_map() fails with -EINVAL. But it could also fail with -EFAULT if creating a host mapping failed. Inject a #GP in all cases, no reason to treat failure modes differently.
--- arch/x86/kvm/svm/nested.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kvm/svm/nested.c +1 -4
@@ -863,12 +863,9 @@ int nested_svm_vmrun(struct kvm_vcpu *vc } vmcb12_gpa = svm->vmcb->save.rax; - ret =kvm_vcpu_map (vcpu,gpa_to_gfn (vmcb12_gpa), &map); -if (ret == -EINVAL ) { +if (kvm_vcpu_map (vcpu,gpa_to_gfn (vmcb12_gpa), &map)) {kvm_inject_gp (vcpu,0 );return 1 ; - }else if (ret) { -return kvm_skip_emulated_instruction (vcpu); } ret =kvm_skip_emulated_instruction (vcpu);
Greg Kroah-Hartman
maintainerPATCH 103/474 KVM: nSVM: Clear GIF on nested #VMEXIT(INVALID)
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit f85a6ce06e4a0d49652f57967a649ab09e06287c upstream.
According to the APM, GIF is set to 0 on any #VMEXIT, including an #VMEXIT(INVALID) due to failed consistency checks. Clear GIF on consistency check failures.
--- arch/x86/kvm/svm/nested.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kvm/svm/nested.c +1 -0
@@ -884,6 +884,7 @@ int nested_svm_vmrun(struct kvm_vcpu *vc vmcb12->control.exit_code_hi =-1u ; vmcb12->control.exit_info_1 =0 ; vmcb12->control.exit_info_2 =0 ; +svm_set_gif (svm, false); goto out; }
Greg Kroah-Hartman
maintainerPATCH 104/474 KVM: nSVM: Clear EVENTINJ fields in vmcb12 on nested #VMEXIT
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 69b721a86d0dcb026f6db7d111dcde7550442d2e upstream.
According to the APM, from the reference of the VMRUN instruction:
Upon #VMEXIT, the processor performs the following actions in order to return to the host execution context:
...
clear EVENTINJ field in VMCB
KVM already syncs EVENTINJ fields from vmcb02 to cached vmcb12 on every L2->L0 #VMEXIT. Since these fields are zeroed by the CPU on #VMEXIT, they will mostly be zeroed in vmcb12 on nested #VMEXIT by nested_svm_vmexit().
However, this is not the case when:
1. Consistency checks fail, as nested_svm_vmexit() is not called.
2. Entering guest mode fails before L2 runs (e.g. due to failed load of
CR3).
(2) was broken by commit 2d8a42be0e2b ("KVM: nSVM: synchronize VMCB controls updated by the processor on every vmexit"), as prior to that nested_svm_vmexit() always zeroed EVENTINJ fields.
Explicitly clear the fields in all nested #VMEXIT code paths.
--- arch/x86/kvm/svm/nested.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/kvm/svm/nested.c +4 -2
@@ -884,6 +884,8 @@ int nested_svm_vmrun(struct kvm_vcpu *vc vmcb12->control.exit_code_hi =-1u ; vmcb12->control.exit_info_1 =0 ; vmcb12->control.exit_info_2 =0 ; + vmcb12->control.event_inj =0 ; + vmcb12->control.event_inj_err =0 ;svm_set_gif (svm, false); goto out; }
@@ -1025,9 +1027,9 @@ int nested_svm_vmexit(struct vcpu_svm *sif (guest_can_use (vcpu,X86_FEATURE_NRIPS )) vmcb12->control.next_rip = vmcb02->control.next_rip; + vmcb12->control.event_inj =0 ; + vmcb12->control.event_inj_err =0 ; vmcb12->control.int_ctl = svm->nested.ctl.int_ctl; - vmcb12->control.event_inj = svm->nested.ctl.event_inj; - vmcb12->control.event_inj_err = svm->nested.ctl.event_inj_err;if (!kvm_pause_in_guest (vcpu->kvm)) { vmcb01->control.pause_filter_count = vmcb02->control.pause_filter_count;
Greg Kroah-Hartman
maintainerPATCH 69/474 net: qrtr: ns: Free the node during ctrl_cmd_bye()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
commit 68efba36446a7774ea5b971257ade049272a07ac upstream.
A node sends the BYE packet when it is about to go down. So the nameserver should advertise the removal of the node to all remote and local observers and free the node finally. But currently, the nameserver doesn't free the node memory even after processing the BYE packet. This causes the node memory to leak.
Hence, remove the node from Xarray list and free the node memory during both success and failure case of ctrl_cmd_bye().
--- net/qrtr/ns.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
net/qrtr/ns.c +15 -5
@@ -339,7 +339,7 @@ static int ctrl_cmd_bye(struct sockaddr_struct qrtr_node *node;unsigned long index;struct kvec iv; -int ret; +int ret =0 ; iv.iov_base = &pkt; iv.iov_len =sizeof (pkt);
@@ -354,8 +354,10 @@ static int ctrl_cmd_bye(struct sockaddr_/* Advertise the removal of this client to all local servers */ local_node =node_get (qrtr_ns.local_node); -if (!local_node) -return 0 ; +if (!local_node) { + ret =0 ; + goto delete_node; + }memset (&pkt,0 ,sizeof (pkt)); pkt.cmd =cpu_to_le32 (QRTR_TYPE_BYE );
@@ -372,10 +374,18 @@ static int ctrl_cmd_bye(struct sockaddr_ ret =kernel_sendmsg (qrtr_ns.sock, &msg, &iv,1 ,sizeof (pkt));if (ret <0 ) {pr_err ("failed to send bye cmd\n" ); -return ret; + goto delete_node; } } -return 0 ; + +/* Ignore -ENODEV */ + ret =0 ; + +delete_node: +xa_erase (&nodes, from->sq_node); +kfree (node); + +return ret; } static int ctrl_cmd_del_client(struct sockaddr_qrtr *from,
Greg Kroah-Hartman
maintainerPATCH 105/474 KVM: nSVM: Clear tracking of L1->L2 NMI and soft IRQ on nested #VMEXIT
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 8998e1d012f3f45d0456f16706682cef04c3c436 upstream.
KVM clears tracking of L1->L2 injected NMIs (i.e. nmi_l1_to_l2) and soft IRQs (i.e. soft_int_injected) on a synthesized #VMEXIT(INVALID) due to failed VMRUN. However, they are not explicitly cleared in other synthesized #VMEXITs.
soft_int_injected is always cleared after the first VMRUN of L2 when completing interrupts, as any re-injection is then tracked by KVM (instead of purely in vmcb02).
nmi_l1_to_l2 is not cleared after the first VMRUN if NMI injection failed, as KVM still needs to keep track that the NMI originated from L1 to avoid blocking NMIs for L1. It is only cleared when the NMI injection succeeds.
KVM could synthesize a #VMEXIT to L1 before successfully injecting the NMI into L2 (e.g. due to a #NPF on L2's NMI handler in L1's NPTs). In this case, nmi_l1_to_l2 will remain true, and KVM may not correctly mask NMIs and intercept IRET when injecting an NMI into L1.
Clear both nmi_l1_to_l2 and soft_int_injected in nested_svm_vmexit(), i.e. for all #VMEXITs except those that occur due to failed consistency checks, as those happen before nmi_l1_to_l2 or soft_int_injected are set.
--- arch/x86/kvm/svm/nested.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/kvm/svm/nested.c +4 -2
@@ -913,8 +913,6 @@ int nested_svm_vmrun(struct kvm_vcpu *vc out_exit_err: svm->nested.nested_run_pending =0 ; - svm->nmi_l1_to_l2 = false; - svm->soft_int_injected = false; svm->vmcb->control.exit_code =SVM_EXIT_ERR ; svm->vmcb->control.exit_code_hi =-1u ;
@@ -1154,6 +1152,10 @@ int nested_svm_vmexit(struct vcpu_svm *sif (unlikely (vmcb01->save.rflags &X86_EFLAGS_TF ))kvm_queue_exception (&(svm->vcpu),DB_VECTOR ); +/* Drop tracking for L1->L2 injected NMIs and soft IRQs */ + svm->nmi_l1_to_l2 = false; + svm->soft_int_injected = false; +/* * Un-inhibit the AVIC right away, so that other vCPUs can start * to benefit from it right away.
Greg Kroah-Hartman
maintainerPATCH 106/474 KVM: nSVM: Add missing consistency check for EFER, CR0, CR4, and CS
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 96bd3e76a171a8e21a6387e54e4c420a81968492 upstream.
According to the APM Volume #2, 15.5, Canonicalization and Consistency Checks (24593—Rev. 3.42—March 2024), the following condition (among others) results in a #VMEXIT with VMEXIT_INVALID (aka SVM_EXIT_ERR):
EFER.LME, CR0.PG, CR4.PAE, CS.L, and CS.D are all non-zero.
In the list of consistency checks done when EFER.LME and CR0.PG are set, add a check that CS.L and CS.D are not both set, after the existing check that CR4.PAE is set.
This is functionally a nop because the nested VMRUN results in SVM_EXIT_ERR in HW, which is forwarded to L1, but KVM makes all consistency checks before a VMRUN is actually attempted.
--- arch/x86/kvm/svm/nested.c | 6 ++++++ arch/x86/kvm/svm/svm.h | 1 + 2 files changed, 7 insertions(+)
arch/x86/kvm/svm/nested.c +6 -0
@@ -304,6 +304,10 @@ static bool __nested_vmcb_check_save(str CC(!(save->cr0 & X86_CR0_PE)) || CC(kvm_vcpu_is_illegal_gpa(vcpu, save->cr3)))return false; + +if (CC ((save->cs.attrib &SVM_SELECTOR_L_MASK ) && + (save->cs.attrib &SVM_SELECTOR_DB_MASK ))) +return false; }/* Note, SVM doesn't have any additional restrictions on CR4. */
@@ -390,6 +394,8 @@ static void __nested_copy_vmcb_save_to_c* Copy only fields that are validated, as we need them * to avoid TOC/TOU races. */ + to->cs = from->cs; + to->efer = from->efer; to->cr0 = from->cr0; to->cr3 = from->cr3;
arch/x86/kvm/svm/svm.h +1 -0
@@ -115,6 +115,7 @@ struct kvm_vmcb_info { };struct vmcb_save_area_cached { +struct vmcb_seg cs;u64 efer;u64 cr4;u64 cr3;
Greg Kroah-Hartman
maintainerPATCH 107/474 KVM: nSVM: Add missing consistency check for nCR3 validity
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit b71138fcc362c67ebe66747bb22cb4e6b4d6a651 upstream.
Quoted 1 line
From the APM Volume #2, 15.25.4 (24593—Rev. 3.42—March 2024):
When VMRUN is executed with nested paging enabled (NP_ENABLE = 1), the following conditions are considered illegal state combinations, in addition to those mentioned in “Canonicalization and Consistency Checks”:
• Any MBZ bit of nCR3 is set.
• Any G_PAT.PA field has an unsupported type encoding or any reserved field in G_PAT has a nonzero value.
Add the consistency check for nCR3 being a legal GPA with no MBZ bits set. Note, the G_PAT.PA check is being handled separately[*].
--- arch/x86/kvm/svm/nested.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kvm/svm/nested.c +4 -0
@@ -265,6 +265,10 @@ static bool __nested_vmcb_check_controlsif (CC ((control->nested_ctl &SVM_NESTED_CTL_NP_ENABLE ) && !npt_enabled))return false; +if (CC ((control->nested_ctl &SVM_NESTED_CTL_NP_ENABLE ) && + !kvm_vcpu_is_legal_gpa (vcpu, control->nested_cr3))) +return false; +if (CC (!nested_svm_check_bitmap_pa (vcpu, control->msrpm_base_pa,MSRPM_SIZE )))return false;
Greg Kroah-Hartman
maintainerPATCH 108/474 mtd: docg3: Convert to platform remove callback returning void
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit eb0cec77d534413a800ec20944a2b1e37cfecdcf ]
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Stable-dep-of: ca19808bc6fa ("mtd: docg3: fix use-after-free in docg3_release()")
--- drivers/mtd/devices/docg3.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/mtd/devices/docg3.c +2 -3
@@ -2046,7 +2046,7 @@ static int __init docg3_probe(struct platform_device *pdev)* * Returns 0 */ -static int docg3_release (struct platform_device *pdev) +static void docg3_release (struct platform_device *pdev) {struct docg3_cascade *cascade =platform_get_drvdata (pdev);struct docg3 *docg3 = cascade->floors[0 ]->priv;
@@ -2058,7 +2058,6 @@ static int docg3_release(struct platform_device *pdev)doc_release_device (cascade->floors[floor]);bch_free (docg3->cascade->bch); -return 0 ; }#ifdef CONFIG_OF
@@ -2076,7 +2075,7 @@ static struct platform_driver g3_driver = { }, .suspend = docg3_suspend, .resume = docg3_resume, - .remove = docg3_release, + .remove_new = docg3_release, };module_platform_driver_probe (g3_driver, docg3_probe);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 109/474 mtd: docg3: fix use-after-free in docg3_release()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Kim <[email protected]>
[ Upstream commit ca19808bc6fac7e29420d8508df569b346b3e339 ]
In docg3_release(), the docg3 pointer is obtained from cascade->floors[0]->priv before the loop that calls doc_release_device() on each floor. doc_release_device() frees the docg3 struct via kfree(docg3) at line 1881. After the loop, docg3->cascade->bch dereferences the already-freed pointer.
Fix this by accessing cascade->bch directly, which is equivalent since docg3->cascade points back to the same cascade struct, and is already available as a local variable. This also removes the now-unused docg3 local variable.
--- drivers/mtd/devices/docg3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/devices/docg3.c +1 -2
@@ -2049,7 +2049,6 @@ static int __init docg3_probe(struct platform_device *pdev)static void docg3_release (struct platform_device *pdev) {struct docg3_cascade *cascade =platform_get_drvdata (pdev); -struct docg3 *docg3 = cascade->floors[0 ]->priv;int floor;doc_unregister_sysfs (pdev, cascade);
@@ -2057,7 +2056,7 @@ static void docg3_release(struct platform_device *pdev)if (cascade->floors[floor])doc_release_device (cascade->floors[floor]); -bch_free (docg3->cascade->bch); +bch_free (cascade->bch); }#ifdef CONFIG_OF
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 70/474 net: rds: fix MR cleanup on copy error
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ao Zhou <[email protected]>
commit 8141a2dc70080eda1aedc0389ed2db2b292af5bd upstream.
__rds_rdma_map() hands sg/pages ownership to the transport after get_mr() succeeds. If copying the generated cookie back to user space fails after that point, the error path must not free those resources again before dropping the MR reference.
Remove the duplicate unpin/free from the put_user() failure branch so that MR teardown is handled only through the existing final cleanup path.
--- net/rds/rdma.c | 4 ---- 1 file changed, 4 deletions(-)
net/rds/rdma.c +0 -4
@@ -326,10 +326,6 @@ static int __rds_rdma_map(struct rds_socif (args->cookie_addr &&put_user (cookie, (u64 __user *)(unsigned long )args->cookie_addr)) { -if (!need_odp) { -unpin_user_pages (pages, nr_pages); -kfree (sg); - } ret = -EFAULT ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 71/474 net: txgbe: fix firmware version check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawen Wu <[email protected]>
commit c263f644add3d6ad81f9d62a99284fde408f0caa upstream.
For the device SP, the firmware version is a 32-bit value where the lower 20 bits represent the base version number. And the customized firmware version populates the upper 12 bits with a specific identification number.
For other devices AML 25G and 40G, the upper 12 bits of the firmware version is always non-zero, and they have other naming conventions.
Only SP devices need to check this to tell if XPCS will work properly. So the judgement of MAC type is added here.
And the original logic compared the entire 32-bit value against 0x20010, which caused the outdated base firmwares bypass the version check without a warning. Apply a mask 0xfffff to isolate the lower 20 bits for an accurate base version comparison.
--- drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c +2 -1
@@ -696,7 +696,8 @@ static int txgbe_probe(struct pci_dev *p "0x%08x", etrack_id); } -if (etrack_id <0x20010 ) +if (wx->mac.type == wx_mac_sp && + ((etrack_id &0xfffff ) <0x20010 ))dev_warn (&pdev->dev,"Please upgrade the firmware to 0x20010 or above.\n" ); txgbe =devm_kzalloc (&pdev->dev,sizeof (*txgbe),GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 72/474 net/smc: avoid early lgr access in smc_clc_wait_msg
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruijie Li <[email protected]>
commit 5a8db80f721deee8e916c2cfdee78decda02ce4f upstream.
A CLC decline can be received while the handshake is still in an early stage, before the connection has been associated with a link group.
The decline handling in smc_clc_wait_msg() updates link-group level sync state for first-contact declines, but that state only exists after link group setup has completed. Guard the link-group update accordingly and keep the per-socket peer diagnosis handling unchanged.
This preserves the existing sync_err handling for established link-group contexts and avoids touching link-group state before it is available.
--- net/smc/smc_clc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/smc/smc_clc.c +2 -2
@@ -784,8 +784,8 @@ int smc_clc_wait_msg(struct smc_sock *sm dclc = (struct smc_clc_msg_decline *)clcm; reason_code =SMC_CLC_DECL_PEERDECL ; smc->peer_diagnosis =ntohl (dclc->peer_diagnosis); -if (((struct smc_clc_msg_decline *)buf)->hdr.typev2 & -SMC_FIRST_CONTACT_MASK ) { +if ((dclc->hdr.typev2 &SMC_FIRST_CONTACT_MASK ) && + smc->conn.lgr) { smc->conn.lgr->sync_err =1 ;smc_lgr_terminate_sched (smc->conn.lgr); }
Greg Kroah-Hartman
maintainerPATCH 73/474 net: ks8851: Reinstate disabling of BHs around IRQ handler
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 5c9fcac3c872224316714d0d8914d9af16c76a6d upstream.
If the driver executes ks8851_irq() AND a TX packet has been sent, then the driver enables TX queue via netif_wake_queue() which schedules TX softirq to queue packets for this device.
If CONFIG_PREEMPT_RT=y is set AND a packet has also been received by the MAC, then ks8851_rx_pkts() calls netdev_alloc_skb_ip_align() to allocate SKBs for the received packets. If netdev_alloc_skb_ip_align() is called with BH enabled, then local_bh_enable() at the end of netdev_alloc_skb_ip_align() will trigger the pending softirq processing, which may ultimately call the .xmit callback ks8851_start_xmit_par(). The ks8851_start_xmit_par() will try to lock struct ks8851_net_par .lock spinlock, which is already locked by ks8851_irq() from which ks8851_start_xmit_par() was called. This leads to a deadlock, which is reported by the kernel, including a trace listed below.
If CONFIG_PREEMPT_RT is not set, then since commit 0913ec336a6c0 ("net: ks8851: Fix deadlock with the SPI chip variant") the deadlock can also be triggered without received packet in the RX FIFO. The pending softirqs will be processed on return from spin_unlock_bh(&ks->statelock) in ks8851_irq(), which triggers the deadlock as well.
Fix the problem by disabling BH around critical sections, including the IRQ handler, thus preventing the net_tx_action() softirq from triggering during these critical sections. The net_tx_action() softirq is triggered once BH are re-enabled and at the end of the IRQ handler, once all the other IRQ handler actions have been completed.
__schedule from schedule_rtlock+0x1c/0x34 schedule_rtlock from rtlock_slowlock_locked+0x548/0x904 rtlock_slowlock_locked from rt_spin_lock+0x60/0x9c rt_spin_lock from ks8851_start_xmit_par+0x74/0x1a8 ks8851_start_xmit_par from netdev_start_xmit+0x20/0x44 netdev_start_xmit from dev_hard_start_xmit+0xd0/0x188 dev_hard_start_xmit from sch_direct_xmit+0xb8/0x25c sch_direct_xmit from __qdisc_run+0x1f8/0x4ec __qdisc_run from qdisc_run+0x1c/0x28
qdisc_run from net_tx_action+0x1f0/0x268 net_tx_action from handle_softirqs+0x1a4/0x270 handle_softirqs from __local_bh_enable_ip+0xcc/0xe0 __local_bh_enable_ip from __alloc_skb+0xd8/0x128 __alloc_skb from __netdev_alloc_skb+0x3c/0x19c __netdev_alloc_skb from ks8851_irq+0x388/0x4d4 ks8851_irq from irq_thread_fn+0x24/0x64 irq_thread_fn from irq_thread+0x178/0x28c irq_thread from kthread+0x12c/0x138
kthread from ret_from_fork+0x14/0x28
--- drivers/net/ethernet/micrel/ks8851.h | 6 -- drivers/net/ethernet/micrel/ks8851_common.c | 64 +++++++++++----------------- drivers/net/ethernet/micrel/ks8851_par.c | 15 ++---- drivers/net/ethernet/micrel/ks8851_spi.c | 11 +--- 4 files changed, 38 insertions(+), 58 deletions(-)
drivers/net/ethernet/micrel/ks8851.h +2 -4
@@ -408,10 +408,8 @@ struct ks8851_net {struct gpio_desc *gpio;struct mii_bus *mii_bus; -void (*lock)(struct ks8851_net *ks, -unsigned long *flags); -void (*unlock)(struct ks8851_net *ks, -unsigned long *flags); +void (*lock)(struct ks8851_net *ks); +void (*unlock)(struct ks8851_net *ks);unsigned int (*rdreg16)(struct ks8851_net *ks,unsigned int reg); void (*wrreg16)(struct ks8851_net *ks,
drivers/net/ethernet/micrel/ks8851_common.c +26 -38
243 lines not on this page · raw message
drivers/net/ethernet/micrel/ks8851_par.c +6 -9
@@ -55,29 +55,27 @@ struct ks8851_net_par {/** * ks8851_lock_par - register access lock * @ks: The chip state -* @flags: Spinlock flags * * Claim chip register access lock */ -static void ks8851_lock_par (struct ks8851_net *ks,unsigned long *flags) +static void ks8851_lock_par (struct ks8851_net *ks) {struct ks8851_net_par *ksp =to_ks8851_par (ks); -spin_lock_irqsave (&ksp->lock, *flags); +spin_lock_bh (&ksp->lock); }/** * ks8851_unlock_par - register access unlock * @ks: The chip state -* @flags: Spinlock flags * * Release chip register access lock */ -static void ks8851_unlock_par (struct ks8851_net *ks,unsigned long *flags) +static void ks8851_unlock_par (struct ks8851_net *ks) {struct ks8851_net_par *ksp =to_ks8851_par (ks); -spin_unlock_irqrestore (&ksp->lock, *flags); +spin_unlock_bh (&ksp->lock); }/**
@@ -233,7 +231,6 @@ static netdev_tx_t ks8851_start_xmit_par {struct ks8851_net *ks =netdev_priv (dev);netdev_tx_t ret =NETDEV_TX_OK ; -unsigned long flags;unsigned int txqcr;u16 txmir;int err;
@@ -241,7 +238,7 @@ static netdev_tx_t ks8851_start_xmit_parnetif_dbg (ks, tx_queued, ks->netdev,"%s: skb %p, %d@%p\n" , __func__, skb, skb->len, skb->data); -ks8851_lock_par (ks, &flags); +ks8851_lock_par (ks); txmir =ks8851_rdreg16_par (ks,KS_TXMIR ) &0x1fff ;
@@ -262,7 +259,7 @@ static netdev_tx_t ks8851_start_xmit_par ret =NETDEV_TX_BUSY ; } -ks8851_unlock_par (ks, &flags); +ks8851_unlock_par (ks);return ret; }
drivers/net/ethernet/micrel/ks8851_spi.c +4 -7
@@ -73,11 +73,10 @@ struct ks8851_net_spi {/** * ks8851_lock_spi - register access lock * @ks: The chip state -* @flags: Spinlock flags * * Claim chip register access lock */ -static void ks8851_lock_spi (struct ks8851_net *ks,unsigned long *flags) +static void ks8851_lock_spi (struct ks8851_net *ks) {struct ks8851_net_spi *kss =to_ks8851_spi (ks);
@@ -87,11 +86,10 @@ static void ks8851_lock_spi(struct ks885/** * ks8851_unlock_spi - register access unlock * @ks: The chip state -* @flags: Spinlock flags * * Release chip register access lock */ -static void ks8851_unlock_spi (struct ks8851_net *ks,unsigned long *flags) +static void ks8851_unlock_spi (struct ks8851_net *ks) {struct ks8851_net_spi *kss =to_ks8851_spi (ks);
@@ -311,7 +309,6 @@ static void ks8851_tx_work(struct work_sstruct ks8851_net_spi *kss;unsigned short tx_space;struct ks8851_net *ks; -unsigned long flags;struct sk_buff *txb;bool last;
@@ -319,7 +316,7 @@ static void ks8851_tx_work(struct work_s ks = &kss->ks8851; last =skb_queue_empty (&ks->txq); -ks8851_lock_spi (ks, &flags); +ks8851_lock_spi (ks);while (!last) { txb =skb_dequeue (&ks->txq);
@@ -345,7 +342,7 @@ static void ks8851_tx_work(struct work_s ks->tx_space = tx_space;spin_unlock_bh (&ks->statelock); -ks8851_unlock_spi (ks, &flags); +ks8851_unlock_spi (ks); }/**
Greg Kroah-Hartman
maintainerPATCH 74/474 net: ks8851: Avoid excess softirq scheduling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 22230e68b2cf1ab6b027be8cf1198164a949c4fa upstream.
The code injects a packet into netif_rx() repeatedly, which will add it to its internal NAPI and schedule a softirq, and process it. It is more efficient to queue multiple packets and process them all at the local_bh_enable() time.
--- drivers/net/ethernet/micrel/ks8851_common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/micrel/ks8851_common.c +4 -1
@@ -389,9 +389,12 @@ static irqreturn_t ks8851_irq(int irq, vif (status &IRQ_LCI )mii_check_link (&ks->mii); -if (status &IRQ_RXI ) +if (status &IRQ_RXI ) { +local_bh_disable ();while ((skb =__skb_dequeue (&rxq)))netif_rx (skb); +local_bh_enable (); + }return IRQ_HANDLED ; }
Greg Kroah-Hartman
maintainerPATCH 65/474 rxrpc: Fix memory leaks in rxkad_verify_response()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
commit 34f61a07e0cdefaecd3ec03bb5fb22215643678f upstream.
Fix rxkad_verify_response() to free the ticket and the server key under all circumstances by initialising the ticket pointer to NULL and then making all paths through the function after the first allocation has been done go through a single common epilogue that just releases everything - where all the releases skip on a NULL pointer.
--- net/rxrpc/rxkad.c | 103 ++++++++++++++++++++++-------------------------------- 1 file changed, 42 insertions(+), 61 deletions(-)
net/rxrpc/rxkad.c +42 -61
@@ -1047,7 +1047,7 @@ static int rxkad_verify_response(structstruct rxrpc_crypt session_key;struct key *server_key;time64_t expiry; -void *ticket; +void *ticket =NULL ;u32 version, kvno, ticket_len, level;__be32 csum;int ret, i;
@@ -1073,13 +1073,13 @@ static int rxkad_verify_response(struct ret = -ENOMEM ; response =kzalloc (sizeof (struct rxkad_response ),GFP_NOFS );if (!response) - goto temporary_error; + goto error;if (skb_copy_bits (skb,sizeof (struct rxrpc_wire_header ), response,sizeof (*response)) <0 ) { -rxrpc_abort_conn (conn, skb,RXKADPACKETSHORT , -EPROTO , - rxkad_abort_resp_short); - goto protocol_error; + ret =rxrpc_abort_conn (conn, skb,RXKADPACKETSHORT , -EPROTO , + rxkad_abort_resp_short); + goto error; } version =ntohl (response->version);
@@ -1089,62 +1089,62 @@ static int rxkad_verify_response(structtrace_rxrpc_rx_response (conn, sp->hdr.serial, version, kvno, ticket_len);if (version !=RXKAD_VERSION ) { -rxrpc_abort_conn (conn, skb,RXKADINCONSISTENCY , -EPROTO , - rxkad_abort_resp_version); - goto protocol_error; + ret =rxrpc_abort_conn (conn, skb,RXKADINCONSISTENCY , -EPROTO , + rxkad_abort_resp_version); + goto error; }if (ticket_len <4 || ticket_len >MAXKRB5TICKETLEN ) { -rxrpc_abort_conn (conn, skb,RXKADTICKETLEN , -EPROTO , - rxkad_abort_resp_tkt_len); - goto protocol_error; + ret =rxrpc_abort_conn (conn, skb,RXKADTICKETLEN , -EPROTO , + rxkad_abort_resp_tkt_len); + goto error; }if (kvno >=RXKAD_TKT_TYPE_KERBEROS_V5 ) { -rxrpc_abort_conn (conn, skb,RXKADUNKNOWNKEY , -EPROTO , - rxkad_abort_resp_unknown_tkt); - goto protocol_error; + ret =rxrpc_abort_conn (conn, skb,RXKADUNKNOWNKEY , -EPROTO , + rxkad_abort_resp_unknown_tkt); + goto error; }/* extract the kerberos ticket and decrypt and decode it */ ret = -ENOMEM ; ticket =kmalloc (ticket_len,GFP_NOFS );if (!ticket) - goto temporary_error_free_resp; + goto error;if (skb_copy_bits (skb,sizeof (struct rxrpc_wire_header ) +sizeof (*response), ticket, ticket_len) <0 ) { -rxrpc_abort_conn (conn, skb,RXKADPACKETSHORT , -EPROTO , - rxkad_abort_resp_short_tkt); - goto protocol_error; + ret =rxrpc_abort_conn (conn, skb,RXKADPACKETSHORT , -EPROTO , + rxkad_abort_resp_short_tkt); + goto error; } ret =rxkad_decrypt_ticket (conn, server_key, skb, ticket, ticket_len, &session_key, &expiry);if (ret <0 ) - goto temporary_error_free_ticket; + goto error;/* use the session key from inside the ticket to decrypt the * response */ ret =rxkad_decrypt_response (conn, response, &session_key);if (ret <0 ) - goto temporary_error_free_ticket; + goto error;if (ntohl (response->encrypted.epoch) != conn->proto.epoch ||ntohl (response->encrypted.cid) != conn->proto.cid ||ntohl (response->encrypted.securityIndex) != conn->security_ix) { -rxrpc_abort_conn (conn, skb,RXKADSEALEDINCON , -EPROTO , - rxkad_abort_resp_bad_param); - goto protocol_error_free; + ret =rxrpc_abort_conn (conn, skb,RXKADSEALEDINCON , -EPROTO , + rxkad_abort_resp_bad_param); + goto error; } csum = response->encrypted.checksum; response->encrypted.checksum =0 ;rxkad_calc_response_checksum (response);if (response->encrypted.checksum != csum) { -rxrpc_abort_conn (conn, skb,RXKADSEALEDINCON , -EPROTO , - rxkad_abort_resp_bad_checksum); - goto protocol_error_free; + ret =rxrpc_abort_conn (conn, skb,RXKADSEALEDINCON , -EPROTO , + rxkad_abort_resp_bad_checksum); + goto error; }for (i =0 ; i <RXRPC_MAXCALLS ; i++) {
@@ -1152,38 +1152,38 @@ static int rxkad_verify_response(structu32 counter =READ_ONCE (conn->channels[i].call_counter);if (call_id >INT_MAX ) { -rxrpc_abort_conn (conn, skb,RXKADSEALEDINCON , -EPROTO , - rxkad_abort_resp_bad_callid); - goto protocol_error_free; + ret =rxrpc_abort_conn (conn, skb,RXKADSEALEDINCON , -EPROTO , + rxkad_abort_resp_bad_callid); + goto error; }if (call_id < counter) { -rxrpc_abort_conn (conn, skb,RXKADSEALEDINCON , -EPROTO , - rxkad_abort_resp_call_ctr); - goto protocol_error_free; + ret =rxrpc_abort_conn (conn, skb,RXKADSEALEDINCON , -EPROTO , + rxkad_abort_resp_call_ctr); + goto error; }if (call_id > counter) {if (conn->channels[i].call) { -rxrpc_abort_conn (conn, skb,RXKADSEALEDINCON , -EPROTO , + ret =rxrpc_abort_conn (conn, skb,RXKADSEALEDINCON , -EPROTO , rxkad_abort_resp_call_state); - goto protocol_error_free; + goto error; } conn->channels[i].call_counter = call_id; } }if (ntohl (response->encrypted.inc_nonce) != conn->rxkad.nonce +1 ) { -rxrpc_abort_conn (conn, skb,RXKADOUTOFSEQUENCE , -EPROTO , - rxkad_abort_resp_ooseq); - goto protocol_error_free; + ret =rxrpc_abort_conn (conn, skb,RXKADOUTOFSEQUENCE , -EPROTO , + rxkad_abort_resp_ooseq); + goto error; } level =ntohl (response->encrypted.level);if (level >RXRPC_SECURITY_ENCRYPT ) { -rxrpc_abort_conn (conn, skb,RXKADLEVELFAIL , -EPROTO , - rxkad_abort_resp_level); - goto protocol_error_free; + ret =rxrpc_abort_conn (conn, skb,RXKADLEVELFAIL , -EPROTO , + rxkad_abort_resp_level); + goto error; } conn->security_level = level;
@@ -1191,31 +1191,12 @@ static int rxkad_verify_response(struct* this the connection security can be handled in exactly the same way * as for a client connection */ ret =rxrpc_get_server_data_key (conn, &session_key, expiry, kvno); -if (ret <0 ) - goto temporary_error_free_ticket; - -kfree (ticket); -kfree (response); -_leave (" = 0" ); -return 0 ; - -protocol_error_free: -kfree (ticket); -protocol_error: -kfree (response); -key_put (server_key); -return -EPROTO ; -temporary_error_free_ticket: +error:kfree (ticket); -temporary_error_free_resp:kfree (response); -temporary_error: -/* Ignore the response packet if we got a temporary error such as -* ENOMEM. We just want to send the challenge again. Note that we -* also come out this way if the ticket decryption fails. -*/ key_put (server_key); +_leave (" = %d" , ret);return ret; }
Greg Kroah-Hartman
maintainerPATCH 111/474 ext4: fix bounds check in check_xattrs() to prevent out-of-bounds access
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
commit eceafc31ea7b42c984ece10d79d505c0bb6615d5 upstream.
The bounds check for the next xattr entry in check_xattrs() uses (void *)next >= end, which allows next to point within sizeof(u32) bytes of end. On the next loop iteration, IS_LAST_ENTRY() reads 4 bytes via *(__u32 *)(entry), which can overrun the valid xattr region.
For example, if next lands at end - 1, the check passes since next < end, but IS_LAST_ENTRY() reads 4 bytes starting at end - 1, accessing 3 bytes beyond the valid region.
Fix this by changing the check to (void *)next + sizeof(u32) > end, ensuring there is always enough space for the IS_LAST_ENTRY() read on the subsequent iteration.
--- fs/ext4/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/xattr.c +1 -1
@@ -226,7 +226,7 @@ check_xattrs(struct inode *inode, struct/* Find the end of the names list */ while (!IS_LAST_ENTRY (e)) {struct ext4_xattr_entry *next =EXT4_XATTR_NEXT (e); -if ((void *)next >= end) { +if ((void *)next +sizeof (u32) > end) { err_str ="e_name out of bounds" ; goto errout; }
Greg Kroah-Hartman
maintainerPATCH 120/474 crypto: arm64/aes - Fix 32-bit aes_mac_update() arg treated as 64-bit
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit f8f08d7cc43237e91e3aedf7b67d015d24c38fcc upstream.
Since the 'enc_after' argument to neon_aes_mac_update() and ce_aes_mac_update() has type 'int', it needs to be accessed using the corresponding 32-bit register, not the 64-bit register. The upper half of the corresponding 64-bit register may contain garbage.
--- arch/arm64/crypto/aes-modes.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/crypto/aes-modes.S +2 -2
@@ -838,7 +838,7 @@ AES_FUNC_START(aes_mac_update) encrypt_block v0, w2, x1, x7, w8 eor v0.16b, v0.16b, v4.16b cmp w3, wzr - csinv x5, x6, xzr, eq + csinv w5, w6, wzr, eq cbz w5, .Lmacout encrypt_block v0, w2, x1, x7, w8 st1 {v0.16b}, [x4] /* return dg */
@@ -852,7 +852,7 @@ AES_FUNC_START(aes_mac_update) eor v0.16b, v0.16b, v1.16b /* ..and xor with dg */ subs w3, w3, #1 - csinv x5, x6, xzr, eq + csinv w5, w6, wzr, eq cbz w5, .Lmacout .Lmacenc:
Greg Kroah-Hartman
maintainerPATCH 121/474 crypto: atmel-aes - Fix 3-page memory leak in atmel_aes_buff_cleanup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit 3fcfff4ed35f963380a68741bcd52742baff7f76 upstream.
atmel_aes_buff_init() allocates 4 pages using __get_free_pages() with ATMEL_AES_BUFFER_ORDER, but atmel_aes_buff_cleanup() frees only the first page using free_page(), leaking the remaining 3 pages. Use free_pages() with ATMEL_AES_BUFFER_ORDER to fix the memory leak.
--- drivers/crypto/atmel-aes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/atmel-aes.c +1 -1
@@ -2323,7 +2323,7 @@ static int atmel_aes_buff_init(struct atstatic void atmel_aes_buff_cleanup (struct atmel_aes_dev *dd) { -free_page ((unsigned long )dd->buf); +free_pages ((unsigned long )dd->buf,ATMEL_AES_BUFFER_ORDER ); }static int atmel_aes_dma_init (struct atmel_aes_dev *dd)
Greg Kroah-Hartman
maintainerPATCH 122/474 crypto: atmel-ecc - Release client on allocation failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit 095d50008d55d13f8fcf1bbeb7c6eba51779bc85 upstream.
Call atmel_ecc_i2c_client_free() to release the I2C client reserved by atmel_ecc_i2c_client_alloc() when crypto_alloc_kpp() fails. Otherwise ->tfm_count will be out of sync.
--- drivers/crypto/atmel-ecc.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/atmel-ecc.c +1 -0
@@ -261,6 +261,7 @@ static int atmel_ecdh_init_tfm(struct crif (IS_ERR (fallback)) {dev_err (&ctx->client->dev,"Failed to allocate transformation for '%s': %ld\n" , alg,PTR_ERR (fallback)); +atmel_ecc_i2c_client_free (ctx->client);return PTR_ERR (fallback); }
Greg Kroah-Hartman
maintainerPATCH 123/474 crypto: hisilicon - Fix dma_unmap_single() direction
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
commit 1ee57ab93b75eb59f426aef37b5498a7ffc28278 upstream.
The direction used to map the buffer skreq->iv is DMA_TO_DEVICE but it is unmapped with direction DMA_BIDIRECTIONAL in the error path.
Change the unmap to match the mapping.
--- drivers/crypto/hisilicon/sec/sec_algs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/hisilicon/sec/sec_algs.c +1 -1
@@ -844,7 +844,7 @@ err_free_elements:if (crypto_skcipher_ivsize (atfm))dma_unmap_single (info->dev, sec_req->dma_iv,crypto_skcipher_ivsize (atfm), -DMA_BIDIRECTIONAL ); +DMA_TO_DEVICE ); err_unmap_out_sg:if (split) sec_unmap_sg_on_err(skreq->dst, steps, splits_out,
Greg Kroah-Hartman
maintainerPATCH 124/474 crypto: ccree - fix a memory leak in cc_mac_digest()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
commit 02c64052fad03699b9c6d1df2f9b444d17e4ac50 upstream.
Add cc_unmap_result() if cc_map_hash_request_final() fails to prevent potential memory leak.
--- drivers/crypto/ccree/cc_hash.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/ccree/cc_hash.c +1 -0
@@ -1448,6 +1448,7 @@ static int cc_mac_digest(struct ahash_reif (cc_map_hash_request_final (ctx->drvdata, state, req->src, req->nbytes,1 , flags)) {dev_err (dev,"map_ahash_request_final() failed\n" ); +cc_unmap_result (dev, state, digestsize, req->result);cc_unmap_req (dev, state, ctx);return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 125/474 crypto: atmel-tdes - fix DMA sync direction
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit c8a9a647532f5c2a04180352693215e24e9dba03 upstream.
Before DMA output is consumed by the CPU, ->dma_addr_out must be synced with dma_sync_single_for_cpu() instead of dma_sync_single_for_device(). Using the wrong direction can return stale cache data on non-coherent platforms.
--- drivers/crypto/atmel-tdes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/atmel-tdes.c +4 -4
@@ -304,8 +304,8 @@ static int atmel_tdes_crypt_pdc_stop(strdma_unmap_sg (dd->dev, dd->out_sg,1 ,DMA_FROM_DEVICE );dma_unmap_sg (dd->dev, dd->in_sg,1 ,DMA_TO_DEVICE ); }else { -dma_sync_single_for_device (dd->dev, dd->dma_addr_out, - dd->dma_size,DMA_FROM_DEVICE ); +dma_sync_single_for_cpu (dd->dev, dd->dma_addr_out, + dd->dma_size,DMA_FROM_DEVICE );/* copy data */ count = atmel_tdes_sg_copy(&dd->out_sg, &dd->out_offset,
@@ -655,8 +655,8 @@ static int atmel_tdes_crypt_dma_stop(strdma_unmap_sg (dd->dev, dd->out_sg,1 ,DMA_FROM_DEVICE );dma_unmap_sg (dd->dev, dd->in_sg,1 ,DMA_TO_DEVICE ); }else { -dma_sync_single_for_device (dd->dev, dd->dma_addr_out, - dd->dma_size,DMA_FROM_DEVICE ); +dma_sync_single_for_cpu (dd->dev, dd->dma_addr_out, + dd->dma_size,DMA_FROM_DEVICE );/* copy data */ count = atmel_tdes_sg_copy(&dd->out_sg, &dd->out_offset,
Greg Kroah-Hartman
maintainerPATCH 126/474 crypto: atmel-sha204a - Fix potential UAF and memory leak in remove path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit bab1adf3b87e4bfac92c4f5963c63db434d561c1 upstream.
Unregister the hwrng to prevent new ->read() calls and flush the Atmel I2C workqueue before teardown to prevent a potential UAF if a queued callback runs while the device is being removed.
Drop the early return to ensure sysfs entries are removed and ->hwrng.priv is freed, preventing a memory leak.
--- drivers/crypto/atmel-sha204a.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/crypto/atmel-sha204a.c +2 -4
@@ -125,10 +125,8 @@ static void atmel_sha204a_remove(struct {struct atmel_i2c_client_priv *i2c_priv =i2c_get_clientdata (client); -if (atomic_read (&i2c_priv->tfm_count)) { -dev_emerg (&client->dev,"Device is busy, will remove it anyhow\n" ); -return ; - } +devm_hwrng_unregister (&client->dev, &i2c_priv->hwrng); +atmel_i2c_flush_queue ();kfree ((void *)i2c_priv->hwrng.priv); }
Greg Kroah-Hartman
maintainerPATCH 127/474 dm mirror: fix integer overflow in create_dirty_log()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junrui Luo <[email protected]>
commit 4c788c6f921b22f9b6c3f316c4a071c05683e7de upstream.
The argument count calculation in create_dirty_log() performs *args_used = 2 + param_count before validating against argc. When a user provides a param_count close to UINT_MAX via the device mapper table string, this unsigned addition wraps around to a small value, causing the subsequent argc < *args_used check to be bypassed.
The overflowed param_count is then passed as argc to dm_dirty_log_create(), where it can cause out-of-bounds reads on the argv array.
Fix by comparing param_count against argc - 2 before performing the addition, following the same pattern used by parse_features() in the same file. Since argc >= 2 is already guaranteed, the subtraction is safe.
--- drivers/md/dm-raid1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/dm-raid1.c +3 -3
@@ -993,13 +993,13 @@ static struct dm_dirty_log *create_dirtyreturn NULL ; } - *args_used =2 + param_count; - -if (argc < *args_used) { +if (param_count > argc -2 ) { ti->error ="Insufficient mirror log arguments" ;return NULL ; } + *args_used =2 + param_count; + dl =dm_dirty_log_create (argv[0 ], ti, mirror_flush, param_count, argv +2 );if (!dl) {
Greg Kroah-Hartman
maintainerPATCH 128/474 IB/core: Fix zero dmac race in neighbor resolution
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Zhao <[email protected]>
commit 5e6de34d82b49cab9d8a42063e9cd0f22a4f31e5 upstream.
dst_fetch_ha() checks nud_state without holding the neighbor lock, then copies ha under the seqlock. A race in __neigh_update() where nud_state is set to NUD_REACHABLE before ha is written allows dst_fetch_ha() to read a zero MAC address while the seqlock reports no concurrent writer.
netevent_callback amplifies this by waking ALL pending addr_req workers when ANY neighbor becomes NUD_VALID. At scale (N peers resolving ARP concurrently), the hit probability scales as N^2, making it near-certain for large RDMA workloads.
N(A): neigh_update(A) W(A): addr_resolve(A)
| [sleep] | write_lock_bh(&A->lock) | | A->nud_state = NUD_REACHABLE | | // A->ha is still 0 | | [woken by netevent_cb() of | another neighbour] | | dst_fetch_ha(A) | | A->nud_state & NUD_VALID | | read_seqbegin(&A->ha_lock) | | snapshot = A->ha /* 0 */ | | read_seqretry(&A->ha_lock) | | return snapshot | seqlock(&A->ha_lock) | A->ha = mac_A /* too late */ | sequnlock(&A->ha_lock) | write_unlock_bh(&A->lock)
The incorrect/zero mac is read and programmed in the device QP while it was not yet updated. This causes silent packet loss and eventual RETRY_EXC_ERR.
Fix by holding the neighbor read lock across the nud_state check and ha copy in dst_fetch_ha(), ensuring it synchronizes with __neigh_update() which is updating while holding the write lock.
--- drivers/infiniband/core/addr.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/core/addr.c +3 -0
@@ -321,11 +321,14 @@ static int dst_fetch_ha(const struct dstif (!n)return -ENODATA ; +read_lock_bh (&n->lock);if (!(n->nud_state &NUD_VALID )) { +read_unlock_bh (&n->lock);neigh_event_send (n,NULL ); ret = -ENODATA ; }else {neigh_ha_snapshot (dev_addr->dst_dev_addr, n, dst->dev); +read_unlock_bh (&n->lock); }neigh_release (n);
Greg Kroah-Hartman
maintainerPATCH 129/474 ktest: Fix the month in the name of the failure directory
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 768059ede35f197575a38b10797b52402d9d4d2f upstream.
The Perl localtime() function returns the month starting at 0 not 1. This caused the date produced to create the directory for saving files of a failed run to have the month off by one.
machine-test-useconfig-fail-20260314073628
The above happened in April, not March. The correct name should have been:
machine-test-useconfig-fail-20260414073628
This was somewhat confusing.
--- tools/testing/ktest/ktest.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/ktest/ktest.pl +1 -1
@@ -1777,7 +1777,7 @@ sub save_logs { my ($result, $basedir) = @_; my @t = localtime; my $date = sprintf "%04d%02d%02d%02d%02d%02d", - 1900+$t[5],$t[4],$t[3],$t[2],$t[1],$t[0]; + 1900+$t[5],$t[4]+1,$t[3],$t[2],$t[1],$t[0]; my $type = $build_type; if ($type =~ /useconfig/) {
Greg Kroah-Hartman
maintainerPATCH 112/474 ext4: fix missing brelse() in ext4_xattr_inode_dec_ref_all()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sohei Koyama <[email protected]>
commit 77d059519382bd66283e6a4e83ee186e87e7708f upstream.
The commit c8e008b60492 ("ext4: ignore xattrs past end") introduced a refcount leak in when block_csum is false.
ext4_xattr_inode_dec_ref_all() calls ext4_get_inode_loc() to get iloc.bh, but never releases it with brelse().
--- fs/ext4/xattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/xattr.c +3 -1
@@ -1165,7 +1165,7 @@ ext4_xattr_inode_dec_ref_all(handle_t *h {struct inode *ea_inode;struct ext4_xattr_entry *entry; -struct ext4_iloc iloc; +struct ext4_iloc iloc = { .bh =NULL };bool dirty = false;unsigned int ea_ino;int err;
@@ -1260,6 +1260,8 @@ ext4_xattr_inode_dec_ref_all(handle_t *hext4_warning_inode (parent,"handle dirty metadata err=%d" , err); } + +brelse (iloc.bh); }/*
Greg Kroah-Hartman
maintainerPATCH 130/474 ntfs3: add buffer boundary checks to run_unpack()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Gaertner <[email protected]>
commit b62567bca47408e6739dee75f02a2113548af875 upstream.
run_unpack() checks run_buf < run_last at the top of the while loop but then reads size_size and offset_size bytes via run_unpack_s64() without verifying they fit within the remaining buffer. A crafted NTFS image with truncated run data in an MFT attribute triggers an OOB heap read of up to 15 bytes when the filesystem is mounted.
Add boundary checks before each run_unpack_s64() call to ensure the declared field size does not exceed the remaining buffer.
Found by fuzzing with a source-patched harness (LibAFL + QEMU).
--- fs/ntfs3/run.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ntfs3/run.c +6 -0
@@ -963,6 +963,9 @@ int run_unpack(struct runs_tree *run, stif (size_size >8 )return -EINVAL ; +if (run_buf + size_size > run_last) +return -EINVAL ; + len =run_unpack_s64 (run_buf, size_size,0 );/* Skip size_size. */ run_buf += size_size;
@@ -975,6 +978,9 @@ int run_unpack(struct runs_tree *run, stelse if (offset_size <=8 ) {s64 dlcn; +if (run_buf + offset_size > run_last) +return -EINVAL ; +/* Initial value of dlcn is -1 or 0. */ dlcn = (run_buf[offset_size -1 ] &0x80 ) ? (s64)-1 :0 ; dlcn =run_unpack_s64 (run_buf, offset_size, dlcn);
Greg Kroah-Hartman
maintainerPATCH 131/474 ntfs3: fix integer overflow in run_unpack() volume boundary check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Gaertner <[email protected]>
commit 984a415f019536ea2d24de9010744e5302a9a948 upstream.
The volume boundary check lcn + len > sbi->used.bitmap.nbits uses raw addition which can wrap around for large lcn and len values, bypassing the validation. Use check_add_overflow() as is already done for the adjacent prev_lcn + dlcn and vcn64 + len checks added by commit 3ac37e100385 ("ntfs3: Fix integer overflow in run_unpack()").
Found by fuzzing with a source-patched harness (LibAFL + QEMU).
--- fs/ntfs3/run.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
fs/ntfs3/run.c +9 -3
@@ -1018,9 +1018,15 @@ int run_unpack(struct runs_tree *run, st return -EOPNOTSUPP; }#endif -if (lcn !=SPARSE_LCN64 && lcn + len > sbi->used.bitmap.nbits) { -/* LCN range is out of volume. */ -return -EINVAL ; +if (lcn !=SPARSE_LCN64 ) { +u64 lcn_end; + +if (check_add_overflow (lcn, len, &lcn_end)) +return -EINVAL ; +if (lcn_end > sbi->used.bitmap.nbits) { +/* LCN range is out of volume. */ +return -EINVAL ; + } }if (!run)
Greg Kroah-Hartman
maintainerPATCH 132/474 rtmutex: Use waiter::task instead of current in remove_waiter()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keenan Dong <[email protected]>
commit 3bfdc63936dd4773109b7b8c280c0f3b5ae7d349 upstream.
remove_waiter() is used by the slowlock paths, but it is also used for proxy-lock rollback in rt_mutex_start_proxy_lock() when invoked from futex_requeue().
In the latter case waiter::task is not current, but remove_waiter() operates on current for the dequeue operation. That results in several problems:
1) the rbtree dequeue happens without waiter::task::pi_lock being held
2) the waiter task's pi_blocked_on state is not cleared, which leaves a dangling pointer primed for UAF around.
3) rt_mutex_adjust_prio_chain() operates on the wrong top priority waiter task
Use waiter::task instead of current in all related operations in remove_waiter() to cure those problems.
[ tglx: Fixup rt_mutex_adjust_prio_chain(), add a comment and amend the
changelog ]
--- kernel/locking/rtmutex.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
kernel/locking/rtmutex.c +8 -5
@@ -1511,20 +1511,23 @@ static bool rtmutex_spin_on_owner(struct* * Must be called with lock->wait_lock held and interrupts disabled. It must * have just failed to try_to_take_rt_mutex(). +* +* When invoked from rt_mutex_start_proxy_lock() waiter::task != current ! */ static void __sched remove_waiter(struct rt_mutex_base *lock,struct rt_mutex_waiter *waiter) {bool is_top_waiter = (waiter ==rt_mutex_top_waiter (lock));struct task_struct *owner =rt_mutex_owner (lock); +struct task_struct *waiter_task = waiter->task;struct rt_mutex_base *next_lock;lockdep_assert_held (&lock->wait_lock); -raw_spin_lock (¤t->pi_lock); -rt_mutex_dequeue (lock, waiter); - current->pi_blocked_on =NULL ; -raw_spin_unlock (¤t->pi_lock); + scoped_guard(raw_spinlock, &waiter_task->pi_lock) { +rt_mutex_dequeue (lock, waiter); + waiter_task->pi_blocked_on =NULL ; + }/* * Only update priority if the waiter was the highest priority
@@ -1560,7 +1563,7 @@ static void __sched remove_waiter(structraw_spin_unlock_irq (&lock->wait_lock);rt_mutex_adjust_prio_chain (owner,RT_MUTEX_MIN_CHAINWALK , lock, - next_lock,NULL , current); + next_lock,NULL , waiter_task);raw_spin_lock_irq (&lock->wait_lock); }
Greg Kroah-Hartman
maintainerPATCH 133/474 scsi: sd: fix missing put_disk() when device_add(&disk_dev) fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Xiuwei <[email protected]>
commit 1e111c4b3a726df1254670a5cc4868cedb946d37 upstream.
If device_add(&sdkp->disk_dev) fails, put_device() runs scsi_disk_release(), which frees the scsi_disk but leaves the gendisk referenced. The device_add_disk() error path in sd_probe() calls put_disk(gd); call put_disk(gd) here to mirror that cleanup.
--- drivers/scsi/sd.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/sd.c +1 -0
@@ -3727,6 +3727,7 @@ static int sd_probe(struct device *dev) error =device_add (&sdkp->disk_dev);if (error) {put_device (&sdkp->disk_dev); +put_disk (gd); goto out; }
Greg Kroah-Hartman
maintainerPATCH 134/474 seg6: fix seg6 lwtunnel output redirect for L2 reduced encap mode
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Mayer <[email protected]>
commit ade67d5f588832c7ba131aadd4215a94ce0a15c8 upstream.
When SEG6_IPTUN_MODE_L2ENCAP_RED (L2ENCAP_RED) was introduced, the condition in seg6_build_state() that excludes L2 encap modes from setting LWTUNNEL_STATE_OUTPUT_REDIRECT was not updated to account for the new mode.
As a consequence, L2ENCAP_RED routes incorrectly trigger seg6_output() on the output path, where the packet is silently dropped because skb_mac_header_was_set() fails on L3 packets.
Extend the check to also exclude L2ENCAP_RED, consistent with L2ENCAP.
--- net/ipv6/seg6_iptunnel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/seg6_iptunnel.c +2 -1
@@ -711,7 +711,8 @@ static int seg6_build_state(struct net * newts->type =LWTUNNEL_ENCAP_SEG6 ; newts->flags |=LWTUNNEL_STATE_INPUT_REDIRECT ; -if (tuninfo->mode !=SEG6_IPTUN_MODE_L2ENCAP ) +if (tuninfo->mode !=SEG6_IPTUN_MODE_L2ENCAP && + tuninfo->mode !=SEG6_IPTUN_MODE_L2ENCAP_RED ) newts->flags |=LWTUNNEL_STATE_OUTPUT_REDIRECT ; newts->headroom =seg6_lwt_headroom (tuninfo);
Greg Kroah-Hartman
maintainerPATCH 135/474 crypto: authencesn - reject short ahash digests during instance creation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yucheng Lu <[email protected]>
commit 5db6ef9847717329f12c5ea8aba7e9f588a980c0 upstream.
authencesn requires either a zero authsize or an authsize of at least 4 bytes because the ESN encrypt/decrypt paths always move 4 bytes of high-order sequence number data at the end of the authenticated data.
While crypto_authenc_esn_setauthsize() already rejects explicit non-zero authsizes in the range 1..3, crypto_authenc_esn_create() still copied auth->digestsize into inst->alg.maxauthsize without validating it. The AEAD core then initialized the tfm's default authsize from that value.
As a result, selecting an ahash with digest size 1..3, such as cbcmac(cipher_null), exposed authencesn instances whose default authsize was invalid even though setauthsize() would have rejected the same value. AF_ALG could then trigger the ESN tail handling with a too-short tag and hit an out-of-bounds access.
Reject authencesn instances whose ahash digest size is in the invalid non-zero range 1..3 so that no tfm can inherit an unsupported default authsize.
--- crypto/authencesn.c | 5 +++++ 1 file changed, 5 insertions(+)
crypto/authencesn.c +5 -0
@@ -397,6 +397,11 @@ static int crypto_authenc_esn_create(str auth =crypto_spawn_ahash_alg (&ctx->auth); auth_base = &auth->base; +if (auth->digestsize >0 && auth->digestsize <4 ) { + err = -EINVAL ; + goto err_free_inst; + } + err =crypto_grab_skcipher (&ctx->enc,aead_crypto_instance (inst),crypto_attr_alg_name (tb[2 ]),0 , mask);if (err)
Greg Kroah-Hartman
maintainerPATCH 136/474 driver core: Add kernel-doc for DEV_FLAG_COUNT enum value
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit 5b484311507b5d403c1f7a45f6aa3778549e268b upstream.
Even though nobody should use this value (except when declaring the "flags" bitmap), kernel-doc still gets upset that it's not documented. It reports:
WARNING: ../include/linux/device.h:519 Enum value 'DEV_FLAG_COUNT' not described in enum 'struct_device_flags'
Add the description of DEV_FLAG_COUNT.
--- include/linux/device.h | 1 + 1 file changed, 1 insertion(+)
include/linux/device.h +1 -0
@@ -610,6 +610,7 @@ struct device_physical_location {* * @DEV_FLAG_READY_TO_PROBE: If set then device_add() has finished enough * initialization that probe could be called. +* @DEV_FLAG_COUNT: Number of defined struct_device_flags. */ enum struct_device_flags {DEV_FLAG_READY_TO_PROBE =0 ,
Greg Kroah-Hartman
maintainerPATCH 137/474 ALSA: caiaq: Fix potentially leftover ep1_in_urb at error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 0a7b5221b5b51cc798fcfc3be00d02eade149d69 upstream.
The previous fix for handling the error from setup_card() missed that an internal URB cdev->ep1_in_urb might have been already submitted beforehand. In the normal case, this URB gets killed at the disconnection, but in the error path, we didn't do it, hence there can be a potential leak.
Fix it in the error path for setup_card(), too.
--- sound/usb/caiaq/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/caiaq/device.c +1 -1
@@ -514,7 +514,7 @@ static int init_card(struct snd_usb_caia card->private_free = card_free; err =setup_card (cdev);if (err <0 ) -return err; + goto err_kill_urb;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 138/474 ALSA: caiaq: Dont abort when no input device is available
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit b32ae47a2b0a1fb4bd4942242847966d9b178222 upstream.
The previous fix to handle the error from setup_card() caused a regression for the models that have no dedicated input device; snd_usb_caiaq_input_init() just returns -EINVAL, and we treat it as a fatal error although it should be ignored.
As a regression fix, change the error code to -ENODEV, and ignore this error in the callee, to continue probing.
--- sound/usb/caiaq/device.c | 2 +- sound/usb/caiaq/input.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/usb/caiaq/device.c +1 -1
@@ -366,7 +366,7 @@ static int setup_card(struct snd_usb_cai#ifdef CONFIG_SND_USB_CAIAQ_INPUT ret =snd_usb_caiaq_input_init (cdev); -if (ret <0 ) { +if (ret <0 && ret != -ENODEV ) {dev_err (dev,"Unable to set up input system (ret=%d)\n" , ret);return ret; }
sound/usb/caiaq/input.c +1 -1
@@ -804,7 +804,7 @@ int snd_usb_caiaq_input_init(struct snd_default :/* no input methods supported on this device */ - ret = -EINVAL ; + ret = -ENODEV ; goto exit_free_idev; }
Greg Kroah-Hartman
maintainerPATCH 139/474 ipv6: rpl: reserve mac_len headroom when recompressed SRH grows
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 9e6bf146b55999a095bb14f73a843942456d1adc upstream.
ipv6_rpl_srh_rcv() decompresses an RFC 6554 Source Routing Header, swaps the next segment into ipv6_hdr->daddr, recompresses, then pulls the old header and pushes the new one plus the IPv6 header back. The recompressed header can be larger than the received one when the swap reduces the common-prefix length the segments share with daddr (CmprI=0, CmprE>0, seg[0][0] != daddr[0] gives the maximum +8 bytes).
pskb_expand_head() was gated on segments_left == 0, so on earlier segments the push consumed unchecked headroom. Once skb_push() leaves fewer than skb->mac_len bytes in front of data, skb_mac_header_rebuild()'s call to:
skb_set_mac_header(skb, -skb->mac_len);
will store (data - head) - mac_len into the u16 mac_header field, which wraps to ~65530, and the following memmove() writes mac_len bytes ~64KiB past skb->head.
A single AF_INET6/SOCK_RAW/IPV6_HDRINCL packet over lo with a two segment type-3 SRH (CmprI=0, CmprE=15) reaches headroom 8 after one pass; KASAN reports a 14-byte OOB write in ipv6_rthdr_rcv.
Fix this by expanding the head whenever the remaining room is less than the push size plus mac_len, and request that much extra so the rebuilt MAC header fits afterwards.
--- net/ipv6/exthdrs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/ipv6/exthdrs.c +6 -3
@@ -491,6 +491,7 @@ static int ipv6_rpl_srh_rcv(struct sk_bustruct net *net =dev_net (skb->dev);struct inet6_dev *idev;struct ipv6hdr *oldhdr; +unsigned int chdr_len;unsigned char *buf;int accept_rpl_seg;int i, err;
@@ -594,8 +595,10 @@ looped_back:skb_pull (skb, ((hdr->hdrlen +1 ) <<3 ));skb_postpull_rcsum (skb, oldhdr,sizeof (struct ipv6hdr ) + ((hdr->hdrlen +1 ) <<3 )); -if (unlikely (!hdr->segments_left)) { -if (pskb_expand_head (skb,sizeof (struct ipv6hdr ) + ((chdr->hdrlen +1 ) <<3 ),0 , + chdr_len =sizeof (struct ipv6hdr ) + ((chdr->hdrlen +1 ) <<3 ); +if (unlikely (!hdr->segments_left || +skb_headroom (skb) < chdr_len + skb->mac_len)) { +if (pskb_expand_head (skb, chdr_len + skb->mac_len,0 ,GFP_ATOMIC )) {__IP6_INC_STATS (net,ip6_dst_idev (skb_dst (skb)),IPSTATS_MIB_OUTDISCARDS );kfree_skb (skb);
@@ -605,7 +608,7 @@ looped_back: oldhdr =ipv6_hdr (skb); } -skb_push (skb, ((chdr->hdrlen +1 ) <<3 ) +sizeof (struct ipv6hdr )); +skb_push (skb, chdr_len);skb_reset_network_header (skb);skb_mac_header_rebuild (skb);skb_set_transport_header (skb,sizeof (struct ipv6hdr ));