wifi: ath12k: Fix invalid entry fetch in ath12k_dp_mon_srng_process
Subsystems (12)
Sasha Levin
maintainerPATCH 1/26 wifi: ath12k: Fix invalid entry fetch in ath12k_dp_mon_srng_process
From: P Praneesh <[email protected]>
[ Upstream commit 63fdc4509bcf483e79548de6bc08bf3c8e504bb3 ]
Currently, ath12k_dp_mon_srng_process uses ath12k_hal_srng_src_get_next_entry to fetch the next entry from the destination ring. This is incorrect because ath12k_hal_srng_src_get_next_entry is intended for source rings, not destination rings. This leads to invalid entry fetches, causing potential data corruption or crashes due to accessing incorrect memory locations. This happens because the source ring and destination ring have different handling mechanisms and using the wrong function results in incorrect pointer arithmetic and ring management.
To fix this issue, replace the call to ath12k_hal_srng_src_get_next_entry with ath12k_hal_srng_dst_get_next_entry in ath12k_dp_mon_srng_process. This ensures that the correct function is used for fetching entries from the destination ring, preventing invalid memory accesses.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/dp_mon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/dp_mon.c +1 -1
@@ -2571,7 +2571,7 @@ int ath12k_dp_mon_rx_process_stats(struct ath12k *ar, int mac_id, dest_idx =0 ; move_next:ath12k_dp_mon_buf_replenish (ab, buf_ring,1 ); -ath12k_hal_srng_src_get_next_entry (ab, srng); +ath12k_hal_srng_dst_get_next_entry (ab, srng); num_buffs_reaped++; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/26 f2fs: don't retry IO for corrupted data scenario
From: Chao Yu <[email protected]>
[ Upstream commit 1534747d3170646ddeb9ea5f7caaac90359707cf ]
F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
If node block is loaded successfully, but its content is inconsistent, it doesn't need to retry IO.
--- fs/f2fs/inode.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/f2fs/inode.c +4 -0
@@ -764,8 +764,12 @@ void f2fs_update_inode_page(struct inode *inode)if (err == -ENOENT )return ; +if (err == -EFSCORRUPTED ) + goto stop_checkpoint; +if (err == -ENOMEM || ++count <=DEFAULT_RETRY_IO_COUNT ) goto retry; +stop_checkpoint:f2fs_stop_checkpoint (sbi, false,STOP_CP_REASON_UPDATE_INODE );return ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/26 scsi: target: spc: Fix RSOC parameter data header size
In reply to Sasha LevinFrom: Chaohai Chen <[email protected]>
[ Upstream commit b50532318793d28a7628c1ffc129a2226e83e495 ]
The SPC document states that "The COMMAND DATA LENGTH field indicates the length in bytes of the command descriptor list".
The length should be subtracted by 4 to represent the length of the description list, not 3.
--- drivers/target/target_core_spc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_spc.c +1 -1
@@ -2243,7 +2243,7 @@ spc_emulate_report_supp_op_codes(struct se_cmd *cmd) response_length +=spc_rsoc_encode_command_descriptor ( &buf[response_length], rctd, descr); } -put_unaligned_be32 (response_length -3 , buf); +put_unaligned_be32 (response_length -4 , buf); }else { response_length = spc_rsoc_encode_one_command_descriptor( &buf[response_length], rctd, descr,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/26 net: usb: asix_devices: add FiberGecko DeviceID
In reply to Sasha LevinFrom: Max Schulze <[email protected]>
[ Upstream commit 4079918ae720e842ed7dff65fedeb9980b374995 ]
The FiberGecko is a small USB module that connects a 100 Mbit/s SFP
--- drivers/net/usb/asix_devices.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/usb/asix_devices.c +17 -0
@@ -1421,6 +1421,19 @@ static const struct driver_info hg20f9_info = { .data = FLAG_EEPROM_MAC, }; +static const struct driver_info lyconsys_fibergecko100_info = { + .description ="LyconSys FiberGecko 100 USB 2.0 to SFP Adapter" , + .bind = ax88178_bind, + .status = asix_status, + .link_reset = ax88178_link_reset, + .reset = ax88178_link_reset, + .flags =FLAG_ETHER |FLAG_FRAMING_AX |FLAG_LINK_INTR | +FLAG_MULTI_PACKET , + .rx_fixup = asix_rx_fixup_common, + .tx_fixup = asix_tx_fixup, + .data =0x20061201 , +}; +static const struct usb_device_id products [] = { {// Linksys USB200M
@@ -1578,6 +1591,10 @@ static const struct usb_device_id products [] = {// Linux Automation GmbH USB 10Base-T1L USB_DEVICE(0x33f7, 0x0004), .driver_info = (unsigned long) &lxausb_t1l_info, +}, { +/* LyconSys FiberGecko 100 */ + USB_DEVICE(0x1d2a, 0x0801), + .driver_info = (unsigned long) &lyconsys_fibergecko100_info, }, { }, // END };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/26 page_pool: avoid infinite loop to schedule delayed worker
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit 43130d02baa137033c25297aaae95fd0edc41654 ]
We noticed the kworker in page_pool_release_retry() was waken up repeatedly and infinitely in production because of the buggy driver causing the inflight less than 0 and warning us in page_pool_inflight()[1].
Since the inflight value goes negative, it means we should not expect the whole page_pool to get back to work normally.
This patch mitigates the adverse effect by not rescheduling the kworker when detecting the inflight negative in page_pool_release_retry().
[1]
[Mon Feb 10 20:36:11 2025] ------------[ cut here ]------------ [Mon Feb 10 20:36:11 2025] Negative(-51446) inflight packet-pages ... [Mon Feb 10 20:36:11 2025] Call Trace: [Mon Feb 10 20:36:11 2025] page_pool_release_retry+0x23/0x70 [Mon Feb 10 20:36:11 2025] process_one_work+0x1b1/0x370 [Mon Feb 10 20:36:11 2025] worker_thread+0x37/0x3a0 [Mon Feb 10 20:36:11 2025] kthread+0x11a/0x140 [Mon Feb 10 20:36:11 2025] ? process_one_work+0x370/0x370 [Mon Feb 10 20:36:11 2025] ? __kthread_cancel_work+0x40/0x40 [Mon Feb 10 20:36:11 2025] ret_from_fork+0x35/0x40 [Mon Feb 10 20:36:11 2025] ---[ end trace ebffe800f33e7e34 ]---
Note: before this patch, the above calltrace would flood the dmesg due to repeated reschedule of release_dw kworker.
--- net/core/page_pool.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/core/page_pool.c +7 -1
@@ -865,7 +865,13 @@ static void page_pool_release_retry(struct work_struct *wq)int inflight; inflight =page_pool_release (pool); -if (!inflight) +/* In rare cases, a driver bug may cause inflight to go negative. +* Don't reschedule release if inflight is 0 or negative. +* - If 0, the page_pool has been destroyed +* - if negative, we will never recover +* in both cases no reschedule is necessary. +*/ +if (inflight <=0 )return ;/* Periodic warning */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/26 jfs: Fix uninit-value access of imap allocated in the diMount() function
In reply to Sasha LevinFrom: Zhongqiu Han <[email protected]>
[ Upstream commit 9629d7d66c621671d9a47afe27ca9336bfc8a9ea ]
syzbot reports that hex_dump_to_buffer is using uninit-value:
=====================================================
BUG: KMSAN: uninit-value in hex_dump_to_buffer+0x888/0x1100 lib/hexdump.c:171 hex_dump_to_buffer+0x888/0x1100 lib/hexdump.c:171 print_hex_dump+0x13d/0x3e0 lib/hexdump.c:276 diFree+0x5ba/0x4350 fs/jfs/jfs_imap.c:876 jfs_evict_inode+0x510/0x550 fs/jfs/inode.c:156 evict+0x723/0xd10 fs/inode.c:796 iput_final fs/inode.c:1946 [inline] iput+0x97b/0xdb0 fs/inode.c:1972 txUpdateMap+0xf3e/0x1150 fs/jfs/jfs_txnmgr.c:2367 txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline] jfs_lazycommit+0x627/0x11d0 fs/jfs/jfs_txnmgr.c:2733 kthread+0x6b9/0xef0 kernel/kthread.c:464 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4121 [inline] slab_alloc_node mm/slub.c:4164 [inline] __kmalloc_cache_noprof+0x8e3/0xdf0 mm/slub.c:4320 kmalloc_noprof include/linux/slab.h:901 [inline] diMount+0x61/0x7f0 fs/jfs/jfs_imap.c:105 jfs_mount+0xa8e/0x11d0 fs/jfs/jfs_mount.c:176 jfs_fill_super+0xa47/0x17c0 fs/jfs/super.c:523 get_tree_bdev_flags+0x6ec/0x910 fs/super.c:1636 get_tree_bdev+0x37/0x50 fs/super.c:1659 jfs_get_tree+0x34/0x40 fs/jfs/super.c:635 vfs_get_tree+0xb1/0x5a0 fs/super.c:1814 do_new_mount+0x71f/0x15e0 fs/namespace.c:3560 path_mount+0x742/0x1f10 fs/namespace.c:3887 do_mount fs/namespace.c:3900 [inline] __do_sys_mount fs/namespace.c:4111 [inline] __se_sys_mount+0x71f/0x800 fs/namespace.c:4088 __x64_sys_mount+0xe4/0x150 fs/namespace.c:4088 x64_sys_call+0x39bf/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:166 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f =====================================================
The reason is that imap is not properly initialized after memory allocation. It will cause the snprintf() function to write uninitialized data into linebuf within hex_dump_to_buffer().
Fix this by using kzalloc instead of kmalloc to clear its content at the beginning in diMount().
--- fs/jfs/jfs_imap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_imap.c +1 -1
@@ -102,7 +102,7 @@ int diMount(struct inode *ipimap)* allocate/initialize the in-memory inode map control structure */ /* allocate the in-memory inode map control structure. */ - imap =kmalloc (sizeof (struct inomap ),GFP_KERNEL ); + imap =kzalloc (sizeof (struct inomap ),GFP_KERNEL );if (imap ==NULL )return -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/26 mptcp: move the whole rx path under msk socket lock protection
In reply to Sasha LevinFrom: Paolo Abeni <[email protected]>
[ Upstream commit bc68b0efa1bf923cef1294a631d8e7416c7e06e4 ]
After commit c2e6048fa1cf ("mptcp: fix race in release_cb") we can move the whole MPTCP rx path under the socket lock leveraging the release_cb.
We can drop a bunch of spin_lock pairs in the receive functions, use a single receive queue and invoke __mptcp_move_skbs only when subflows ask for it.
This will allow more cleanup in the next patch.
Some changes are worth specific mention:
The msk rcvbuf update now always happens under both the msk and the subflow socket lock: we can drop a bunch of ONCE annotation and consolidate the checks.
When the skbs move is delayed at msk release callback time, even the msk rcvbuf update is delayed; additionally take care of such action in __mptcp_move_skbs().
--- net/mptcp/fastopen.c | 1 + net/mptcp/protocol.c | 123 ++++++++++++++++++++----------------------- net/mptcp/protocol.h | 2 +- 3 files changed, 60 insertions(+), 66 deletions(-)
net/mptcp/fastopen.c +1 -0
@@ -49,6 +49,7 @@ void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subfMPTCP_SKB_CB (skb)->has_rxtstamp =TCP_SKB_CB (skb)->has_rxtstamp;mptcp_data_lock (sk); +DEBUG_NET_WARN_ON_ONCE (sock_owned_by_user_nocheck (sk));mptcp_set_owner_r (skb, sk);__skb_queue_tail (&sk->sk_receive_queue, skb);
net/mptcp/protocol.c +58 -65
266 lines not on this page · raw message
net/mptcp/protocol.h +1 -1
@@ -124,6 +124,7 @@#define MPTCP_FLUSH_JOIN_LIST 5#define MPTCP_SYNC_STATE 6#define MPTCP_SYNC_SNDBUF 7 +#define MPTCP_DEQUEUE 8struct mptcp_skb_cb {u64 map_seq;
@@ -312,7 +313,6 @@ struct mptcp_sock {struct work_struct work;struct sk_buff *ooo_last_skb;struct rb_root out_of_order_queue; -struct sk_buff_head receive_queue;struct list_head conn_list;struct list_head rtx_queue;struct mptcp_data_frag *first_pending;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/26 fs/jfs: cast inactags to s64 to prevent potential overflow
In reply to Sasha LevinFrom: Rand Deeb <[email protected]>
[ Upstream commit 70ca3246ad201b53a9f09380b3f29d8bac320383 ]
The expression "inactags << bmp->db_agl2size" in the function dbFinalizeBmap() is computed using int operands. Although the values (inactags and db_agl2size) are derived from filesystem parameters and are usually small, there is a theoretical risk that the shift could overflow a 32-bit int if extreme values occur.
According to the C standard, shifting a signed 32-bit int can lead to undefined behavior if the result exceeds its range. In our case, an overflow could miscalculate free blocks, potentially leading to erroneous filesystem accounting.
To ensure the arithmetic is performed in 64-bit space, we cast "inactags" to s64 before shifting. This defensive fix prevents any risk of overflow and complies with kernel coding best practices.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/jfs/jfs_dmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/jfs/jfs_dmap.c +2 -2
@@ -3666,8 +3666,8 @@ void dbFinalizeBmap(struct inode *ipbmap)* system size is not a multiple of the group size). */ inactfree = (inactags && ag_rem) ? - ((inactags -1 ) << bmp->db_agl2size) + ag_rem - : inactags << bmp->db_agl2size; + (((s64 )inactags -1 ) << bmp->db_agl2size) + ag_rem + : ((s64 )inactags << bmp->db_agl2size);/* determine how many free blocks are in the active * allocation groups plus the average number of free blocks
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 9/26 fs/jfs: Prevent integer overflow in AG size calculation
In reply to Sasha LevinFrom: Rand Deeb <[email protected]>
[ Upstream commit 7fcbf789629cdb9fbf4e2172ce31136cfed11e5e ]
The JFS filesystem calculates allocation group (AG) size using 1 << l2agsize in dbExtendFS(). When l2agsize exceeds 31 (possible with >2TB aggregates on 32-bit systems), this 32-bit shift operation causes undefined behavior and improper AG sizing.
On 32-bit architectures:
- Left-shifting 1 by 32+ bits results in 0 due to integer overflow
- This creates invalid AG sizes (0 or garbage values) in sbi->bmap->db_agsize
- Subsequent block allocations would reference invalid AG structures
- Could lead to:
- Filesystem corruption during extend operations
- Kernel crashes due to invalid memory accesses
- Security vulnerabilities via malformed on-disk structures
Fix by casting to s64 before shifting:bmp->db_agsize = (s64)1 << l2agsize;
This ensures 64-bit arithmetic even on 32-bit architectures. The cast matches the data type of db_agsize (s64) and follows similar patterns in JFS block calculation code.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/jfs/jfs_dmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_dmap.c +1 -1
@@ -3403,7 +3403,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) oldl2agsize = bmp->db_agl2size; bmp->db_agl2size = l2agsize; - bmp->db_agsize =1 << l2agsize; + bmp->db_agsize = (s64 )1 << l2agsize;/* compute new number of AG */ agno = bmp->db_numag;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 10/26 jfs: Prevent copying of nlink with value 0 from disk inode
In reply to Sasha LevinFrom: Edward Adam Davis <[email protected]>
[ Upstream commit b61e69bb1c049cf507e3c654fa3dc1568231bd07 ]
syzbot report a deadlock in diFree. [1]
When calling "ioctl$LOOP_SET_STATUS64", the offset value passed in is 4, which does not match the mounted loop device, causing the mapping of the mounted loop device to be invalidated.
When creating the directory and creating the inode of iag in diReadSpecial(), read the page of fixed disk inode (AIT) in raw mode in read_metapage(), the metapage data it returns is corrupted, which causes the nlink value of 0 to be assigned to the iag inode when executing copy_from_dinode(), which ultimately causes a deadlock when entering diFree().
To avoid this, first check the nlink value of dinode before setting iag inode.
[1]
WARNING: possible recursive locking detected
6.12.0-rc7-syzkaller-00212-g4a5df3796467 #0 Not tainted
--------------------------------------------
syz-executor301/5309 is trying to acquire lock:ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diFree+0x37c/0x2fb0 fs/jfs/jfs_imap.c:889
but task is already holding lock:ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diAlloc+0x1b6/0x1630
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&(imap->im_aglock[index]));
lock(&(imap->im_aglock[index]));
*** DEADLOCK ***
May be due to missing lock nesting notation
5 locks held by syz-executor301/5309:
#0: ffff8880422a4420 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515 #1: ffff88804755b390 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:850 [inline] #1: ffff88804755b390 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: filename_create+0x260/0x540 fs/namei.c:4026 #2: ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diAlloc+0x1b6/0x1630
#3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diNewIAG fs/jfs/jfs_imap.c:2460 [inline] #3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diAllocExt fs/jfs/jfs_imap.c:1905 [inline] #3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diAllocAG+0x4b7/0x1e50 fs/jfs/jfs_imap.c:1669 #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diNewIAG fs/jfs/jfs_imap.c:2477 [inline] #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diAllocExt fs/jfs/jfs_imap.c:1905 [inline] #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diAllocAG+0x869/0x1e50 fs/jfs/jfs_imap.c:1669
stack backtrace: CPU: 0 UID: 0 PID: 5309 Comm: syz-executor301 Not tainted 6.12.0-rc7-syzkaller-00212-g4a5df3796467 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_deadlock_bug+0x483/0x620 kernel/locking/lockdep.c:3037 check_deadlock kernel/locking/lockdep.c:3089 [inline] validate_chain+0x15e2/0x5920 kernel/locking/lockdep.c:3891 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 diFree+0x37c/0x2fb0 fs/jfs/jfs_imap.c:889 jfs_evict_inode+0x32d/0x440 fs/jfs/inode.c:156 evict+0x4e8/0x9b0 fs/inode.c:725 diFreeSpecial fs/jfs/jfs_imap.c:552 [inline] duplicateIXtree+0x3c6/0x550 fs/jfs/jfs_imap.c:3022 diNewIAG fs/jfs/jfs_imap.c:2597 [inline] diAllocExt fs/jfs/jfs_imap.c:1905 [inline] diAllocAG+0x17dc/0x1e50 fs/jfs/jfs_imap.c:1669 diAlloc+0x1d2/0x1630 fs/jfs/jfs_imap.c:1590 ialloc+0x8f/0x900 fs/jfs/jfs_inode.c:56 jfs_mkdir+0x1c5/0xba0 fs/jfs/namei.c:225 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257 do_mkdirat+0x264/0x3a0 fs/namei.c:4280 __do_sys_mkdirat fs/namei.c:4295 [inline] __se_sys_mkdirat fs/namei.c:4293 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4293 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- fs/jfs/jfs_imap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_imap.c +1 -1
@@ -456,7 +456,7 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary) dp += inum %8 ;/* 8 inodes per 4K page */ /* copy on-disk inode to in-memory inode */ -if ((copy_from_dinode (dp, ip)) !=0 ) { +if ((copy_from_dinode (dp, ip) !=0 ) || (ip->i_nlink ==0 )) {/* handle bad return by returning NULL for ip */ set_nlink (ip,1 );/* Don't want iput() deleting it */ iput (ip);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 11/26 jfs: add sanity check for agwidth in dbMount
In reply to Sasha LevinFrom: Edward Adam Davis <[email protected]>
[ Upstream commit ddf2846f22e8575d6b4b6a66f2100f168b8cd73d ]
The width in dmapctl of the AG is zero, it trigger a divide error when calculating the control page level in dbAllocAG.
To avoid this issue, add a check for agwidth in dbAllocAG.
--- fs/jfs/jfs_dmap.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/jfs/jfs_dmap.c +4 -0
@@ -204,6 +204,10 @@ int dbMount(struct inode *ipbmap) bmp->db_aglevel =le32_to_cpu (dbmp_le->dn_aglevel); bmp->db_agheight =le32_to_cpu (dbmp_le->dn_agheight); bmp->db_agwidth =le32_to_cpu (dbmp_le->dn_agwidth); +if (!bmp->db_agwidth) { + err = -EINVAL ; + goto err_release_metapage; + } bmp->db_agstart =le32_to_cpu (dbmp_le->dn_agstart); bmp->db_agl2size =le32_to_cpu (dbmp_le->dn_agl2size); if (bmp->db_agl2size > L2MAXL2SIZE - L2MAXAG ||
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 12/26 ata: libata-eh: Do not use ATAPI DMA for a device limited to PIO mode
In reply to Sasha LevinFrom: Niklas Cassel <[email protected]>
[ Upstream commit 91ec84f8eaddbc93d7c62e363d68aeb7b89879c7 ]
atapi_eh_request_sense() currently uses ATAPI DMA if the SATA controller has ATA_FLAG_PIO_DMA (PIO cmds via DMA) set.
However, ATA_FLAG_PIO_DMA is a flag that can be set by a low-level driver on a port at initialization time, before any devices are scanned.
If a controller detects a connected device that only supports PIO, we set the flag ATA_DFLAG_PIO.
Modify atapi_eh_request_sense() to not use ATAPI DMA if the connected device only supports PIO.
--- drivers/ata/libata-eh.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/ata/libata-eh.c +9 -2
@@ -1496,8 +1496,15 @@ unsigned int atapi_eh_request_sense(struct ata_device *dev, tf.flags |=ATA_TFLAG_ISADDR |ATA_TFLAG_DEVICE ; tf.command =ATA_CMD_PACKET ; -/* is it pointless to prefer PIO for "safety reasons"? */ -if (ap->flags &ATA_FLAG_PIO_DMA ) { +/* +* Do not use DMA if the connected device only supports PIO, even if the +* port prefers PIO commands via DMA. +* +* Ideally, we should call atapi_check_dma() to check if it is safe for +* the LLD to use DMA for REQUEST_SENSE, but we don't have a qc. +* Since we can't check the command, perhaps we should only use pio? +*/ +if ((ap->flags &ATA_FLAG_PIO_DMA ) && !(dev->flags &ATA_DFLAG_PIO )) { tf.protocol =ATAPI_PROT_DMA ; tf.feature |=ATAPI_PKT_DMA ; }else {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 13/26 net: sfp: add quirk for 2.5G OEM BX SFP
In reply to Sasha LevinFrom: Birger Koblitz <[email protected]>
[ Upstream commit a85035561025063125f81090e4f2bd65da368c83 ]
The OEM SFP-2.5G-BX10-D/U SFP module pair is meant to operate with 2500Base-X. However, in their EEPROM they incorrectly specify:
Transceiver codes : 0x00 0x12 0x00 0x00 0x12 0x00 0x01 0x05 0x00
BR, Nominal : 2500MBd
Use sfp_quirk_2500basex for this module to allow 2500Base-X mode anyway. Tested on BananaPi R3.
--- drivers/net/phy/sfp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/phy/sfp.c +2 -0
@@ -488,6 +488,8 @@ static const struct sfp_quirk sfp_quirks[] = {SFP_QUIRK_F ("OEM" ,"SFP-10G-T" , sfp_fixup_rollball_cc),SFP_QUIRK_M ("OEM" ,"SFP-2.5G-T" , sfp_quirk_oem_2_5g), +SFP_QUIRK_M ("OEM" ,"SFP-2.5G-BX10-D" , sfp_quirk_2500basex), +SFP_QUIRK_M ("OEM" ,"SFP-2.5G-BX10-U" , sfp_quirk_2500basex),SFP_QUIRK_F ("OEM" ,"RTSFP-10" , sfp_fixup_rollball_cc),SFP_QUIRK_F ("OEM" ,"RTSFP-10G" , sfp_fixup_rollball_cc), SFP_QUIRK_F("Turris", "RTSFP-10", sfp_fixup_rollball),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 14/26 wifi: ath12k: Fix invalid data access in ath12k_dp_rx_h_undecap_nwifi
In reply to Sasha LevinFrom: Manish Dharanenthiran <[email protected]>
[ Upstream commit 9a0dddfb30f120db3851627935851d262e4e7acb ]
In certain cases, hardware might provide packets with a length greater than the maximum native Wi-Fi header length. This can lead to accessing and modifying fields in the header within the ath12k_dp_rx_h_undecap_nwifi function for DP_RX_DECAP_TYPE_NATIVE_WIFI decap type and
potentially resulting in invalid data access and memory corruption.
Add a sanity check before processing the SKB to prevent invalid data access in the undecap native Wi-Fi function for the DP_RX_DECAP_TYPE_NATIVE_WIFI decap type.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/dp_rx.c | 42 +++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath12k/dp_rx.c +40 -2
@@ -2484,6 +2484,29 @@ static void ath12k_dp_rx_deliver_msdu(struct ath12k *ar, struct napi_struct *napieee80211_rx_napi (ar->hw, pubsta, msdu, napi); } +static bool ath12k_dp_rx_check_nwifi_hdr_len_valid (struct ath12k_base *ab, +struct hal_rx_desc *rx_desc, +struct sk_buff *msdu) +{ +struct ieee80211_hdr *hdr; +u8 decap_type; +u32 hdr_len; + + decap_type =ath12k_dp_rx_h_decap_type (ab, rx_desc); +if (decap_type !=DP_RX_DECAP_TYPE_NATIVE_WIFI ) +return true; + + hdr = (struct ieee80211_hdr *)msdu->data; + hdr_len =ieee80211_hdrlen (hdr->frame_control); + +if ((likely (hdr_len <=DP_MAX_NWIFI_HDR_LEN ))) +return true; + + ab->soc_stats.invalid_rbm++; +WARN_ON_ONCE (1 ); +return false; +} + static int ath12k_dp_rx_process_msdu(struct ath12k *ar, struct sk_buff *msdu, struct sk_buff_head *msdu_list,
@@ -2542,6 +2565,11 @@ static int ath12k_dp_rx_process_msdu(struct ath12k *ar, } } +if (unlikely (!ath12k_dp_rx_check_nwifi_hdr_len_valid (ab, rx_desc, msdu))) { + ret = -EINVAL ; + goto free_out; + } +ath12k_dp_rx_h_ppdu (ar, rx_desc, rx_status);ath12k_dp_rx_h_mpdu (ar, msdu, rx_desc, rx_status);
@@ -2867,6 +2895,9 @@ static int ath12k_dp_rx_h_verify_tkip_mic(struct ath12k *ar, struct ath12k_peerRX_FLAG_IV_STRIPPED |RX_FLAG_DECRYPTED ;skb_pull (msdu, hal_rx_desc_sz); +if (unlikely (!ath12k_dp_rx_check_nwifi_hdr_len_valid (ab, rx_desc, msdu))) +return -EINVAL ; +ath12k_dp_rx_h_ppdu (ar, rx_desc, rxs);ath12k_dp_rx_h_undecap (ar, msdu, rx_desc,HAL_ENCRYPT_TYPE_TKIP_MIC , rxs, true);
@@ -3590,6 +3621,9 @@ static int ath12k_dp_rx_h_null_q_desc(struct ath12k *ar, struct sk_buff *msdu,skb_put (msdu, hal_rx_desc_sz + l3pad_bytes + msdu_len);skb_pull (msdu, hal_rx_desc_sz + l3pad_bytes); } +if (unlikely (!ath12k_dp_rx_check_nwifi_hdr_len_valid (ab, desc, msdu))) +return -EINVAL ; +ath12k_dp_rx_h_ppdu (ar, desc, status);ath12k_dp_rx_h_mpdu (ar, msdu, desc, status);
@@ -3634,7 +3668,7 @@ static bool ath12k_dp_rx_h_reo_err(struct ath12k *ar, struct sk_buff *msdu,return drop; } -static void ath12k_dp_rx_h_tkip_mic_err (struct ath12k *ar,struct sk_buff *msdu, +static bool ath12k_dp_rx_h_tkip_mic_err (struct ath12k *ar,struct sk_buff *msdu,struct ieee80211_rx_status *status) {struct ath12k_base *ab = ar->ab;
@@ -3652,6 +3686,9 @@ static void ath12k_dp_rx_h_tkip_mic_err(struct ath12k *ar, struct sk_buff *msdu,skb_put (msdu, hal_rx_desc_sz + l3pad_bytes + msdu_len);skb_pull (msdu, hal_rx_desc_sz + l3pad_bytes); +if (unlikely (!ath12k_dp_rx_check_nwifi_hdr_len_valid (ab, desc, msdu))) +return true; +ath12k_dp_rx_h_ppdu (ar, desc, status); status->flag |= (RX_FLAG_MMIC_STRIPPED | RX_FLAG_MMIC_ERROR |
@@ -3659,6 +3696,7 @@ static void ath12k_dp_rx_h_tkip_mic_err(struct ath12k *ar, struct sk_buff *msdu,ath12k_dp_rx_h_undecap (ar, msdu, desc,HAL_ENCRYPT_TYPE_TKIP_MIC , status, false); +return false; } static bool ath12k_dp_rx_h_rxdma_err(struct ath12k *ar, struct sk_buff *msdu,
@@ -3677,7 +3715,7 @@ static bool ath12k_dp_rx_h_rxdma_err(struct ath12k *ar, struct sk_buff *msdu,case HAL_REO_ENTR_RING_RXDMA_ECODE_TKIP_MIC_ERR : err_bitmap =ath12k_dp_rx_h_mpdu_err (ab, rx_desc);if (err_bitmap &HAL_RX_MPDU_ERR_TKIP_MIC ) { -ath12k_dp_rx_h_tkip_mic_err (ar, msdu, status); + drop =ath12k_dp_rx_h_tkip_mic_err (ar, msdu, status);break ; } fallthrough;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 15/26 f2fs: fix to avoid out-of-bounds access in f2fs_truncate_inode_blocks()
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit e6494977bd4a83862118a05f57a8df40256951c0 ]
syzbot reports an UBSAN issue as below:
------------[ cut here ]------------ UBSAN: array-index-out-of-bounds in fs/f2fs/node.h:381:10 index 18446744073709550692 is out of range for type '__le32[5]' (aka 'unsigned int[5]') CPU: 0 UID: 0 PID: 5318 Comm: syz.0.0 Not tainted 6.14.0-rc3-syzkaller-00060-g6537cfb395f3 #0 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 ubsan_epilogue lib/ubsan.c:231 [inline] __ubsan_handle_out_of_bounds+0x121/0x150 lib/ubsan.c:429 get_nid fs/f2fs/node.h:381 [inline] f2fs_truncate_inode_blocks+0xa5e/0xf60 fs/f2fs/node.c:1181 f2fs_do_truncate_blocks+0x782/0x1030 fs/f2fs/file.c:808 f2fs_truncate_blocks+0x10d/0x300 fs/f2fs/file.c:836 f2fs_truncate+0x417/0x720 fs/f2fs/file.c:886 f2fs_file_write_iter+0x1bdb/0x2550 fs/f2fs/file.c:5093 aio_write+0x56b/0x7c0 fs/aio.c:1633 io_submit_one+0x8a7/0x18a0 fs/aio.c:2052 __do_sys_io_submit fs/aio.c:2111 [inline] __se_sys_io_submit+0x171/0x2e0 fs/aio.c:2081 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f238798cde9
index 18446744073709550692 (decimal, unsigned long long) = 0xfffffffffffffc64 (hexadecimal, unsigned long long) = -924 (decimal, long long)
In f2fs_truncate_inode_blocks(), UBSAN detects that get_nid() tries to access .i_nid[-924], it means both offset[0] and level should zero.
The possible case should be in f2fs_do_truncate_blocks(), we try to truncate inode size to zero, however, dn.ofs_in_node is zero and dn.node_page is not an inode page, so it fails to truncate inode page, and then pass zeroed free_from to f2fs_truncate_inode_blocks(), result in this issue.
if (dn.ofs_in_node || IS_INODE(dn.node_page)) {
f2fs_truncate_data_blocks_range(&dn, count);
free_from += count;
}I guess the reason why dn.node_page is not an inode page could be: there are multiple nat entries share the same node block address, once the node block address was reused, f2fs_get_node_page() may load a non-inode block.
Let's add a sanity check for such condition to avoid out-of-bounds access issue.
--- fs/f2fs/node.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/f2fs/node.c +8 -1
@@ -1134,7 +1134,14 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from)trace_f2fs_truncate_inode_blocks_enter (inode, from); level =get_node_path (inode, from, offset, noffset); -if (level <0 ) { +if (level <=0 ) { +if (!level) { + level = -EFSCORRUPTED ; +f2fs_err (sbi,"%s: inode ino=%lx has corrupted node block, from:%lu addrs:%u" , + __func__, inode->i_ino, + from,ADDRS_PER_INODE (inode)); +set_sbi_flag (sbi,SBI_NEED_FSCK ); + }trace_f2fs_truncate_inode_blocks_exit (inode, level);return level; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 16/26 ahci: add PCI ID for Marvell 88SE9215 SATA Controller
In reply to Sasha LevinFrom: Daniel Kral <[email protected]>
[ Upstream commit 885251dc35767b1c992f6909532ca366c830814a ]
Add support for Marvell Technology Group Ltd. 88SE9215 SATA 6 Gb/s controller, which is e.g. used in the DAWICONTROL DC-614e RAID bus controller and was not automatically recognized before.
Tested with a DAWICONTROL DC-614e RAID bus controller.
--- drivers/ata/ahci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/ata/ahci.c +2 -0
@@ -591,6 +591,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3), .driver_data = board_ahci_yes_fbs }, + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9215), + .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9235),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 17/26 ext4: protect ext4_release_dquot against freezing
In reply to Sasha LevinFrom: Ojaswin Mujoo <[email protected]>
[ Upstream commit 530fea29ef82e169cd7fe048c2b7baaeb85a0028 ]
Protect ext4_release_dquot against freezing so that we don't try to start a transaction when FS is frozen, leading to warnings.
Further, avoid taking the freeze protection if a transaction is already running so that we don't need end up in a deadlock as described in
46e294efc355 ext4: fix deadlock with fs freezing and EA inodes
--- fs/ext4/super.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
fs/ext4/super.c +17 -0
@@ -6926,12 +6926,25 @@ static int ext4_release_dquot(struct dquot *dquot) {int ret, err;handle_t *handle; +bool freeze_protected = false; + +/* +* Trying to sb_start_intwrite() in a running transaction +* can result in a deadlock. Further, running transactions +* are already protected from freezing. +*/ +if (!ext4_journal_current_handle ()) { +sb_start_intwrite (dquot->dq_sb); + freeze_protected = true; + } handle =ext4_journal_start (dquot_to_inode (dquot),EXT4_HT_QUOTA ,EXT4_QUOTA_DEL_BLOCKS (dquot->dq_sb));if (IS_ERR (handle)) {/* Release dquot anyway to avoid endless cycle in dqput() */ dquot_release (dquot); +if (freeze_protected) +sb_end_intwrite (dquot->dq_sb);return PTR_ERR (handle); } ret =dquot_release (dquot);
@@ -6942,6 +6955,10 @@ static int ext4_release_dquot(struct dquot *dquot) err =ext4_journal_stop (handle);if (!ret) ret = err; + +if (freeze_protected) +sb_end_intwrite (dquot->dq_sb); +return ret; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 18/26 Revert "f2fs: rebuild nat_bits during umount"
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 19426c4988aa85298c1b4caf2889d37ec5c80fea ]
This reverts commit 94c821fb286b545d37549ff30a0c341e066f0d6c.
It reports that there is potential corruption in node footer, the most suspious feature is nat_bits, let's revert recovery related code.
--- fs/f2fs/checkpoint.c | 21 +++------ fs/f2fs/f2fs.h | 32 +++++++++++++- fs/f2fs/node.c | 101 ++++++++++--------------------------------- 3 files changed, 59 insertions(+), 95 deletions(-)
fs/f2fs/checkpoint.c +6 -15
@@ -1327,21 +1327,13 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)struct f2fs_checkpoint *ckpt =F2FS_CKPT (sbi);unsigned long flags; -if (cpc->reason &CP_UMOUNT ) { -if (le32_to_cpu (ckpt->cp_pack_total_block_count) + -NM_I (sbi)->nat_bits_blocks >BLKS_PER_SEG (sbi)) { -clear_ckpt_flags (sbi,CP_NAT_BITS_FLAG ); -f2fs_notice (sbi,"Disable nat_bits due to no space" ); - }else if (!is_set_ckpt_flags (sbi,CP_NAT_BITS_FLAG ) && -f2fs_nat_bitmap_enabled (sbi)) { -f2fs_enable_nat_bits (sbi); -set_ckpt_flags (sbi,CP_NAT_BITS_FLAG ); -f2fs_notice (sbi,"Rebuild and enable nat_bits" ); - } - } -spin_lock_irqsave (&sbi->cp_lock, flags); +if ((cpc->reason &CP_UMOUNT ) && +le32_to_cpu (ckpt->cp_pack_total_block_count) > + sbi->blocks_per_seg -NM_I (sbi)->nat_bits_blocks) +disable_nat_bits (sbi, false); +if (cpc->reason &CP_TRIMMED )__set_ckpt_flags (ckpt,CP_TRIMMED_FLAG );else
@@ -1524,8 +1516,7 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) start_blk =__start_cp_next_addr (sbi);/* write nat bits */ -if ((cpc->reason &CP_UMOUNT ) && -is_set_ckpt_flags (sbi,CP_NAT_BITS_FLAG )) { +if (enabled_nat_bits (sbi, cpc)) {__u64 cp_ver =cur_cp_version (ckpt);block_t blk;
fs/f2fs/f2fs.h +30 -2
@@ -2197,6 +2197,36 @@ static inline void f2fs_up_write(struct f2fs_rwsem *sem)#endif } +static inline void disable_nat_bits (struct f2fs_sb_info *sbi,bool lock) +{ +unsigned long flags; +unsigned char *nat_bits; + +/* +* In order to re-enable nat_bits we need to call fsck.f2fs by +* set_sbi_flag(sbi, SBI_NEED_FSCK). But it may give huge cost, +* so let's rely on regular fsck or unclean shutdown. +*/ + +if (lock) +spin_lock_irqsave (&sbi->cp_lock, flags); +__clear_ckpt_flags (F2FS_CKPT (sbi),CP_NAT_BITS_FLAG ); + nat_bits =NM_I (sbi)->nat_bits; +NM_I (sbi)->nat_bits =NULL ; +if (lock) +spin_unlock_irqrestore (&sbi->cp_lock, flags); + +kvfree (nat_bits); +} + +static inline bool enabled_nat_bits (struct f2fs_sb_info *sbi, +struct cp_control *cpc) +{ +bool set =is_set_ckpt_flags (sbi,CP_NAT_BITS_FLAG ); + +return (cpc) ? (cpc->reason &CP_UMOUNT ) && set : set; +} +static inline void f2fs_lock_op (struct f2fs_sb_info *sbi) {f2fs_down_read (&sbi->cp_rwsem);
@@ -3623,7 +3653,6 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from);int f2fs_truncate_xattr_node (struct inode *inode);int f2fs_wait_on_node_pages_writeback (struct f2fs_sb_info *sbi,unsigned int seq_id); -bool f2fs_nat_bitmap_enabled (struct f2fs_sb_info *sbi);int f2fs_remove_inode_page (struct inode *inode);struct page *f2fs_new_inode_page (struct inode *inode);struct page *f2fs_new_node_page (struct dnode_of_data *dn,unsigned int ofs);
@@ -3648,7 +3677,6 @@ int f2fs_recover_xattr_data(struct inode *inode, struct page *page);int f2fs_recover_inode_page (struct f2fs_sb_info *sbi,struct page *page);int f2fs_restore_node_summary (struct f2fs_sb_info *sbi,unsigned int segno,struct f2fs_summary_block *sum); -void f2fs_enable_nat_bits (struct f2fs_sb_info *sbi);int f2fs_flush_nat_entries (struct f2fs_sb_info *sbi,struct cp_control *cpc);int f2fs_build_node_manager (struct f2fs_sb_info *sbi);void f2fs_destroy_node_manager (struct f2fs_sb_info *sbi);
fs/f2fs/node.c +23 -78
178 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 19/26 ext4: ignore xattrs past end
In reply to Sasha LevinFrom: Bhupesh <[email protected]>
[ Upstream commit c8e008b60492cf6fd31ef127aea6d02fd3d314cd ]
Once inside 'ext4_xattr_inode_dec_ref_all' we should ignore xattrs entries past the 'end' entry.
This fixes the following KASAN reported issue:
==================================================================
BUG: KASAN: slab-use-after-free in ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 Read of size 4 at addr ffff888012c120c4 by task repro/2065 CPU: 1 UID: 0 PID: 2065 Comm: repro Not tainted 6.13.0-rc2+ #11 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x1fd/0x300 ? tcp_gro_dev_warn+0x260/0x260 ? _printk+0xc0/0x100 ? read_lock_is_recursive+0x10/0x10 ? irq_work_queue+0x72/0xf0 ? __virt_addr_valid+0x17b/0x4b0 print_address_description+0x78/0x390 print_report+0x107/0x1f0 ? __virt_addr_valid+0x17b/0x4b0 ? __virt_addr_valid+0x3ff/0x4b0 ? __phys_addr+0xb5/0x160 ? ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 kasan_report+0xcc/0x100 ? ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 ? ext4_xattr_delete_inode+0xd30/0xd30 ? __ext4_journal_ensure_credits+0x5f0/0x5f0 ? __ext4_journal_ensure_credits+0x2b/0x5f0 ? inode_update_timestamps+0x410/0x410 ext4_xattr_delete_inode+0xb64/0xd30 ? ext4_truncate+0xb70/0xdc0 ? ext4_expand_extra_isize_ea+0x1d20/0x1d20 ? __ext4_mark_inode_dirty+0x670/0x670 ? ext4_journal_check_start+0x16f/0x240 ? ext4_inode_is_fast_symlink+0x2f2/0x3a0 ext4_evict_inode+0xc8c/0xff0 ? ext4_inode_is_fast_symlink+0x3a0/0x3a0 ? do_raw_spin_unlock+0x53/0x8a0 ? ext4_inode_is_fast_symlink+0x3a0/0x3a0 evict+0x4ac/0x950 ? proc_nr_inodes+0x310/0x310 ? trace_ext4_drop_inode+0xa2/0x220 ? _raw_spin_unlock+0x1a/0x30 ? iput+0x4cb/0x7e0 do_unlinkat+0x495/0x7c0 ? try_break_deleg+0x120/0x120 ? 0xffffffff81000000 ? __check_object_size+0x15a/0x210 ? strncpy_from_user+0x13e/0x250 ? getname_flags+0x1dc/0x530 __x64_sys_unlinkat+0xc8/0xf0 do_syscall_64+0x65/0x110 entry_SYSCALL_64_after_hwframe+0x67/0x6f RIP: 0033:0x434ffd Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 8 RSP: 002b:00007ffc50fa7b28 EFLAGS: 00000246 ORIG_RAX: 0000000000000107 RAX: ffffffffffffffda RBX: 00007ffc50fa7e18 RCX: 0000000000434ffd RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000005 RBP: 00007ffc50fa7be0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffc50fa7e08 R14: 00000000004bbf30 R15: 0000000000000001 </TASK> The buggy address belongs to the object at ffff888012c12000 which belongs to the cache filp of size 360
The buggy address is located 196 bytes inside of
freed 360-byte region [ffff888012c12000, ffff888012c12168)
The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12c12 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x40(head|node=0|zone=0) page_type: f5(slab) raw: 0000000000000040 ffff888000ad7640 ffffea0000497a00 dead000000000004 raw: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000
head: 0000000000000040 ffff888000ad7640 ffffea0000497a00 dead000000000004
head: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000
head: 0000000000000001 ffffea00004b0481 ffffffffffffffff 0000000000000000
head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888012c11f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888012c12000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
Quoted 1 line
ffff888012c12080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888012c12100: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
ffff888012c12180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
--- fs/ext4/xattr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/ext4/xattr.c +10 -1
@@ -1176,15 +1176,24 @@ ext4_xattr_inode_dec_ref_all(handle_t *handle, struct inode *parent, {struct inode *ea_inode;struct ext4_xattr_entry *entry; +struct ext4_iloc iloc;bool dirty = false;unsigned int ea_ino;int err;int credits; +void *end; + +if (block_csum) + end = (void *)bh->b_data + bh->b_size; +else { +ext4_get_inode_loc (parent, &iloc); + end = (void *)ext4_raw_inode (&iloc) +EXT4_SB (parent->i_sb)->s_inode_size; + }/* One credit for dec ref on ea_inode, one for orphan list addition, */ credits =2 + extra_credits; -for (entry = first; !IS_LAST_ENTRY (entry); +for (entry = first; (void *)entry < end && !IS_LAST_ENTRY (entry); entry =EXT4_XATTR_NEXT (entry)) {if (!entry->e_value_inum)continue ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 20/26 cdc_ether|r8152: ThinkPad Hybrid USB-C/A Dock quirk
In reply to Sasha LevinFrom: Philipp Hahn <[email protected]>
[ Upstream commit a07f23ad9baf716cbf7746e452c92960536ceae6 ]
Lenovo ThinkPad Hybrid USB-C with USB-A Dock (17ef:a359) is affected by the same problem as the Lenovo Powered USB-C Travel Hub (17ef:721e):
Both are based on the Realtek RTL8153B chip used to use the cdc_ether driver. However, using this driver, with the system suspended the device constantly sends pause-frames as soon as the receive buffer fills up. This causes issues with other devices, where some Ethernet switches stop forwarding packets altogether.
Using the Realtek driver (r8152) fixes this issue. Pause frames are no longer sent while the host system is suspended.
--- drivers/net/usb/cdc_ether.c | 7 +++++++ drivers/net/usb/r8152.c | 6 ++++++ drivers/net/usb/r8153_ecm.c | 6 ++++++ 3 files changed, 19 insertions(+)
drivers/net/usb/cdc_ether.c +7 -0
@@ -782,6 +782,13 @@ static const struct usb_device_id products[] = { .driver_info = 0, }, +/* Lenovo ThinkPad Hybrid USB-C with USB-A Dock (40af0135eu, based on Realtek RTL8153) */ +{ +USB_DEVICE_AND_INTERFACE_INFO (LENOVO_VENDOR_ID ,0xa359 ,USB_CLASS_COMM , + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), + .driver_info =0 , +}, + /* Aquantia AQtion USB to 5GbE Controller (based on AQC111U) */ { USB_DEVICE_AND_INTERFACE_INFO(AQUANTIA_VENDOR_ID, 0xc101,
drivers/net/usb/r8152.c +6 -0
@@ -784,6 +784,7 @@ enum rtl8152_flags {#define DEVICE_ID_THINKPAD_USB_C_DONGLE 0x720c#define DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2 0xa387#define DEVICE_ID_THINKPAD_USB_C_DOCK_GEN3 0x3062 +#define DEVICE_ID_THINKPAD_HYBRID_USB_C_DOCK 0xa359struct tally_counter {__le64 tx_packets;
@@ -9734,6 +9735,7 @@ static bool rtl8152_supports_lenovo_macpassthru(struct usb_device *udev)case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2 :case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN3 :case DEVICE_ID_THINKPAD_USB_C_DONGLE : +case DEVICE_ID_THINKPAD_HYBRID_USB_C_DOCK :return 1 ; } }else if (vendor_id ==VENDOR_ID_REALTEK && parent_vendor_id ==VENDOR_ID_LENOVO ) {
@@ -10011,6 +10013,8 @@ static const struct usb_device_id rtl8152_table[] = { { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927) }, { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0c5e) }, { USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101) }, + +/* Lenovo */ { USB_DEVICE(VENDOR_ID_LENOVO, 0x304f) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x3054) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x3062) },
@@ -10021,7 +10025,9 @@ static const struct usb_device_id rtl8152_table[] = { { USB_DEVICE(VENDOR_ID_LENOVO, 0x720c) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x7214) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x721e) }, + { USB_DEVICE(VENDOR_ID_LENOVO, 0xa359) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0xa387) }, + { USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041) }, { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) }, { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) },
drivers/net/usb/r8153_ecm.c +6 -0
@@ -135,6 +135,12 @@ static const struct usb_device_id products[] = { USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), .driver_info = (unsigned long)&r8153_info, }, +/* Lenovo ThinkPad Hybrid USB-C with USB-A Dock (40af0135eu, based on Realtek RTL8153) */ +{ + USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID_LENOVO, 0xa359, USB_CLASS_COMM, +USB_CDC_SUBCLASS_ETHERNET ,USB_CDC_PROTO_NONE ), + .driver_info = (unsigned long)&r8153_info, +}, { }, /* END */ };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 21/26 scsi: st: Fix array overflow in st_setup()
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit a018d1cf990d0c339fe0e29b762ea5dc10567d67 ]
Change the array size to follow parms size instead of a fixed value.
--- drivers/scsi/st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/st.c +1 -1
@@ -4120,7 +4120,7 @@ static void validate_options(void)*/ static int __init st_setup (char *str) { -int i, len, ints[5 ]; +int i, len, ints[ARRAY_SIZE (parms) +1 ];char *stp; stp =get_options (str,ARRAY_SIZE (ints), ints);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 22/26 wifi: mt76: mt76x2u: add TP-Link TL-WDN6200 ID to device table
In reply to Sasha LevinFrom: Icenowy Zheng <[email protected]>
[ Upstream commit 06cccc2ebbe6c8a20f714f3a0ff3ff489d3004bb ]
The TP-Link TL-WDN6200 "Driverless" version cards use a MT7612U chipset.
Add the USB ID to mt76x2u driver.
--- drivers/net/wireless/mediatek/mt76/mt76x2/usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c +1 -0
@@ -21,6 +21,7 @@ static const struct usb_device_id mt76x2u_device_table[] = { { USB_DEVICE(0x0846, 0x9053) }, /* Netgear A6210 */ { USB_DEVICE(0x045e, 0x02e6) }, /* XBox One Wireless Adapter */ { USB_DEVICE(0x045e, 0x02fe) }, /* XBox One Wireless Adapter */ + { USB_DEVICE(0x2357, 0x0137) }, /* TP-Link TL-WDN6200 */ { }, };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 23/26 net: vlan: don't propagate flags on open
In reply to Sasha LevinFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit 27b918007d96402aba10ed52a6af8015230f1793 ]
With the device instance lock, there is now a possibility of a deadlock:
[ 1.211455] ============================================
[ 1.211571] WARNING: possible recursive locking detected
[ 1.211687] 6.14.0-rc5-01215-g032756b4ca7a-dirty #5 Not tainted
[ 1.211823] --------------------------------------------
[ 1.211936] ip/184 is trying to acquire lock:
[ 1.212032] ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_set_allmulti+0x4e/0xb0
[ 1.212207]
[ 1.212207] but task is already holding lock:
[ 1.212332] ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_open+0x50/0xb0
[ 1.212487]
[ 1.212487] other info that might help us debug this:
[ 1.212626] Possible unsafe locking scenario:
[ 1.212626]
[ 1.212751] CPU0
[ 1.212815] ----
[ 1.212871] lock(&dev->lock);
[ 1.212944] lock(&dev->lock);
[ 1.213016]
[ 1.213016] *** DEADLOCK ***
[ 1.213016]
[ 1.213143] May be due to missing lock nesting notation
[ 1.213143]
[ 1.213294] 3 locks held by ip/184:
[ 1.213371] #0: ffffffff838b53e0 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock+0x1b/0xa0
[ 1.213543] #1: ffffffff84e5fc70 (&net->rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock+0x37/0xa0
[ 1.213727] #2: ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_open+0x50/0xb0
[ 1.213895]
[ 1.213895] stack backtrace:
[ 1.213991] CPU: 0 UID: 0 PID: 184 Comm: ip Not tainted 6.14.0-rc5-01215-g032756b4ca7a-dirty #5
[ 1.213993] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.3-1-1 04/01/2014
[ 1.213994] Call Trace:
[ 1.213995] <TASK>
[ 1.213996] dump_stack_lvl+0x8e/0xd0
[ 1.214000] print_deadlock_bug+0x28b/0x2a0
[ 1.214020] lock_acquire+0xea/0x2a0
[ 1.214027] __mutex_lock+0xbf/0xd40
[ 1.214038] dev_set_allmulti+0x4e/0xb0 # real_dev->flags & IFF_ALLMULTI
[ 1.214040] vlan_dev_open+0xa5/0x170 # ndo_open on vlandev
[ 1.214042] __dev_open+0x145/0x270
[ 1.214046] __dev_change_flags+0xb0/0x1e0
[ 1.214051] netif_change_flags+0x22/0x60 # IFF_UP vlandev
[ 1.214053] dev_change_flags+0x61/0xb0 # for each device in group from dev->vlan_info
[ 1.214055] vlan_device_event+0x766/0x7c0 # on netdevsim0
[ 1.214058] notifier_call_chain+0x78/0x120
[ 1.214062] netif_open+0x6d/0x90
[ 1.214064] dev_open+0x5b/0xb0 # locks netdevsim0
[ 1.214066] bond_enslave+0x64c/0x1230
[ 1.214075] do_set_master+0x175/0x1e0 # on netdevsim0
[ 1.214077] do_setlink+0x516/0x13b0
[ 1.214094] rtnl_newlink+0xaba/0xb80
[ 1.214132] rtnetlink_rcv_msg+0x440/0x490
[ 1.214144] netlink_rcv_skb+0xeb/0x120
[ 1.214150] netlink_unicast+0x1f9/0x320
[ 1.214153] netlink_sendmsg+0x346/0x3f0
[ 1.214157] __sock_sendmsg+0x86/0xb0
[ 1.214160] ____sys_sendmsg+0x1c8/0x220
[ 1.214164] ___sys_sendmsg+0x28f/0x2d0
[ 1.214179] __x64_sys_sendmsg+0xef/0x140
[ 1.214184] do_syscall_64+0xec/0x1d0
[ 1.214190] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 1.214191] RIP: 0033:0x7f2d1b4a7e56Device setup:
netdevsim0 (down)
^ ^
bond netdevsim1.100@netdevsim1 allmulticast=on (down)
When we enslave the lower device (netdevsim0) which has a vlan, we propagate vlan's allmuti/promisc flags during ndo_open. This causes (re)locking on of the real_dev.
Propagate allmulti/promisc on flags change, not on the open. There is a slight semantics change that vlans that are down now propagate the flags, but this seems unlikely to result in the real issues.
Reproducer:
echo 0 1 > /sys/bus/netdevsim/new_device
dev_path=$(ls -d /sys/bus/netdevsim/devices/netdevsim0/net/*) dev=$(echo $dev_path | rev | cut -d/ -f1 | rev)
ip link set dev $dev name netdevsim0
ip link set dev netdevsim0 up
ip link add link netdevsim0 name netdevsim0.100 type vlan id 100 ip link set dev netdevsim0.100 allmulticast on down ip link add name bond1 type bond mode 802.3ad
ip link set dev netdevsim0 down
ip link set dev netdevsim0 master bond1
ip link set dev bond1 up
ip link show
--- net/8021q/vlan_dev.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-)
net/8021q/vlan_dev.c +4 -27
@@ -273,17 +273,6 @@ static int vlan_dev_open(struct net_device *dev) goto out; } -if (dev->flags &IFF_ALLMULTI ) { - err =dev_set_allmulti (real_dev,1 ); -if (err <0 ) - goto del_unicast; - } -if (dev->flags &IFF_PROMISC ) { - err =dev_set_promiscuity (real_dev,1 ); -if (err <0 ) - goto clear_allmulti; - } -ether_addr_copy (vlan->real_dev_addr, real_dev->dev_addr);if (vlan->flags &VLAN_FLAG_GVRP )
@@ -297,12 +286,6 @@ static int vlan_dev_open(struct net_device *dev)netif_carrier_on (dev);return 0 ; -clear_allmulti: -if (dev->flags &IFF_ALLMULTI ) -dev_set_allmulti (real_dev,-1 ); -del_unicast: -if (!ether_addr_equal (dev->dev_addr, real_dev->dev_addr)) -dev_uc_del (real_dev, dev->dev_addr); out:netif_carrier_off (dev);return err;
@@ -315,10 +298,6 @@ static int vlan_dev_stop(struct net_device *dev)dev_mc_unsync (real_dev, dev);dev_uc_unsync (real_dev, dev); -if (dev->flags &IFF_ALLMULTI ) -dev_set_allmulti (real_dev,-1 ); -if (dev->flags &IFF_PROMISC ) -dev_set_promiscuity (real_dev,-1 );if (!ether_addr_equal (dev->dev_addr, real_dev->dev_addr))dev_uc_del (real_dev, dev->dev_addr);
@@ -490,12 +469,10 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change) {struct net_device *real_dev =vlan_dev_priv (dev)->real_dev; -if (dev->flags &IFF_UP ) { -if (change &IFF_ALLMULTI ) -dev_set_allmulti (real_dev, dev->flags &IFF_ALLMULTI ?1 :-1 ); -if (change &IFF_PROMISC ) -dev_set_promiscuity (real_dev, dev->flags &IFF_PROMISC ?1 :-1 ); - } +if (change &IFF_ALLMULTI ) +dev_set_allmulti (real_dev, dev->flags &IFF_ALLMULTI ?1 :-1 ); +if (change &IFF_PROMISC ) +dev_set_promiscuity (real_dev, dev->flags &IFF_PROMISC ?1 :-1 ); }static void vlan_dev_set_rx_mode (struct net_device *vlan_dev)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 24/26 tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER
In reply to Sasha LevinFrom: Gabriele Paoloni <[email protected]>
[ Upstream commit 0c588ac0ca6c22b774d9ad4a6594681fdfa57d9d ]
When __ftrace_event_enable_disable invokes the class callback to unregister the event, the return value is not reported up to the caller, hence leading to event unregister failures being silently ignored.
This patch assigns the ret variable to the invocation of the event unregister callback, so that its return value is stored and reported to the caller, and it raises a warning in case of error.
--- kernel/trace/trace_events.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/trace_events.c +3 -1
@@ -790,7 +790,9 @@ static int __ftrace_event_enable_disable(struct trace_event_file *file,clear_bit (EVENT_FILE_FL_RECORDED_TGID_BIT , &file->flags); } - call->class->reg (call,TRACE_REG_UNREGISTER , file); + ret = call->class->reg (call,TRACE_REG_UNREGISTER , file); + +WARN_ON_ONCE (ret); }/* If in SOFT_MODE, just set the SOFT_DISABLE_BIT, else clear it */ if (file->flags &EVENT_FILE_FL_SOFT_MODE )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 25/26 Bluetooth: hci_uart: fix race during initialization
In reply to Sasha LevinFrom: Arseniy Krasnov <[email protected]>
[ Upstream commit 366ceff495f902182d42b6f41525c2474caf3f9a ]
'hci_register_dev()' calls power up function, which is executed by kworker - 'hci_power_on()'. This function does access to bluetooth chip using callbacks from 'hci_ldisc.c', for example 'hci_uart_send_frame()'. Now 'hci_uart_send_frame()' checks 'HCI_UART_PROTO_READY' bit set, and if not - it fails. Problem is that 'HCI_UART_PROTO_READY' is set after 'hci_register_dev()', and there is tiny chance that 'hci_power_on()' will be executed before setting this bit. In that case HCI init logic fails.
Patch moves setting of 'HCI_UART_PROTO_READY' before calling function 'hci_uart_register_dev()'.
--- drivers/bluetooth/hci_ldisc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_ldisc.c +2 -1
@@ -704,12 +704,13 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id) hu->proto = p; +set_bit (HCI_UART_PROTO_READY , &hu->flags); + err =hci_uart_register_dev (hu);if (err) {return err; } -set_bit (HCI_UART_PROTO_READY , &hu->flags);return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 26/26 Bluetooth: qca: simplify WCN399x NVM loading
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 1cc41b5092e3aa511454ec882c525af311bee631 ]
The WCN399x code has two separate cases for loading the NVM data. In preparation to adding support for WCN3950, which also requires similar quirk, split the "variant" to be specified explicitly and merge two snprintfs into a single one.
--- drivers/bluetooth/btqca.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/bluetooth/btqca.c +6 -7
@@ -807,6 +807,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, const char *firmware_name) {struct qca_fw_config config = {}; +const char *variant ="" ;int err;u8 rom_ver =0 ;u32 soc_ver;
@@ -901,13 +902,11 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 : -if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) { -snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02xu.bin" , rom_ver); - }else { -snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02x.bin" , rom_ver); - } +if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) + variant ="u" ; + +snprintf (config.fwname,sizeof (config.fwname), +"qca/crnv%02x%s.bin" , rom_ver, variant);break ;case QCA_WCN3988 : snprintf(config.fwname, sizeof(config.fwname),
Signature · 1 line
2.39.5
Re: [PATCH AUTOSEL 6.6 26/26] Bluetooth: qca: simplify WCN399x NVM loading
Hi!
Quoted 4 lines
The WCN399x code has two separate cases for loading the NVM data. In preparation to adding support for WCN3950, which also requires similar quirk, split the "variant" to be specified explicitly and merge two snprintfs into a single one.
This is a cleanup, so we should not need it in -stable.
Best reagrds,
Pavel
Quoted 28 lines
+++
b/drivers/bluetooth/btqca.cdrivers/bluetooth/btqca.c +6
-7@@ -807,6 +807,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, const char *firmware_name) {struct qca_fw_config config = {}; +const char *variant ="" ;int err;u8 rom_ver =0 ;u32 soc_ver;@@ -901,13 +902,11 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 : -if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) { -snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02xu.bin" , rom_ver); - }else { -snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02x.bin" , rom_ver); - } +if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) + variant ="u" ; + +snprintf (config.fwname,sizeof (config.fwname), +"qca/crnv%02x%s.bin" , rom_ver, variant);break ;case QCA_WCN3988 : snprintf(config.fwname, sizeof(config.fwname),
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany