6.5.5-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 130/211 printk: Do not take console lock for console_flush_on_panic()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
[ Upstream commit eacb04ff3c5b8662a65f380ae450250698448cff ]
Currently console_flush_on_panic() will attempt to acquire the console lock when flushing the buffer on panic. If it fails to acquire the lock, it continues anyway because this is the last chance to get any pending records printed.
The reason why the console lock was attempted at all was to prevent any other CPUs from acquiring the console lock for printing while the panic CPU was printing. But as of the previous commit, non-panic CPUs will no longer attempt to acquire the console lock in a panic situation. Therefore it is no longer strictly necessary for a panic CPU to acquire the console lock.
Avoiding taking the console lock when flushing in panic has the additional benefit of avoiding possible deadlocks due to semaphore usage in NMI context (semaphores are not NMI-safe) and avoiding possible deadlocks if another CPU accesses the semaphore and is stopped while holding one of the semaphore's internal spinlocks.
--- kernel/printk/printk.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
kernel/printk/printk.c +19 -9
@@ -3120,14 +3120,24 @@ void console_unblank(void)*/ void console_flush_on_panic (enum con_flush_mode mode) { +bool handover; +u64 next_seq; +/* -* If someone else is holding the console lock, trylock will fail -* and may_schedule may be set. Ignore and proceed to unlock so -* that messages are flushed out. As this can be called from any -* context and we don't want to get preempted while flushing, -* ensure may_schedule is cleared. +* Ignore the console lock and flush out the messages. Attempting a +* trylock would not be useful because: +* +* - if it is contended, it must be ignored anyway +* - console_lock() and console_trylock() block and fail +* respectively in panic for non-panic CPUs +* - semaphores are not NMI-safe +*/ + +/* +* If another context is holding the console lock, +* @console_may_schedule might be set. Clear it so that +* this context does not call cond_resched() while flushing. */ -console_trylock (); console_may_schedule =0 ;if (mode ==CONSOLE_REPLAY_ALL ) {
@@ -3140,15 +3150,15 @@ void console_flush_on_panic(enum con_flush_mode mode) cookie =console_srcu_read_lock ();for_each_console_srcu (c) {/* -* If the above console_trylock() failed, this is an -* unsynchronized assignment. But in that case, the +* This is an unsynchronized assignment, but the * kernel is in "hope and pray" mode anyway. */ c->seq = seq; }console_srcu_read_unlock (cookie); } -console_unlock (); + +console_flush_all (false, &next_seq, &handover); }/*
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 131/211 printk: Consolidate console deferred printing
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
[ Upstream commit 696ffaf50e1f8dbc66223ff614473f945f5fb8d8 ]
Printing to consoles can be deferred for several reasons:
- explicitly with printk_deferred()
- printk() in NMI context
- recursive printk() calls
The current implementation is not consistent. For printk_deferred(), irq work is scheduled twice. For NMI und recursive, panic CPU suppression and caller delays are not properly enforced.
Correct these inconsistencies by consolidating the deferred printing code so that vprintk_deferred() is the top-level function for deferred printing and vprintk_emit() will perform whichever irq_work queueing is appropriate.
Also add kerneldoc for wake_up_klogd() and defer_console_output() to clarify their differences and appropriate usage.
--- kernel/printk/printk.c | 35 ++++++++++++++++++++++++++++------- kernel/printk/printk_safe.c | 9 ++------- 2 files changed, 30 insertions(+), 14 deletions(-)
kernel/printk/printk.c +28 -7
@@ -2308,7 +2308,11 @@ asmlinkage int vprintk_emit(int facility, int level,preempt_enable (); } -wake_up_klogd (); +if (in_sched) +defer_console_output (); +else +wake_up_klogd (); +return printed_len; }EXPORT_SYMBOL (vprintk_emit);
@@ -3843,11 +3847,33 @@ static void __wake_up_klogd(int val)preempt_enable (); } +/** +* wake_up_klogd - Wake kernel logging daemon +* +* Use this function when new records have been added to the ringbuffer +* and the console printing of those records has already occurred or is +* known to be handled by some other context. This function will only +* wake the logging daemon. +* +* Context: Any context. +*/ void wake_up_klogd (void ) {__wake_up_klogd (PRINTK_PENDING_WAKEUP ); } +/** +* defer_console_output - Wake kernel logging daemon and trigger +* console printing in a deferred context +* +* Use this function when new records have been added to the ringbuffer, +* this context is responsible for console printing those records, but +* the current context is not allowed to perform the console printing. +* Trigger an irq_work context to perform the console printing. This +* function also wakes the logging daemon. +* +* Context: Any context. +*/ void defer_console_output (void ) {/*
@@ -3864,12 +3890,7 @@ void printk_trigger_flush(void)int vprintk_deferred (const char *fmt,va_list args) { -int r; - - r =vprintk_emit (0 ,LOGLEVEL_SCHED ,NULL , fmt, args); -defer_console_output (); - -return r; +return vprintk_emit (0 ,LOGLEVEL_SCHED ,NULL , fmt, args); }int _printk_deferred (const char *fmt, ...)
kernel/printk/printk_safe.c +2 -7
@@ -38,13 +38,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)* Use the main logbuf even in NMI. But avoid calling console * drivers that might have their own locks. */ -if (this_cpu_read (printk_context) ||in_nmi ()) { -int len; - - len =vprintk_store (0 ,LOGLEVEL_DEFAULT ,NULL , fmt, args); -defer_console_output (); -return len; - } +if (this_cpu_read (printk_context) ||in_nmi ()) +return vprintk_deferred (fmt, args);/* No obstacles. */ return vprintk_default (fmt, args);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 132/211 printk: Rename abandon_console_lock_in_panic() to other_cpu_in_panic()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
[ Upstream commit 132a90d1527fedba2d95085c951ccf00dbbebe41 ]
Currently abandon_console_lock_in_panic() is only used to determine if the current CPU should immediately release the console lock because another CPU is in panic. However, later this function will be used by the CPU to immediately release other resources in this situation.
Rename the function to other_cpu_in_panic(), which is a better description and does not assume it is related to the console lock.
--- kernel/printk/internal.h | 2 ++ kernel/printk/printk.c | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-)
kernel/printk/internal.h +2 -0
@@ -103,3 +103,5 @@ struct printk_message {u64 seq;unsigned long dropped; }; + +bool other_cpu_in_panic (void );
kernel/printk/printk.c +8 -7
@@ -2590,11 +2590,12 @@ static int console_cpu_notify(unsigned int cpu) }/* -* Return true when this CPU should unlock console_sem without pushing all -* messages to the console. This reduces the chance that the console is -* locked when the panic CPU tries to use it. +* Return true if a panic is in progress on a remote CPU. +* +* On true, the local CPU should immediately release any printing resources +* that may be needed by the panic CPU. */ -static bool abandon_console_lock_in_panic (void ) +bool other_cpu_in_panic (void ) {if (!panic_in_progress ())return false;
@@ -2621,7 +2622,7 @@ void console_lock(void)might_sleep ();/* On panic, the console_lock must be left to the panic cpu. */ -while (abandon_console_lock_in_panic ()) +while (other_cpu_in_panic ())msleep (1000 );down_console_sem ();
@@ -2643,7 +2644,7 @@ EXPORT_SYMBOL(console_lock);int console_trylock (void ) {/* On panic, the console_lock must be left to the panic cpu. */ -if (abandon_console_lock_in_panic ()) +if (other_cpu_in_panic ())return 0 ;if (down_trylock_console_sem ())return 0 ;
@@ -2959,7 +2960,7 @@ static bool console_flush_all(bool do_cond_resched, u64 *next_seq, bool *handove any_progress = true;/* Allow panic_cpu to take over the consoles safely. */ -if (abandon_console_lock_in_panic ()) +if (other_cpu_in_panic ()) goto abandon;if (do_cond_resched)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 133/211 ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit bc056e7163ac7db945366de219745cf94f32a3e6 ]
When we calculate the end position of ext4_free_extent, this position may be exactly where ext4_lblk_t (i.e. uint) overflows. For example, if ac_g_ex.fe_logical is 4294965248 and ac_orig_goal_len is 2048, then the computed end is 0x100000000, which is 0. If ac->ac_o_ex.fe_logical is not the first case of adjusting the best extent, that is, new_bex_end > 0, the following BUG_ON will be triggered:
=========================================================
kernel BUG at fs/ext4/mballoc.c:5116!
invalid opcode: 0000 [#1] PREEMPT SMP PTI
CPU: 3 PID: 673 Comm: xfs_io Tainted: G E 6.5.0-rc1+ #279 RIP: 0010:ext4_mb_new_inode_pa+0xc5/0x430 Call Trace: <TASK> ext4_mb_use_best_found+0x203/0x2f0 ext4_mb_try_best_found+0x163/0x240 ext4_mb_regular_allocator+0x158/0x1550 ext4_mb_new_blocks+0x86a/0xe10 ext4_ext_map_blocks+0xb0c/0x13a0 ext4_map_blocks+0x2cd/0x8f0 ext4_iomap_begin+0x27b/0x400 iomap_iter+0x222/0x3d0 __iomap_dio_rw+0x243/0xcb0 iomap_dio_rw+0x16/0x80 =========================================================
A simple reproducer demonstrating the problem:
mkfs.ext4 -F /dev/sda -b 4096 100M mount /dev/sda /tmp/test fallocate -l1M /tmp/test/tmp fallocate -l10M /tmp/test/file fallocate -i -o 1M -l16777203M /tmp/test/file fsstress -d /tmp/test -l 0 -n 100000 -p 8 & sleep 10 && killall -9 fsstress rm -f /tmp/test/tmp xfs_io -c "open -ad /tmp/test/file" -c "pwrite -S 0xff 0 8192"
We simply refactor the logic for adjusting the best extent by adding a temporary ext4_free_extent ex and use extent_logical_end() to avoid overflow, which also simplifies the code.
--- fs/ext4/mballoc.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-)
fs/ext4/mballoc.c +14 -17
@@ -5177,8 +5177,11 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) pa = ac->ac_pa;if (ac->ac_b_ex.fe_len < ac->ac_orig_goal_len) { -int new_bex_start; -int new_bex_end; +struct ext4_free_extent ex = { + .fe_logical = ac->ac_g_ex.fe_logical, + .fe_len = ac->ac_orig_goal_len, + }; +loff_t orig_goal_end =extent_logical_end (sbi, &ex);/* we can't allocate as much as normalizer wants. * so, found space must get proper lstart
@@ -5197,29 +5200,23 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)* still cover original start * 3. Else, keep the best ex at start of original request. */ - new_bex_end = ac->ac_g_ex.fe_logical + -EXT4_C2B (sbi, ac->ac_orig_goal_len); - new_bex_start = new_bex_end -EXT4_C2B (sbi, ac->ac_b_ex.fe_len); -if (ac->ac_o_ex.fe_logical >= new_bex_start) - goto adjust_bex; + ex.fe_len = ac->ac_b_ex.fe_len; - new_bex_start = ac->ac_g_ex.fe_logical; - new_bex_end = - new_bex_start +EXT4_C2B (sbi, ac->ac_b_ex.fe_len); -if (ac->ac_o_ex.fe_logical < new_bex_end) + ex.fe_logical = orig_goal_end -EXT4_C2B (sbi, ex.fe_len); +if (ac->ac_o_ex.fe_logical >= ex.fe_logical) goto adjust_bex; - new_bex_start = ac->ac_o_ex.fe_logical; - new_bex_end = - new_bex_start +EXT4_C2B (sbi, ac->ac_b_ex.fe_len); + ex.fe_logical = ac->ac_g_ex.fe_logical; +if (ac->ac_o_ex.fe_logical <extent_logical_end (sbi, &ex)) + goto adjust_bex; + ex.fe_logical = ac->ac_o_ex.fe_logical; adjust_bex: - ac->ac_b_ex.fe_logical = new_bex_start; + ac->ac_b_ex.fe_logical = ex.fe_logical;BUG_ON (ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical);BUG_ON (ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len); -BUG_ON (new_bex_end > (ac->ac_g_ex.fe_logical + -EXT4_C2B (sbi, ac->ac_orig_goal_len))); +BUG_ON (extent_logical_end (sbi, &ex) > orig_goal_end); } pa->pa_lstart = ac->ac_b_ex.fe_logical;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 134/211 btrfs: introduce struct to consolidate extent buffer write context
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naohiro Aota <[email protected]>
[ Upstream commit 861093eff4f01319edfc1d1ee276a7f2bf720f1d ]
Introduce btrfs_eb_write_context to consolidate writeback_control and the exntent buffer context. This will help adding a block group context as well.
While at it, move the eb context setting before btrfs_check_meta_write_pointer(). We can set it here because we anyway need to skip pages in the same eb if that eb is rejected by btrfs_check_meta_write_pointer().
Stable-dep-of: 13bb483d32ab ("btrfs: zoned: activate metadata block group on write time")
--- fs/btrfs/extent_io.c | 14 +++++++------- fs/btrfs/extent_io.h | 5 +++++ 2 files changed, 12 insertions(+), 7 deletions(-)
fs/btrfs/extent_io.c +7 -7
@@ -1877,9 +1877,9 @@ static int submit_eb_subpage(struct page *page, struct writeback_control *wbc)* previous call. * Return <0 for fatal error. */ -static int submit_eb_page (struct page *page,struct writeback_control *wbc, -struct extent_buffer **eb_context) +static int submit_eb_page (struct page *page,struct btrfs_eb_write_context *ctx) { +struct writeback_control *wbc = ctx->wbc;struct address_space *mapping = page->mapping;struct btrfs_block_group *cache =NULL ;struct extent_buffer *eb;
@@ -1908,7 +1908,7 @@ static int submit_eb_page(struct page *page, struct writeback_control *wbc,return 0 ; } -if (eb == *eb_context) { +if (eb == ctx->eb) {spin_unlock (&mapping->private_lock);return 0 ; }
@@ -1917,6 +1917,8 @@ static int submit_eb_page(struct page *page, struct writeback_control *wbc,if (!ret)return 0 ; + ctx->eb = eb; +if (!btrfs_check_meta_write_pointer (eb->fs_info, eb, &cache)) {/* * If for_sync, this hole will be filled with
@@ -1930,8 +1932,6 @@ static int submit_eb_page(struct page *page, struct writeback_control *wbc,return ret; } - *eb_context = eb; -if (!lock_extent_buffer_for_io (eb, wbc)) {btrfs_revert_meta_write_pointer (cache, eb);if (cache)
@@ -1954,7 +1954,7 @@ static int submit_eb_page(struct page *page, struct writeback_control *wbc,int btree_write_cache_pages (struct address_space *mapping,struct writeback_control *wbc) { -struct extent_buffer *eb_context =NULL ; +struct btrfs_eb_write_context ctx = { .wbc = wbc };struct btrfs_fs_info *fs_info =BTRFS_I (mapping->host)->root->fs_info;int ret =0 ;int done =0 ;
@@ -1996,7 +1996,7 @@ int btree_write_cache_pages(struct address_space *mapping,for (i =0 ; i < nr_folios; i++) {struct folio *folio = fbatch.folios[i]; - ret =submit_eb_page (&folio->page, wbc, &eb_context); + ret =submit_eb_page (&folio->page, &ctx);if (ret ==0 )continue ;if (ret <0 ) {
fs/btrfs/extent_io.h +5 -0
@@ -94,6 +94,11 @@ struct extent_buffer {#endif }; +struct btrfs_eb_write_context { +struct writeback_control *wbc; +struct extent_buffer *eb; +}; +/* * Get the correct offset inside the page of extent buffer. *
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 135/211 btrfs: zoned: introduce block group context to btrfs_eb_write_context
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naohiro Aota <[email protected]>
[ Upstream commit 7db94301a980c9da4168ac7ce61e7bde297306ba ]
For metadata write out on the zoned mode, we call btrfs_check_meta_write_pointer() to check if an extent buffer to be written is aligned to the write pointer.
We look up a block group containing the extent buffer for every extent buffer, which takes unnecessary effort as the writing extent buffers are mostly contiguous.
Introduce "zoned_bg" to cache the block group working on. Also, while at it, rename "cache" to "block_group".
Stable-dep-of: 13bb483d32ab ("btrfs: zoned: activate metadata block group on write time")
--- fs/btrfs/extent_io.c | 15 +++++++-------- fs/btrfs/extent_io.h | 2 ++ fs/btrfs/zoned.c | 35 ++++++++++++++++++++--------------- fs/btrfs/zoned.h | 6 ++---- 4 files changed, 31 insertions(+), 27 deletions(-)
fs/btrfs/extent_io.c +7 -8
@@ -1881,7 +1881,6 @@ static int submit_eb_page(struct page *page, struct btrfs_eb_write_context *ctx) {struct writeback_control *wbc = ctx->wbc;struct address_space *mapping = page->mapping; -struct btrfs_block_group *cache =NULL ;struct extent_buffer *eb;int ret;
@@ -1919,7 +1918,7 @@ static int submit_eb_page(struct page *page, struct btrfs_eb_write_context *ctx) ctx->eb = eb; -if (!btrfs_check_meta_write_pointer (eb->fs_info, eb, &cache)) { +if (!btrfs_check_meta_write_pointer (eb->fs_info, ctx)) {/* * If for_sync, this hole will be filled with * trasnsaction commit.
@@ -1933,18 +1932,15 @@ static int submit_eb_page(struct page *page, struct btrfs_eb_write_context *ctx) }if (!lock_extent_buffer_for_io (eb, wbc)) { -btrfs_revert_meta_write_pointer (cache, eb); -if (cache) -btrfs_put_block_group (cache); +btrfs_revert_meta_write_pointer (ctx->zoned_bg, eb);free_extent_buffer (eb);return 0 ; } -if (cache) { +if (ctx->zoned_bg) {/* * Implies write in zoned mode. Mark the last eb in a block group. */ -btrfs_schedule_zone_finish_bg (cache, eb); -btrfs_put_block_group (cache); +btrfs_schedule_zone_finish_bg (ctx->zoned_bg, eb); }write_one_eb (eb, wbc);free_extent_buffer (eb);
@@ -2057,6 +2053,9 @@ int btree_write_cache_pages(struct address_space *mapping, ret =0 ;if (!ret &&BTRFS_FS_ERROR (fs_info)) ret = -EROFS ; + +if (ctx.zoned_bg) +btrfs_put_block_group (ctx.zoned_bg);btrfs_zoned_meta_io_unlock (fs_info);return ret; }
fs/btrfs/extent_io.h +2 -0
@@ -97,6 +97,8 @@ struct extent_buffer {struct btrfs_eb_write_context {struct writeback_control *wbc;struct extent_buffer *eb; +/* Block group @eb resides in. Only used for zoned mode. */ +struct btrfs_block_group *zoned_bg; };/*
fs/btrfs/zoned.c +20 -15
@@ -1759,30 +1759,35 @@ void btrfs_finish_ordered_zoned(struct btrfs_ordered_extent *ordered) }bool btrfs_check_meta_write_pointer (struct btrfs_fs_info *fs_info, -struct extent_buffer *eb, -struct btrfs_block_group **cache_ret) +struct btrfs_eb_write_context *ctx) { -struct btrfs_block_group *cache; -bool ret = true; +const struct extent_buffer *eb = ctx->eb; +struct btrfs_block_group *block_group = ctx->zoned_bg;if (!btrfs_is_zoned (fs_info))return true; - cache =btrfs_lookup_block_group (fs_info, eb->start); -if (!cache) -return true; +if (block_group) { +if (block_group->start > eb->start || + block_group->start + block_group->length <= eb->start) { +btrfs_put_block_group (block_group); + block_group =NULL ; + ctx->zoned_bg =NULL ; + } + } -if (cache->meta_write_pointer != eb->start) { -btrfs_put_block_group (cache); - cache =NULL ; - ret = false; - }else { - cache->meta_write_pointer = eb->start + eb->len; +if (!block_group) { + block_group =btrfs_lookup_block_group (fs_info, eb->start); +if (!block_group) +return true; + ctx->zoned_bg = block_group; } - *cache_ret = cache; +if (block_group->meta_write_pointer != eb->start) +return false; + block_group->meta_write_pointer = eb->start + eb->len; -return ret; +return true; } void btrfs_revert_meta_write_pointer(struct btrfs_block_group *cache,
fs/btrfs/zoned.h +2 -4
@@ -59,8 +59,7 @@ void btrfs_redirty_list_add(struct btrfs_transaction *trans,bool btrfs_use_zone_append (struct btrfs_bio *bbio);void btrfs_record_physical_zoned (struct btrfs_bio *bbio);bool btrfs_check_meta_write_pointer (struct btrfs_fs_info *fs_info, -struct extent_buffer *eb, -struct btrfs_block_group **cache_ret); +struct btrfs_eb_write_context *ctx);void btrfs_revert_meta_write_pointer (struct btrfs_block_group *cache,struct extent_buffer *eb);int btrfs_zoned_issue_zeroout (struct btrfs_device *device,u64 physical,u64 length);
@@ -190,8 +189,7 @@ static inline void btrfs_record_physical_zoned(struct btrfs_bio *bbio) }static inline bool btrfs_check_meta_write_pointer (struct btrfs_fs_info *fs_info, -struct extent_buffer *eb, -struct btrfs_block_group **cache_ret) +struct btrfs_eb_write_context *ctx) {return true; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 136/211 btrfs: zoned: return int from btrfs_check_meta_write_pointer
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naohiro Aota <[email protected]>
[ Upstream commit 2ad8c0510a965113404cfe670b41ddc34fb66100 ]
Now that we have writeback_control passed to btrfs_check_meta_write_pointer(), we can move the wbc condition in submit_eb_page() to btrfs_check_meta_write_pointer() and return int.
Stable-dep-of: 13bb483d32ab ("btrfs: zoned: activate metadata block group on write time")
--- fs/btrfs/extent_io.c | 11 +++-------- fs/btrfs/zoned.c | 30 ++++++++++++++++++++++-------- fs/btrfs/zoned.h | 10 +++++----- 3 files changed, 30 insertions(+), 21 deletions(-)
fs/btrfs/extent_io.c +3 -8
@@ -1918,14 +1918,9 @@ static int submit_eb_page(struct page *page, struct btrfs_eb_write_context *ctx) ctx->eb = eb; -if (!btrfs_check_meta_write_pointer (eb->fs_info, ctx)) { -/* -* If for_sync, this hole will be filled with -* trasnsaction commit. -*/ -if (wbc->sync_mode ==WB_SYNC_ALL && !wbc->for_sync) - ret = -EAGAIN ; -else + ret =btrfs_check_meta_write_pointer (eb->fs_info, ctx); +if (ret) { +if (ret == -EBUSY ) ret =0 ;free_extent_buffer (eb);return ret;
fs/btrfs/zoned.c +22 -8
@@ -1758,14 +1758,23 @@ void btrfs_finish_ordered_zoned(struct btrfs_ordered_extent *ordered) } } -bool btrfs_check_meta_write_pointer (struct btrfs_fs_info *fs_info, -struct btrfs_eb_write_context *ctx) +/* +* Check if @ctx->eb is aligned to the write pointer. +* +* Return: +* 0: @ctx->eb is at the write pointer. You can write it. +* -EAGAIN: There is a hole. The caller should handle the case. +* -EBUSY: There is a hole, but the caller can just bail out. +*/ +int btrfs_check_meta_write_pointer (struct btrfs_fs_info *fs_info, +struct btrfs_eb_write_context *ctx) { +const struct writeback_control *wbc = ctx->wbc;const struct extent_buffer *eb = ctx->eb;struct btrfs_block_group *block_group = ctx->zoned_bg;if (!btrfs_is_zoned (fs_info)) -return true; +return 0 ;if (block_group) { if (block_group->start > eb->start ||
@@ -1779,15 +1788,20 @@ bool btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info,if (!block_group) { block_group =btrfs_lookup_block_group (fs_info, eb->start);if (!block_group) -return true; +return 0 ; ctx->zoned_bg = block_group; } -if (block_group->meta_write_pointer != eb->start) -return false; - block_group->meta_write_pointer = eb->start + eb->len; +if (block_group->meta_write_pointer == eb->start) { + block_group->meta_write_pointer = eb->start + eb->len; -return true; +return 0 ; + } + +/* If for_sync, this hole will be filled with trasnsaction commit. */ +if (wbc->sync_mode ==WB_SYNC_ALL && !wbc->for_sync) +return -EAGAIN ; +return -EBUSY ; } void btrfs_revert_meta_write_pointer(struct btrfs_block_group *cache,
fs/btrfs/zoned.h +5 -5
@@ -58,8 +58,8 @@ void btrfs_redirty_list_add(struct btrfs_transaction *trans, struct extent_buffer *eb);bool btrfs_use_zone_append (struct btrfs_bio *bbio);void btrfs_record_physical_zoned (struct btrfs_bio *bbio); -bool btrfs_check_meta_write_pointer (struct btrfs_fs_info *fs_info, -struct btrfs_eb_write_context *ctx); +int btrfs_check_meta_write_pointer (struct btrfs_fs_info *fs_info, +struct btrfs_eb_write_context *ctx);void btrfs_revert_meta_write_pointer (struct btrfs_block_group *cache,struct extent_buffer *eb);int btrfs_zoned_issue_zeroout (struct btrfs_device *device,u64 physical,u64 length);
@@ -188,10 +188,10 @@ static inline void btrfs_record_physical_zoned(struct btrfs_bio *bbio) { } -static inline bool btrfs_check_meta_write_pointer (struct btrfs_fs_info *fs_info, -struct btrfs_eb_write_context *ctx) +static inline int btrfs_check_meta_write_pointer (struct btrfs_fs_info *fs_info, +struct btrfs_eb_write_context *ctx) { -return true; +return 0 ; } static inline void btrfs_revert_meta_write_pointer(
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 137/211 btrfs: zoned: defer advancing meta write pointer
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naohiro Aota <[email protected]>
[ Upstream commit 0356ad41e0ddb8cf0ea4d68820c92598413e445b ]
We currently advance the meta_write_pointer in btrfs_check_meta_write_pointer(). That makes it necessary to revert it when locking the buffer failed. Instead, we can advance it just before sending the buffer.
Also, this is necessary for the following commit. In the commit, it needs to release the zoned_meta_io_lock to allow IOs to come in and wait for them to fill the currently active block group. If we advance the meta_write_pointer before locking the extent buffer, the following extent buffer can pass the meta_write_pointer check, resulting in an unaligned write failure.
Advancing the pointer is still thread-safe as the extent buffer is locked.
Stable-dep-of: 13bb483d32ab ("btrfs: zoned: activate metadata block group on write time")
--- fs/btrfs/extent_io.c | 7 +++---- fs/btrfs/zoned.c | 15 +-------------- fs/btrfs/zoned.h | 8 -------- 3 files changed, 4 insertions(+), 26 deletions(-)
fs/btrfs/extent_io.c +3 -4
@@ -1927,15 +1927,14 @@ static int submit_eb_page(struct page *page, struct btrfs_eb_write_context *ctx) }if (!lock_extent_buffer_for_io (eb, wbc)) { -btrfs_revert_meta_write_pointer (ctx->zoned_bg, eb);free_extent_buffer (eb);return 0 ; } +/* Implies write in zoned mode. */ if (ctx->zoned_bg) { -/* -* Implies write in zoned mode. Mark the last eb in a block group. -*/ +/* Mark the last eb in the block group. */ btrfs_schedule_zone_finish_bg (ctx->zoned_bg, eb); + ctx->zoned_bg->meta_write_pointer += eb->len; }write_one_eb (eb, wbc);free_extent_buffer (eb);
fs/btrfs/zoned.c +1 -14
@@ -1792,11 +1792,8 @@ int btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info, ctx->zoned_bg = block_group; } -if (block_group->meta_write_pointer == eb->start) { - block_group->meta_write_pointer = eb->start + eb->len; - +if (block_group->meta_write_pointer == eb->start)return 0 ; - }/* If for_sync, this hole will be filled with trasnsaction commit. */ if (wbc->sync_mode ==WB_SYNC_ALL && !wbc->for_sync)
@@ -1804,16 +1801,6 @@ int btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info,return -EBUSY ; } -void btrfs_revert_meta_write_pointer (struct btrfs_block_group *cache, -struct extent_buffer *eb) -{ -if (!btrfs_is_zoned (eb->fs_info) || !cache) -return ; - -ASSERT (cache->meta_write_pointer == eb->start + eb->len); - cache->meta_write_pointer = eb->start; -} -int btrfs_zoned_issue_zeroout (struct btrfs_device *device,u64 physical,u64 length) {if (!btrfs_dev_is_sequential (device, physical))
fs/btrfs/zoned.h +0 -8
@@ -60,8 +60,6 @@ bool btrfs_use_zone_append(struct btrfs_bio *bbio);void btrfs_record_physical_zoned (struct btrfs_bio *bbio);int btrfs_check_meta_write_pointer (struct btrfs_fs_info *fs_info,struct btrfs_eb_write_context *ctx); -void btrfs_revert_meta_write_pointer (struct btrfs_block_group *cache, -struct extent_buffer *eb);int btrfs_zoned_issue_zeroout (struct btrfs_device *device,u64 physical,u64 length);int btrfs_sync_zone_write_pointer (struct btrfs_device *tgt_dev,u64 logical,u64 physical_start,u64 physical_pos);
@@ -194,12 +192,6 @@ static inline int btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info,return 0 ; } -static inline void btrfs_revert_meta_write_pointer ( -struct btrfs_block_group *cache, -struct extent_buffer *eb) -{ -} -static inline int btrfs_zoned_issue_zeroout (struct btrfs_device *device,u64 physical,u64 length) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 138/211 btrfs: zoned: activate metadata block group on write time
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naohiro Aota <[email protected]>
[ Upstream commit 13bb483d32abb6f8ebd40141d87eb68f11cc2dd2 ]
In the current implementation, block groups are activated at reservation time to ensure that all reserved bytes can be written to an active metadata block group. However, this approach has proven to be less efficient, as it activates block groups more frequently than necessary, putting pressure on the active zone resource and leading to potential issues such as early ENOSPC or hung_task.
Another drawback of the current method is that it hampers metadata over-commit, and necessitates additional flush operations and block group allocations, resulting in decreased overall performance.
To address these issues, this commit introduces a write-time activation of metadata and system block group. This involves reserving at least one active block group specifically for a metadata and system block group.
Since metadata write-out is always allocated sequentially, when we need to write to a non-active block group, we can wait for the ongoing IOs to complete, activate a new block group, and then proceed with writing to the new block group.
--- fs/btrfs/block-group.c | 11 ++++++ fs/btrfs/fs.h | 3 ++ fs/btrfs/zoned.c | 81 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 93 insertions(+), 2 deletions(-)
fs/btrfs/block-group.c +11 -0
@@ -4273,6 +4273,17 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)struct btrfs_caching_control *caching_ctl;struct rb_node *n; +if (btrfs_is_zoned (info)) { +if (info->active_meta_bg) { +btrfs_put_block_group (info->active_meta_bg); + info->active_meta_bg =NULL ; + } +if (info->active_system_bg) { +btrfs_put_block_group (info->active_system_bg); + info->active_system_bg =NULL ; + } + } +write_lock (&info->block_group_cache_lock);while (!list_empty (&info->caching_block_groups)) { caching_ctl = list_entry(info->caching_block_groups.next,
fs/btrfs/fs.h +3 -0
@@ -766,6 +766,9 @@ struct btrfs_fs_info {u64 data_reloc_bg;struct mutex zoned_data_reloc_io_lock; +struct btrfs_block_group *active_meta_bg; +struct btrfs_block_group *active_system_bg; +u64 nr_global_roots;spinlock_t zone_active_bgs_lock;
fs/btrfs/zoned.c +79 -2
99 lines not on this page · raw message
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 139/211 mtd: spi-nor: spansion: use CLPEF as an alternative to CLSR
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takahiro Kuwano <[email protected]>
[ Upstream commit d534fd9787d5925d9637752410e3ea92ca7f4cfa ]
Infineon S28Hx (SEMPER Octal) and S25FS256T (SEMPER Nano) support Clear Program and Erase Failure Flags (CLPEF, 82h) instead of CLSR(30h). Introduce a new mfr_flag together with the infrastructure to allow manufacturer private data in the core. With this we remove the need to have if checks in the code at runtime and instead set the correct opcodes at probe time. S25Hx (SEMPER QSPI) supports CLSR but it may be disabled by CFR3x[2] while CLPEF is always available. Therefore, the mfr_flag is also applied to S25Hx for safety.
Stable-dep-of: 1e611e104b9a ("mtd: spi-nor: spansion: preserve CFR2V[7] when writing MEMLAT")
--- drivers/mtd/spi-nor/atmel.c | 8 +++- drivers/mtd/spi-nor/core.c | 23 +++++++---- drivers/mtd/spi-nor/core.h | 4 +- drivers/mtd/spi-nor/issi.c | 4 +- drivers/mtd/spi-nor/macronix.c | 4 +- drivers/mtd/spi-nor/micron-st.c | 4 +- drivers/mtd/spi-nor/spansion.c | 72 ++++++++++++++++++++++++++------- drivers/mtd/spi-nor/sst.c | 8 +++- drivers/mtd/spi-nor/winbond.c | 4 +- drivers/mtd/spi-nor/xilinx.c | 4 +- 10 files changed, 103 insertions(+), 32 deletions(-)
drivers/mtd/spi-nor/atmel.c +6 -2
@@ -48,9 +48,11 @@ static const struct spi_nor_locking_ops at25fs_nor_locking_ops = { .is_locked = at25fs_nor_is_locked, }; -static void at25fs_nor_late_init (struct spi_nor *nor) +static int at25fs_nor_late_init (struct spi_nor *nor) { nor->params->locking_ops = &at25fs_nor_locking_ops; + +return 0 ; }static const struct spi_nor_fixups at25fs_nor_fixups = {
@@ -149,9 +151,11 @@ static const struct spi_nor_locking_ops atmel_nor_global_protection_ops = { .is_locked = atmel_nor_is_global_protected, }; -static void atmel_nor_global_protection_late_init (struct spi_nor *nor) +static int atmel_nor_global_protection_late_init (struct spi_nor *nor) { nor->params->locking_ops = &atmel_nor_global_protection_ops; + +return 0 ; }static const struct spi_nor_fixups atmel_nor_global_protection_fixups = {
drivers/mtd/spi-nor/core.c +15 -8
@@ -2898,16 +2898,23 @@ static void spi_nor_init_fixup_flags(struct spi_nor *nor)* SFDP standard, or where SFDP tables are not defined at all. * Will replace the spi_nor_manufacturer_init_params() method. */ -static void spi_nor_late_init_params (struct spi_nor *nor) +static int spi_nor_late_init_params (struct spi_nor *nor) {struct spi_nor_flash_parameter *params = nor->params; +int ret;if (nor->manufacturer && nor->manufacturer->fixups && - nor->manufacturer->fixups->late_init) - nor->manufacturer->fixups->late_init (nor); + nor->manufacturer->fixups->late_init) { + ret = nor->manufacturer->fixups->late_init (nor); +if (ret) +return ret; + } -if (nor->info->fixups && nor->info->fixups->late_init) - nor->info->fixups->late_init (nor); +if (nor->info->fixups && nor->info->fixups->late_init) { + ret = nor->info->fixups->late_init (nor); +if (ret) +return ret; + }/* Default method kept for backward compatibility. */ if (!params->set_4byte_addr_mode)
@@ -2925,6 +2932,8 @@ static void spi_nor_late_init_params(struct spi_nor *nor)if (nor->info->n_banks >1 ) params->bank_size =div64_u64 (params->size, nor->info->n_banks); + +return 0 ; }/**
@@ -3083,9 +3092,7 @@ static int spi_nor_init_params(struct spi_nor *nor)spi_nor_init_params_deprecated (nor); } -spi_nor_late_init_params (nor); - -return 0 ; +return spi_nor_late_init_params (nor); }/** spi_nor_octal_dtr_enable() - enable Octal DTR I/O if needed
drivers/mtd/spi-nor/core.h +3 -1
@@ -377,6 +377,7 @@ struct spi_nor_otp {* than reading the status register to indicate they * are ready for a new command * @locking_ops: SPI NOR locking methods. +* @priv: flash's private data. */ struct spi_nor_flash_parameter {u64 bank_size;
@@ -405,6 +406,7 @@ struct spi_nor_flash_parameter {int (*ready)(struct spi_nor *nor);const struct spi_nor_locking_ops *locking_ops; +void *priv; };/**
@@ -431,7 +433,7 @@ struct spi_nor_fixups {const struct sfdp_parameter_header *bfpt_header, const struct sfdp_bfpt *bfpt);int (*post_sfdp)(struct spi_nor *nor); -void (*late_init)(struct spi_nor *nor); +int (*late_init)(struct spi_nor *nor); };/**
drivers/mtd/spi-nor/issi.c +3 -1
@@ -29,7 +29,7 @@ static const struct spi_nor_fixups is25lp256_fixups = { .post_bfpt = is25lp256_post_bfpt_fixups, }; -static void pm25lv_nor_late_init (struct spi_nor *nor) +static int pm25lv_nor_late_init (struct spi_nor *nor) {struct spi_nor_erase_map *map = &nor->params->erase_map;int i;
@@ -38,6 +38,8 @@ static void pm25lv_nor_late_init(struct spi_nor *nor)for (i =0 ; i <SNOR_ERASE_TYPE_MAX ; i++)if (map->erase_type[i].size ==4096 ) map->erase_type[i].opcode =SPINOR_OP_BE_4K_PMC ; + +return 0 ; }static const struct spi_nor_fixups pm25lv_nor_fixups = {
drivers/mtd/spi-nor/macronix.c +3 -1
@@ -110,10 +110,12 @@ static void macronix_nor_default_init(struct spi_nor *nor) nor->params->quad_enable = spi_nor_sr1_bit6_quad_enable; } -static void macronix_nor_late_init (struct spi_nor *nor) +static int macronix_nor_late_init (struct spi_nor *nor) {if (!nor->params->set_4byte_addr_mode) nor->params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode_en4b_ex4b; + +return 0 ; }static const struct spi_nor_fixups macronix_nor_fixups = {
drivers/mtd/spi-nor/micron-st.c +3 -1
@@ -429,7 +429,7 @@ static void micron_st_nor_default_init(struct spi_nor *nor) nor->params->quad_enable =NULL ; } -static void micron_st_nor_late_init (struct spi_nor *nor) +static int micron_st_nor_late_init (struct spi_nor *nor) {struct spi_nor_flash_parameter *params = nor->params;
@@ -438,6 +438,8 @@ static void micron_st_nor_late_init(struct spi_nor *nor)if (!params->set_4byte_addr_mode) params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode_wren_en4b_ex4b; + +return 0 ; }static const struct spi_nor_fixups micron_st_nor_fixups = {
drivers/mtd/spi-nor/spansion.c +58 -14
190 lines not on this page · raw message
drivers/mtd/spi-nor/sst.c +6 -2
@@ -49,9 +49,11 @@ static const struct spi_nor_locking_ops sst26vf_nor_locking_ops = { .is_locked = sst26vf_nor_is_locked, }; -static void sst26vf_nor_late_init (struct spi_nor *nor) +static int sst26vf_nor_late_init (struct spi_nor *nor) { nor->params->locking_ops = &sst26vf_nor_locking_ops; + +return 0 ; }static const struct spi_nor_fixups sst26vf_nor_fixups = {
@@ -203,10 +205,12 @@ static int sst_nor_write(struct mtd_info *mtd, loff_t to, size_t len,return ret; } -static void sst_nor_late_init (struct spi_nor *nor) +static int sst_nor_late_init (struct spi_nor *nor) {if (nor->info->mfr_flags &SST_WRITE ) nor->mtd._write = sst_nor_write; + +return 0 ; }static const struct spi_nor_fixups sst_nor_fixups = {
drivers/mtd/spi-nor/winbond.c +3 -1
@@ -217,7 +217,7 @@ static const struct spi_nor_otp_ops winbond_nor_otp_ops = { .is_locked = spi_nor_otp_is_locked_sr2, }; -static void winbond_nor_late_init (struct spi_nor *nor) +static int winbond_nor_late_init (struct spi_nor *nor) {struct spi_nor_flash_parameter *params = nor->params;
@@ -233,6 +233,8 @@ static void winbond_nor_late_init(struct spi_nor *nor)* from BFPT, if any. */ params->set_4byte_addr_mode = winbond_nor_set_4byte_addr_mode; + +return 0 ; }static const struct spi_nor_fixups winbond_nor_fixups = {
drivers/mtd/spi-nor/xilinx.c +3 -1
@@ -155,10 +155,12 @@ static int xilinx_nor_setup(struct spi_nor *nor,return 0 ; } -static void xilinx_nor_late_init (struct spi_nor *nor) +static int xilinx_nor_late_init (struct spi_nor *nor) { nor->params->setup = xilinx_nor_setup; nor->params->ready = xilinx_nor_sr_ready; + +return 0 ; }static const struct spi_nor_fixups xilinx_nor_fixups = {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 140/211 mtd: spi-nor: spansion: preserve CFR2V[7] when writing MEMLAT
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takahiro Kuwano <[email protected]>
[ Upstream commit 1e611e104b9acb6310b8c684d5acee0e11ca7bd1 ]
CFR2V[7] is assigned to Flash's address mode (3- or 4-ybte) and must not be changed when writing MEMLAT (CFR2V[3:0]). CFR2V shall be used in a read, update, write back fashion.
--- drivers/mtd/spi-nor/spansion.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/spansion.c +13 -1
@@ -4,6 +4,7 @@* Copyright (C) 2014, Freescale Semiconductor, Inc. */ +#include <linux/bitfield.h> #include <linux/device.h> #include <linux/mtd/spi-nor.h>
@@ -28,6 +29,7 @@#define SPINOR_REG_CYPRESS_CFR2 0x3#define SPINOR_REG_CYPRESS_CFR2V \ (SPINOR_REG_CYPRESS_VREG + SPINOR_REG_CYPRESS_CFR2) +#define SPINOR_REG_CYPRESS_CFR2_MEMLAT_MASK GENMASK(3, 0)#define SPINOR_REG_CYPRESS_CFR2_MEMLAT_11_24 0xb#define SPINOR_REG_CYPRESS_CFR2_ADRBYT BIT(7)#define SPINOR_REG_CYPRESS_CFR3 0x4
@@ -161,8 +163,18 @@ static int cypress_nor_octal_dtr_en(struct spi_nor *nor)int ret;u8 addr_mode_nbytes = nor->params->addr_mode_nbytes; + op = (struct spi_mem_op ) +CYPRESS_NOR_RD_ANY_REG_OP (addr_mode_nbytes, +SPINOR_REG_CYPRESS_CFR2V ,0 , buf); + + ret =spi_nor_read_any_reg (nor, &op, nor->reg_proto); +if (ret) +return ret; +/* Use 24 dummy cycles for memory array reads. */ - *buf =SPINOR_REG_CYPRESS_CFR2_MEMLAT_11_24 ; + *buf &= ~SPINOR_REG_CYPRESS_CFR2_MEMLAT_MASK ; + *buf |=FIELD_PREP (SPINOR_REG_CYPRESS_CFR2_MEMLAT_MASK , +SPINOR_REG_CYPRESS_CFR2_MEMLAT_11_24 ); op = (struct spi_mem_op )CYPRESS_NOR_WR_ANY_REG_OP (addr_mode_nbytes,SPINOR_REG_CYPRESS_CFR2V ,1 , buf);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 141/211 btrfs: add a helper to read the superblock metadata_uuid
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anand Jain <[email protected]>
[ Upstream commit 4844c3664a72d36cc79752cb651c78860b14c240 ]
In some cases, we need to read the FSID from the superblock when the metadata_uuid is not set, and otherwise, read the metadata_uuid. So, add a helper.
Stable-dep-of: 6bfe3959b0e7 ("btrfs: compare the correct fsid/metadata_uuid in btrfs_validate_super")
--- fs/btrfs/volumes.c | 8 ++++++++ fs/btrfs/volumes.h | 1 + 2 files changed, 9 insertions(+)
fs/btrfs/volumes.c +8 -0
@@ -681,6 +681,14 @@ static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices,return -EINVAL ; } +u8 *btrfs_sb_fsid_ptr (struct btrfs_super_block *sb) +{ +bool has_metadata_uuid = (btrfs_super_incompat_flags (sb) & +BTRFS_FEATURE_INCOMPAT_METADATA_UUID ); + +return has_metadata_uuid ? sb->metadata_uuid : sb->fsid; +} +/* * Handle scanned device having its CHANGING_FSID_V2 flag set and the fs_devices * being created with a disk that has already completed its fsid change. Such
fs/btrfs/volumes.h +1 -0
@@ -749,5 +749,6 @@ int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info);bool btrfs_repair_one_zone (struct btrfs_fs_info *fs_info,u64 logical);bool btrfs_pinned_by_swapfile (struct btrfs_fs_info *fs_info,void *ptr); +u8 *btrfs_sb_fsid_ptr (struct btrfs_super_block *sb);#endif
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 142/211 btrfs: compare the correct fsid/metadata_uuid in btrfs_validate_super
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anand Jain <[email protected]>
[ Upstream commit 6bfe3959b0e7a526f5c64747801a8613f002f05a ]
The function btrfs_validate_super() should verify the metadata_uuid in the provided superblock argument. Because, all its callers expect it to do that.
Such as in the following stacks:
write_all_supers()
sb = fs_info->super_for_commit;
btrfs_validate_write_super(.., sb)
btrfs_validate_super(.., sb, ..) scrub_one_super()
btrfs_validate_super(.., sb, ..)
And
check_dev_super()
btrfs_validate_super(.., sb, ..)
However, it currently verifies the fs_info::super_copy::metadata_uuid instead. Fix this using the correct metadata_uuid in the superblock argument.
--- fs/btrfs/disk-io.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
fs/btrfs/disk-io.c +3 -5
@@ -2391,13 +2391,11 @@ int btrfs_validate_super(struct btrfs_fs_info *fs_info, ret = -EINVAL ; } -if (btrfs_fs_incompat (fs_info,METADATA_UUID ) && -memcmp (fs_info->fs_devices->metadata_uuid, - fs_info->super_copy->metadata_uuid,BTRFS_FSID_SIZE )) { +if (memcmp (fs_info->fs_devices->metadata_uuid,btrfs_sb_fsid_ptr (sb), +BTRFS_FSID_SIZE ) !=0 ) {btrfs_err (fs_info,"superblock metadata_uuid doesn't match metadata uuid of fs_devices: %pU != %pU" , - fs_info->super_copy->metadata_uuid, - fs_info->fs_devices->metadata_uuid); +btrfs_sb_fsid_ptr (sb), fs_info->fs_devices->metadata_uuid); ret = -EINVAL ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 143/211 nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Varun Prakash <[email protected]>
[ Upstream commit 1f0bbf28940cf5edad90ab57b62aa8197bf5e836 ]
iov_len is the valid data length, so pass iov_len instead of sg->length to bvec_set_page().
--- drivers/nvme/target/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/tcp.c +1 -1
@@ -348,7 +348,7 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd)while (length) {u32 iov_len =min_t (u32, length, sg->length - sg_offset); -bvec_set_page (iov,sg_page (sg), sg->length, +bvec_set_page (iov,sg_page (sg), iov_len, sg->offset + sg_offset); length -= iov_len;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 144/211 drm: gm12u320: Fix the timeout usage for usb_bulk_msg()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit 7583028d359db3cd0072badcc576b4f9455fd27a ]
The timeout arg of usb_bulk_msg() is ms already, which has been converted to jiffies by msecs_to_jiffies() in usb_start_wait_urb(). So fix the usage by removing the redundant msecs_to_jiffies() in the macros.
And as Hans suggested, also remove msecs_to_jiffies() for the IDLE_TIMEOUT macro to make it consistent here and so change IDLE_TIMEOUT to msecs_to_jiffies(IDLE_TIMEOUT) where it is used.
--- drivers/gpu/drm/tiny/gm12u320.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/tiny/gm12u320.c +5 -5
@@ -70,10 +70,10 @@ MODULE_PARM_DESC(eco_mode, "Turn on Eco mode (less bright, more silent)");#define READ_STATUS_SIZE 13#define MISC_VALUE_SIZE 4 -#define CMD_TIMEOUT msecs_to_jiffies(200) -#define DATA_TIMEOUT msecs_to_jiffies(1000) -#define IDLE_TIMEOUT msecs_to_jiffies(2000) -#define FIRST_FRAME_TIMEOUT msecs_to_jiffies(2000) +#define CMD_TIMEOUT 200 +#define DATA_TIMEOUT 1000 +#define IDLE_TIMEOUT 2000 +#define FIRST_FRAME_TIMEOUT 2000#define MISC_REQ_GET_SET_ECO_A 0xff#define MISC_REQ_GET_SET_ECO_B 0x35
@@ -389,7 +389,7 @@ static void gm12u320_fb_update_work(struct work_struct *work)* switches back to showing its logo. */ queue_delayed_work (system_long_wq, &gm12u320->fb_update.work, -IDLE_TIMEOUT ); +msecs_to_jiffies (IDLE_TIMEOUT ));return ; err:
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 145/211 scsi: qla2xxx: Fix NULL vs IS_ERR() bug for debugfs_create_dir()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit d0b0822e32dbae80bbcb3cc86f34d28539d913df ]
Since both debugfs_create_dir() and debugfs_create_file() return ERR_PTR and never NULL, use IS_ERR() instead of checking for NULL.
--- drivers/scsi/qla2xxx/qla_dfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_dfs.c +3 -3
@@ -116,7 +116,7 @@ qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp)sprintf (wwn,"pn-%016llx" ,wwn_to_u64 (fp->port_name)); fp->dfs_rport_dir =debugfs_create_dir (wwn, vha->dfs_rport_root); -if (!fp->dfs_rport_dir) +if (IS_ERR (fp->dfs_rport_dir))return ;if (NVME_TARGET (vha->hw, fp)) debugfs_create_file("dev_loss_tmo", 0600, fp->dfs_rport_dir,
@@ -708,14 +708,14 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha)if (IS_QLA27XX (ha) ||IS_QLA83XX (ha) ||IS_QLA28XX (ha)) { ha->tgt.dfs_naqp =debugfs_create_file ("naqp" ,0400 , ha->dfs_dir, vha, &dfs_naqp_ops); -if (!ha->tgt.dfs_naqp) { +if (IS_ERR (ha->tgt.dfs_naqp)) {ql_log (ql_log_warn, vha,0xd011 ,"Unable to create debugFS naqp node.\n" ); goto out; } } vha->dfs_rport_root =debugfs_create_dir ("rports" , ha->dfs_dir); -if (!vha->dfs_rport_root) { +if (IS_ERR (vha->dfs_rport_root)) {ql_log (ql_log_warn, vha,0xd012 ,"Unable to create debugFS rports node.\n" ); goto out;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 146/211 md: dont dereference mddev after export_rdev()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 7deac114be5fb25a4e865212ed0feaf5f85f2a28 ]
Except for initial reference, mddev->kobject is referenced by rdev->kobject, and if the last rdev is freed, there is no guarantee that mddev is still valid. Hence mddev should not be used anymore after export_rdev().
This problem can be triggered by following test for mdadm at very low rate:
New file: mdadm/tests/23rdev-lifetime
devname=${dev0##*/}
devt=cat /sys/block/$devname/dev
pid=""
runtime=2
clean_up_test() {
pill -9 $pid
echo clear > /sys/block/md0/md/array_state
}
trap 'clean_up_test' EXIT
add_by_sysfs() {
while true; do
echo $devt > /sys/block/md0/md/new_dev
done
}
remove_by_sysfs(){
while true; do
echo remove > /sys/block/md0/md/dev-${devname}/state
done
}
echo md0 > /sys/module/md_mod/parameters/new_array || die "create md0 failed"
add_by_sysfs &
pid="$pid $!"
remove_by_sysfs &
pid="$pid $!"
sleep $runtime
exit 0
Test cmd:
./test --save-logs --logdir=/tmp/ --keep-going --dev=loop --tests=23rdev-lifetime
Test result:
general protection fault, probably for non-canonical address 0x6b6b6b6b6b6b6bcb: 0000 [#4] PREEMPT SMP CPU: 0 PID: 1292 Comm: test Tainted: G D W 6.5.0-rc2-00121-g01e55c376936 #562 RIP: 0010:md_wakeup_thread+0x9e/0x320 [md_mod] Call Trace: <TASK> mddev_unlock+0x1b6/0x310 [md_mod] rdev_attr_store+0xec/0x190 [md_mod] sysfs_kf_write+0x52/0x70 kernfs_fop_write_iter+0x19a/0x2a0 vfs_write+0x3b5/0x770 ksys_write+0x74/0x150 __x64_sys_write+0x22/0x30 do_syscall_64+0x40/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fix this problem by don't dereference mddev after export_rdev().
--- drivers/md/md.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/md.c +3 -3
@@ -798,14 +798,14 @@ void mddev_unlock(struct mddev *mddev) }else mutex_unlock (&mddev->reconfig_mutex); +md_wakeup_thread (mddev->thread); +wake_up (&mddev->sb_wait); +list_for_each_entry_safe (rdev, tmp, &delete, same_set) {list_del_init (&rdev->same_set);kobject_del (&rdev->kobj);export_rdev (rdev, mddev); } - -md_wakeup_thread (mddev->thread); -wake_up (&mddev->sb_wait); }EXPORT_SYMBOL_GPL (mddev_unlock);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 147/211 md: fix warning for holder mismatch from export_rdev()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 99892147f028d711f9d40fefad4f33632593864c ]
Commit a1d767191096 ("md: use mddev->external to select holder in export_rdev()") fix the problem that 'claim_rdev' is used for blkdev_get_by_dev() while 'rdev' is used for blkdev_put().
However, if mddev->external is changed from 0 to 1, then 'rdev' is used for blkdev_get_by_dev() while 'claim_rdev' is used for blkdev_put(). And this problem can be reporduced reliably by following:
New file: mdadm/tests/23rdev-lifetime
devname=${dev0##*/}
devt=cat /sys/block/$devname/dev
pid=""
runtime=2
clean_up_test() {
pill -9 $pid
echo clear > /sys/block/md0/md/array_state
}
trap 'clean_up_test' EXIT
add_by_sysfs() {
while true; do
echo $devt > /sys/block/md0/md/new_dev
done
}
remove_by_sysfs(){
while true; do
echo remove > /sys/block/md0/md/dev-${devname}/state
done
}
echo md0 > /sys/module/md_mod/parameters/new_array || die "create md0 failed"
add_by_sysfs &
pid="$pid $!"
remove_by_sysfs &
pid="$pid $!"
sleep $runtime
exit 0
Test cmd:
./test --save-logs --logdir=/tmp/ --keep-going --dev=loop --tests=23rdev-lifetime
Test result:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 960 at block/bdev.c:618 blkdev_put+0x27c/0x330 Modules linked in: multipath md_mod loop CPU: 0 PID: 960 Comm: test Not tainted 6.5.0-rc2-00121-g01e55c376936-dirty #50 RIP: 0010:blkdev_put+0x27c/0x330 Call Trace: <TASK> export_rdev.isra.23+0x50/0xa0 [md_mod] mddev_unlock+0x19d/0x300 [md_mod] rdev_attr_store+0xec/0x190 [md_mod] sysfs_kf_write+0x52/0x70 kernfs_fop_write_iter+0x19a/0x2a0 vfs_write+0x3b5/0x770 ksys_write+0x74/0x150 __x64_sys_write+0x22/0x30 do_syscall_64+0x40/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fix the problem by recording if 'rdev' is used as holder.
--- drivers/md/md.c | 15 ++++++++++++--- drivers/md/md.h | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-)
drivers/md/md.c +12 -3
@@ -2452,7 +2452,8 @@ static void export_rdev(struct md_rdev *rdev, struct mddev *mddev)if (test_bit (AutoDetected, &rdev->flags))md_autodetect_dev (rdev->bdev->bd_dev);#endif -blkdev_put (rdev->bdev, mddev->external ? &claim_rdev : rdev); +blkdev_put (rdev->bdev, +test_bit (Holder, &rdev->flags) ? rdev : &claim_rdev); rdev->bdev =NULL ;kobject_put (&rdev->kobj); }
@@ -3632,6 +3633,7 @@ EXPORT_SYMBOL_GPL(md_rdev_init);static struct md_rdev *md_import_device (dev_t newdev,int super_format,int super_minor) {struct md_rdev *rdev; +struct md_rdev *holder;sector_t size;int err;
@@ -3646,8 +3648,15 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supeif (err) goto out_clear_rdev; +if (super_format ==-2 ) { + holder = &claim_rdev; + }else { + holder = rdev; +set_bit (Holder, &rdev->flags); + } + rdev->bdev =blkdev_get_by_dev (newdev,BLK_OPEN_READ |BLK_OPEN_WRITE , - super_format ==-2 ? &claim_rdev : rdev,NULL ); + holder,NULL );if (IS_ERR (rdev->bdev)) {pr_warn ("md: could not open device unknown-block(%u,%u).\n" ,MAJOR (newdev),MINOR (newdev));
@@ -3684,7 +3693,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supereturn rdev; out_blkdev_put: -blkdev_put (rdev->bdev, super_format ==-2 ? &claim_rdev : rdev); +blkdev_put (rdev->bdev, holder); out_clear_rdev:md_rdev_clear (rdev); out_free_rdev:
drivers/md/md.h +3 -0
@@ -211,6 +211,9 @@ enum flag_bits {* check if there is collision between raid1 * serial bios. */ + Holder, /* rdev is used as holder while opening +* underlying disk exclusively. +*/ }; static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 148/211 efivarfs: fix statfs() on efivarfs
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heinrich Schuchardt <[email protected]>
[ Upstream commit 79b83606abc778aa3cbee535b362ce905d0b9448 ]
Some firmware (notably U-Boot) provides GetVariable() and GetNextVariableName() but not QueryVariableInfo().
With commit d86ff3333cb1 ("efivarfs: expose used and total size") the statfs syscall was broken for such firmware.
If QueryVariableInfo() does not exist or returns EFI_UNSUPPORTED, just report the file system size as 0 as statfs_simple() previously did.
--- fs/efivarfs/super.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
fs/efivarfs/super.c +10 -4
@@ -32,10 +32,16 @@ static int efivarfs_statfs(struct dentry *dentry, struct kstatfs *buf)u64 storage_space, remaining_space, max_variable_size;efi_status_t status; - status =efivar_query_variable_info (attr, &storage_space, &remaining_space, - &max_variable_size); -if (status !=EFI_SUCCESS ) -return efi_status_to_err (status); +/* Some UEFI firmware does not implement QueryVariableInfo() */ + storage_space = remaining_space =0 ; +if (efi_rt_services_supported (EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO )) { + status =efivar_query_variable_info (attr, &storage_space, + &remaining_space, + &max_variable_size); +if (status !=EFI_SUCCESS && status !=EFI_UNSUPPORTED ) +pr_warn_ratelimited ("query_variable_info() failed: 0x%lx\n" , + status); + }/* * This is not a normal filesystem, so no point in pretending it has a block
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 149/211 PM: hibernate: Fix the exclusive get block device in test_resume mode
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yu <[email protected]>
[ Upstream commit 148b6f4cc3920e563094540fe1a12d00d3bbccae ]
Commit 5904de0d735b ("PM: hibernate: Do not get block device exclusively in test_resume mode") fixes a hibernation issue under test_resume mode. That commit is supposed to open the block device in non-exclusive mode when in test_resume. However the code does the opposite, which is against its description.
In summary, the swap device is only opened exclusively by swsusp_check() with its corresponding *close(), and must be in non test_resume mode. This is to avoid the race condition that different processes scribble the device at the same time. All the other cases should use non-exclusive mode.
Fix it by really disabling exclusive mode under test_resume.
--- kernel/power/hibernate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/power/hibernate.c +6 -6
@@ -786,9 +786,9 @@ int hibernate(void)unlock_device_hotplug ();if (snapshot_test) {pm_pr_dbg ("Checking hibernation image\n" ); - error =swsusp_check (snapshot_test); + error =swsusp_check (false);if (!error) - error =load_image_and_restore (snapshot_test); + error =load_image_and_restore (false); }thaw_processes ();
@@ -945,14 +945,14 @@ static int software_resume(void)pm_pr_dbg ("Looking for hibernation image.\n" );mutex_lock (&system_transition_mutex); - error =swsusp_check (false); + error =swsusp_check (true);if (error) goto Unlock;/* The snapshot device should not be opened while we're running */ if (!hibernate_acquire ()) { error = -EBUSY ; -swsusp_close (false); +swsusp_close (true); goto Unlock; }
@@ -973,7 +973,7 @@ static int software_resume(void) goto Close_Finish; } - error =load_image_and_restore (false); + error =load_image_and_restore (true);thaw_processes (); Finish:pm_notifier_call_chain (PM_POST_RESTORE );
@@ -987,7 +987,7 @@ static int software_resume(void)pm_pr_dbg ("Hibernation image not present or could not be loaded.\n" );return error; Close_Finish: -swsusp_close (false); +swsusp_close (true); goto Finish; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 150/211 selftests: tracing: Fix to unmount tracefs for recovering environment
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
[ Upstream commit 7e021da80f48582171029714f8a487347f29dddb ]
Fix to unmount the tracefs if the ftracetest mounted it for recovering system environment. If the tracefs is already mounted, this does nothing.
--- tools/testing/selftests/ftrace/ftracetest | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/testing/selftests/ftrace/ftracetest +8 -0
@@ -31,6 +31,9 @@ err_ret=1 # kselftest skip code is 4 err_skip=4 +# umount required +UMOUNT_DIR="" + # cgroup RT scheduling prevents chrt commands from succeeding, which # induces failures in test wakeup tests. Disable for the duration of # the tests.
@@ -45,6 +48,9 @@ setup() { cleanup() { echo $sched_rt_runtime_orig > $sched_rt_runtime + if [ -n "${UMOUNT_DIR}" ]; then + umount ${UMOUNT_DIR} ||: + fi } errexit() { # message
@@ -160,11 +166,13 @@ if [ -z "$TRACING_DIR" ]; then mount -t tracefs nodev /sys/kernel/tracing || errexit "Failed to mount /sys/kernel/tracing" TRACING_DIR="/sys/kernel/tracing" + UMOUNT_DIR=${TRACING_DIR} # If debugfs exists, then so does /sys/kernel/debug elif [ -d "/sys/kernel/debug" ]; then mount -t debugfs nodev /sys/kernel/debug || errexit "Failed to mount /sys/kernel/debug" TRACING_DIR="/sys/kernel/debug/tracing" + UMOUNT_DIR=${TRACING_DIR} else err_ret=$err_skip errexit "debugfs and tracefs are not configured in this kernel"
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 151/211 x86/ibt: Suppress spurious ENDBR
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 25e73b7e3f72a25aa30cbb2eecb49036e0acf066 ]
It was reported that under certain circumstances GCC emits ENDBR instructions for _THIS_IP_ usage. Specifically, when it appears at the start of a basic block -- but not elsewhere.
Since _THIS_IP_ is never used for control flow, these ENDBR instructions are completely superfluous. Override the _THIS_IP_ definition for x86_64 to avoid this.
Less ENDBR instructions is better.
--- arch/x86/include/asm/linkage.h | 8 ++++++++ include/linux/instruction_pointer.h | 5 +++++ 2 files changed, 13 insertions(+)
arch/x86/include/asm/linkage.h +8 -0
@@ -8,6 +8,14 @@#undef notrace#define notrace __attribute__((no_instrument_function)) +#ifdef CONFIG_64BIT +/* +* The generic version tends to create spurious ENDBR instructions under +* certain conditions. +*/ +#define _THIS_IP_ ({ unsigned long __here; asm ("lea 0(%%rip), %0" : "=r" (__here)); __here; }) +#endif +#ifdef CONFIG_X86_32 #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))#endif /* CONFIG_X86_32 */
include/linux/instruction_pointer.h +5 -0
@@ -2,7 +2,12 @@#ifndef _LINUX_INSTRUCTION_POINTER_H#define _LINUX_INSTRUCTION_POINTER_H +#include <asm/linkage.h> +#define _RET_IP_ (unsigned long)__builtin_return_address(0) + +#ifndef _THIS_IP_#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) +#endif #endif /* _LINUX_INSTRUCTION_POINTER_H */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 152/211 x86/ibt: Avoid duplicate ENDBR in __put_user_nocheck*()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 7575e5a35267983dcbeb1e0d3a49d21ae3cf0b82 ]
Commit cb855971d717 ("x86/putuser: Provide room for padding") changed __put_user_nocheck_*() into proper functions but failed to note that SYM_FUNC_START() already provides ENDBR, rendering the explicit ENDBR superfluous.
--- arch/x86/lib/putuser.S | 4 ---- 1 file changed, 4 deletions(-)
arch/x86/lib/putuser.S +0 -4
@@ -56,7 +56,6 @@ SYM_FUNC_END(__put_user_1) EXPORT_SYMBOL(__put_user_1) SYM_FUNC_START(__put_user_nocheck_1) - ENDBR ASM_STAC 2: movb %al,(%_ASM_CX) xor %ecx,%ecx
@@ -76,7 +75,6 @@ SYM_FUNC_END(__put_user_2) EXPORT_SYMBOL(__put_user_2) SYM_FUNC_START(__put_user_nocheck_2) - ENDBR ASM_STAC 4: movw %ax,(%_ASM_CX) xor %ecx,%ecx
@@ -96,7 +94,6 @@ SYM_FUNC_END(__put_user_4) EXPORT_SYMBOL(__put_user_4) SYM_FUNC_START(__put_user_nocheck_4) - ENDBR ASM_STAC 6: movl %eax,(%_ASM_CX) xor %ecx,%ecx
@@ -119,7 +116,6 @@ SYM_FUNC_END(__put_user_8) EXPORT_SYMBOL(__put_user_8) SYM_FUNC_START(__put_user_nocheck_8) - ENDBR ASM_STAC 9: mov %_ASM_AX,(%_ASM_CX) #ifdef CONFIG_X86_32
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 153/211 riscv: kexec: Align the kexeced kernel entry
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Song Shuai <[email protected]>
[ Upstream commit 1bfb2b618d52e59a4ef1896b46c4698ad2be66b7 ]
The current riscv boot protocol requires 2MB alignment for RV64 and 4MB alignment for RV32.
In KEXEC_FILE path, the elf_find_pbase() function should align the kexeced kernel entry according to the requirement, otherwise the kexeced kernel would silently BUG at the setup_vm().
--- arch/riscv/kernel/elf_kexec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/riscv/kernel/elf_kexec.c +7 -1
@@ -98,7 +98,13 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len, kbuf.image = image; kbuf.buf_min = lowest_paddr; kbuf.buf_max =ULONG_MAX ; - kbuf.buf_align =PAGE_SIZE ; + +/* +* Current riscv boot protocol requires 2MB alignment for +* RV64 and 4MB alignment for RV32 +* +*/ + kbuf.buf_align =PMD_SIZE ; kbuf.mem =KEXEC_BUF_MEM_UNKNOWN ; kbuf.memsz =ALIGN (kernel_len,PAGE_SIZE ); kbuf.top_down = false;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 154/211 x86/sched: Restore the SD_ASYM_PACKING flag in the DIE domain
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Neri <[email protected]>
[ Upstream commit 108af4b4bd3813610701379a58538e3339b162e4 ]
Commit 8f2d6c41e5a6 ("x86/sched: Rewrite topology setup") dropped the SD_ASYM_PACKING flag in the DIE domain added in commit 044f0e27dec6 ("x86/sched: Add the SD_ASYM_PACKING flag to the die domain of hybrid processors"). Restore it on hybrid processors.
The die-level domain does not depend on any build configuration and now x86_sched_itmt_flags() is always needed. Remove the build dependency on CONFIG_SCHED_[SMT|CLUSTER|MC].
--- arch/x86/kernel/smpboot.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
arch/x86/kernel/smpboot.c +9 -3
@@ -587,7 +587,6 @@ static bool match_llc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) } -#if defined(CONFIG_SCHED_SMT ) || defined(CONFIG_SCHED_CLUSTER ) || defined(CONFIG_SCHED_MC )static inline int x86_sched_itmt_flags (void ) {return sysctl_sched_itmt_enabled ?SD_ASYM_PACKING :0 ;
@@ -611,7 +610,14 @@ static int x86_cluster_flags(void) return cpu_cluster_flags() | x86_sched_itmt_flags(); }#endif -#endif + +static int x86_die_flags (void ) +{ +if (cpu_feature_enabled (X86_FEATURE_HYBRID_CPU )) +return x86_sched_itmt_flags (); + +return 0 ; +}/* * Set if a package/die has multiple NUMA nodes inside.
@@ -653,7 +659,7 @@ static void __init build_sched_topology(void)*/ if (!x86_has_numa_in_package) { x86_topology[i++] = (struct sched_domain_topology_level ){ - cpu_cpu_mask,SD_INIT_NAME (DIE ) + cpu_cpu_mask, x86_die_flags,SD_INIT_NAME (DIE ) }; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 155/211 scsi: target: core: Fix target_cmd_counter leak
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Disseldorp <[email protected]>
[ Upstream commit d14e3e553e05cb763964c991fe6acb0a6a1c6f9c ]
The target_cmd_counter struct allocated via target_alloc_cmd_counter() is never freed, resulting in leaks across various transport types, e.g.:
unreferenced object 0xffff88801f920120 (size 96):
comm "sh", pid 102, jiffies 4294892535 (age 713.412s) hex dump (first 32 bytes):
07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 38 01 92 1f 80 88 ff ff ........8.......
backtrace:
[<00000000e58a6252>] kmalloc_trace+0x11/0x20
[<0000000043af4b2f>] target_alloc_cmd_counter+0x17/0x90 [target_core_mod]
[<000000007da2dfa7>] target_setup_session+0x2d/0x140 [target_core_mod]
[<0000000068feef86>] tcm_loop_tpg_nexus_store+0x19b/0x350 [tcm_loop]
[<000000006a80e021>] configfs_write_iter+0xb1/0x120
[<00000000e9f4d860>] vfs_write+0x2e4/0x3c0
[<000000008143433b>] ksys_write+0x80/0xb0
[<00000000a7df29b2>] do_syscall_64+0x42/0x90
[<0000000053f45fb8>] entry_SYSCALL_64_after_hwframe+0x6e/0xd8Free the structure alongside the corresponding iscsit_conn / se_sess parent.
--- drivers/target/target_core_transport.c | 1 + 1 file changed, 1 insertion(+)
drivers/target/target_core_transport.c +1 -0
@@ -264,6 +264,7 @@ void target_free_cmd_counter(struct target_cmd_counter *cmd_cnt)percpu_ref_put (&cmd_cnt->refcnt);percpu_ref_exit (&cmd_cnt->refcnt); +kfree (cmd_cnt); }EXPORT_SYMBOL_GPL (target_free_cmd_counter);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 156/211 scsi: lpfc: Fix the NULL vs IS_ERR() bug for debugfs_create_file()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit 7dcc683db3639eadd11bf0d59a09088a43de5e22 ]
Since debugfs_create_file() returns ERR_PTR and never NULL, use IS_ERR() to check the return value.
--- drivers/scsi/lpfc/lpfc_debugfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/scsi/lpfc/lpfc_debugfs.c +7 -7
@@ -6073,7 +6073,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) phba->hba_debugfs_root, phba, &lpfc_debugfs_op_multixripools); -if (!phba->debug_multixri_pools) { +if (IS_ERR (phba->debug_multixri_pools)) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_INIT ,"0527 Cannot create debugfs multixripools\n" ); goto debug_failed;
@@ -6085,7 +6085,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)debugfs_create_file (name,S_IFREG |0644 , phba->hba_debugfs_root, phba, &lpfc_cgn_buffer_op); -if (!phba->debug_cgn_buffer) { +if (IS_ERR (phba->debug_cgn_buffer)) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_INIT ,"6527 Cannot create debugfs " "cgn_buffer\n" );
@@ -6098,7 +6098,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)debugfs_create_file (name,S_IFREG |0644 , phba->hba_debugfs_root, phba, &lpfc_rx_monitor_op); -if (!phba->debug_rx_monitor) { +if (IS_ERR (phba->debug_rx_monitor)) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_INIT ,"6528 Cannot create debugfs " "rx_monitor\n" );
@@ -6111,7 +6111,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)debugfs_create_file (name,0644 , phba->hba_debugfs_root, phba, &lpfc_debugfs_ras_log); -if (!phba->debug_ras_log) { +if (IS_ERR (phba->debug_ras_log)) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_INIT ,"6148 Cannot create debugfs" " ras_log\n" );
@@ -6132,7 +6132,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)debugfs_create_file (name,S_IFREG |0644 , phba->hba_debugfs_root, phba, &lpfc_debugfs_op_lockstat); -if (!phba->debug_lockstat) { +if (IS_ERR (phba->debug_lockstat)) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_INIT ,"4610 Can't create debugfs lockstat\n" ); goto debug_failed;
@@ -6358,7 +6358,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)debugfs_create_file (name,0644 , vport->vport_debugfs_root, vport, &lpfc_debugfs_op_scsistat); -if (!vport->debug_scsistat) { +if (IS_ERR (vport->debug_scsistat)) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_INIT ,"4611 Cannot create debugfs scsistat\n" ); goto debug_failed;
@@ -6369,7 +6369,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)debugfs_create_file (name,0644 , vport->vport_debugfs_root, vport, &lpfc_debugfs_op_ioktime); -if (!vport->debug_ioktime) { +if (IS_ERR (vport->debug_ioktime)) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_INIT ,"0815 Cannot create debugfs ioktime\n" ); goto debug_failed;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 157/211 panic: Reenable preemption in WARN slowpath
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
[ Upstream commit cccd32816506cbac3a4c65d9dff51b3125ef1a03 ]
Commit:
5a5d7e9badd2 ("cpuidle: lib/bug: Disable rcu_is_watching() during WARN/BUG")
amended warn_slowpath_fmt() to disable preemption until the WARN splat has been emitted.
However the commit neglected to reenable preemption in the !fmt codepath, i.e. when a WARN splat is emitted without additional format string.
One consequence is that users may see more splats than intended. E.g. a WARN splat emitted in a work item results in at least two extra splats:
BUG: workqueue leaked lock or atomic (emitted by process_one_work()) BUG: scheduling while atomic (emitted by worker_thread() -> schedule())
Ironically the point of the commit was to *avoid* extra splats. ;)
Fix it.
--- kernel/panic.c | 1 + 1 file changed, 1 insertion(+)
kernel/panic.c +1 -0
@@ -697,6 +697,7 @@ void warn_slowpath_fmt(const char *file, int line, unsigned taint,if (!fmt) {__warn (file, line,__builtin_return_address (0 ), taint,NULL ,NULL ); +warn_rcu_exit (rcu);return ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 158/211 ata: libata: remove references to non-existing error_handler()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit ff8072d589dcff7c1f0345a6ec98b5fc1e9ee2a1 ]
With commit 65a15d6560df ("scsi: ipr: Remove SATA support") all libata drivers now have the error_handler() callback provided, so we can stop checking for non-existing error_handler callback.
[niklas: fixed review comments, rebased, solved conflicts during rebase, fixed bug that unconditionally dumped all QCs, removed the now unused function ata_dump_status(), removed the now unreachable failure paths in atapi_qc_complete(), removed the non-EH function to request ATAPI sense]
Stable-dep-of: 5e35a9ac3fe3 ("ata: libata-core: fetch sense data for successful commands iff CDL enabled")
--- drivers/ata/libata-core.c | 209 +++++++++++++++----------------------- drivers/ata/libata-eh.c | 152 ++++++++++++--------------- drivers/ata/libata-sata.c | 7 +- drivers/ata/libata-scsi.c | 161 ++--------------------------- drivers/ata/libata-sff.c | 30 ++---- include/linux/libata.h | 2 +- 6 files changed, 170 insertions(+), 391 deletions(-)
drivers/ata/libata-core.c +84 -125
@@ -1586,13 +1586,11 @@ static unsigned ata_exec_internal_sg(struct ata_device *dev, } } -if (ap->ops->error_handler) -ata_eh_release (ap); +ata_eh_release (ap); rc =wait_for_completion_timeout (&wait,msecs_to_jiffies (timeout)); -if (ap->ops->error_handler) -ata_eh_acquire (ap); +ata_eh_acquire (ap);ata_sff_flush_pio_task (ap);
@@ -1607,10 +1605,7 @@ static unsigned ata_exec_internal_sg(struct ata_device *dev,if (qc->flags &ATA_QCFLAG_ACTIVE ) { qc->err_mask |=AC_ERR_TIMEOUT ; -if (ap->ops->error_handler) -ata_port_freeze (ap); -else -ata_qc_complete (qc); +ata_port_freeze (ap);ata_dev_warn (dev,"qc timeout after %u msecs (cmd 0x%x)\n" , timeout, command);
@@ -4874,126 +4869,103 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc)void ata_qc_complete (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap; +struct ata_device *dev = qc->dev; +struct ata_eh_info *ehi = &dev->link->eh_info;/* Trigger the LED (if available) */ ledtrig_disk_activity (!!(qc->tf.flags &ATA_TFLAG_WRITE )); -/* XXX: New EH and old EH use different mechanisms to -* synchronize EH with regular execution path. -* -* In new EH, a qc owned by EH is marked with ATA_QCFLAG_EH. -* Normal execution path is responsible for not accessing a -* qc owned by EH. libata core enforces the rule by returning NULL -* from ata_qc_from_tag() for qcs owned by EH. +/* +* In order to synchronize EH with the regular execution path, a qc that +* is owned by EH is marked with ATA_QCFLAG_EH. * -* Old EH depends on ata_qc_complete() nullifying completion -* requests if ATA_QCFLAG_EH_SCHEDULED is set. Old EH does -* not synchronize with interrupt handler. Only PIO task is -* taken care of. +* The normal execution path is responsible for not accessing a qc owned +* by EH. libata core enforces the rule by returning NULL from +* ata_qc_from_tag() for qcs owned by EH. */ -if (ap->ops->error_handler) { -struct ata_device *dev = qc->dev; -struct ata_eh_info *ehi = &dev->link->eh_info; - -if (unlikely (qc->err_mask)) - qc->flags |=ATA_QCFLAG_EH ; +if (unlikely (qc->err_mask)) + qc->flags |=ATA_QCFLAG_EH ; -/* -* Finish internal commands without any further processing -* and always with the result TF filled. -*/ -if (unlikely (ata_tag_internal (qc->tag))) { -fill_result_tf (qc); -trace_ata_qc_complete_internal (qc); -__ata_qc_complete (qc); -return ; - } +/* +* Finish internal commands without any further processing and always +* with the result TF filled. +*/ +if (unlikely (ata_tag_internal (qc->tag))) { +fill_result_tf (qc); +trace_ata_qc_complete_internal (qc); +__ata_qc_complete (qc); +return ; + } -/* -* Non-internal qc has failed. Fill the result TF and -* summon EH. -*/ -if (unlikely (qc->flags &ATA_QCFLAG_EH )) { -fill_result_tf (qc); -trace_ata_qc_complete_failed (qc); -ata_qc_schedule_eh (qc); -return ; - } +/* Non-internal qc has failed. Fill the result TF and summon EH. */ +if (unlikely (qc->flags &ATA_QCFLAG_EH )) { +fill_result_tf (qc); +trace_ata_qc_complete_failed (qc); +ata_qc_schedule_eh (qc); +return ; + } -WARN_ON_ONCE (ata_port_is_frozen (ap)); +WARN_ON_ONCE (ata_port_is_frozen (ap)); -/* read result TF if requested */ -if (qc->flags &ATA_QCFLAG_RESULT_TF ) -fill_result_tf (qc); +/* read result TF if requested */ +if (qc->flags &ATA_QCFLAG_RESULT_TF ) +fill_result_tf (qc); -trace_ata_qc_complete_done (qc); +trace_ata_qc_complete_done (qc); +/* +* For CDL commands that completed without an error, check if we have +* sense data (ATA_SENSE is set). If we do, then the command may have +* been aborted by the device due to a limit timeout using the policy +* 0xD. For these commands, invoke EH to get the command sense data. +*/ +if (qc->result_tf.status &ATA_SENSE && + ((ata_is_ncq (qc->tf.protocol) && + dev->flags &ATA_DFLAG_CDL_ENABLED ) || + (!ata_is_ncq (qc->tf.protocol) && +ata_id_sense_reporting_enabled (dev->id)))) {/* -* For CDL commands that completed without an error, check if -* we have sense data (ATA_SENSE is set). If we do, then the -* command may have been aborted by the device due to a limit -* timeout using the policy 0xD. For these commands, invoke EH -* to get the command sense data. +* Tell SCSI EH to not overwrite scmd->result even if this +* command is finished with result SAM_STAT_GOOD. */ -if (qc->result_tf.status &ATA_SENSE && - ((ata_is_ncq (qc->tf.protocol) && - dev->flags &ATA_DFLAG_CDL_ENABLED ) || - (!ata_is_ncq (qc->tf.protocol) && -ata_id_sense_reporting_enabled (dev->id)))) { -/* -* Tell SCSI EH to not overwrite scmd->result even if -* this command is finished with result SAM_STAT_GOOD. -*/ - qc->scsicmd->flags |=SCMD_FORCE_EH_SUCCESS ; - qc->flags |=ATA_QCFLAG_EH_SUCCESS_CMD ; - ehi->dev_action[dev->devno] |=ATA_EH_GET_SUCCESS_SENSE ; - -/* -* set pending so that ata_qc_schedule_eh() does not -* trigger fast drain, and freeze the port. -*/ - ap->pflags |=ATA_PFLAG_EH_PENDING ; -ata_qc_schedule_eh (qc); -return ; - } + qc->scsicmd->flags |=SCMD_FORCE_EH_SUCCESS ; + qc->flags |=ATA_QCFLAG_EH_SUCCESS_CMD ; + ehi->dev_action[dev->devno] |=ATA_EH_GET_SUCCESS_SENSE ; -/* Some commands need post-processing after successful -* completion. +/* +* set pending so that ata_qc_schedule_eh() does not trigger +* fast drain, and freeze the port. */ -switch (qc->tf.command) { -case ATA_CMD_SET_FEATURES : -if (qc->tf.feature !=SETFEATURES_WC_ON && - qc->tf.feature !=SETFEATURES_WC_OFF && - qc->tf.feature !=SETFEATURES_RA_ON && - qc->tf.feature !=SETFEATURES_RA_OFF ) -break ; - fallthrough; -case ATA_CMD_INIT_DEV_PARAMS :/* CHS translation changed */ -case ATA_CMD_SET_MULTI :/* multi_count changed */ -/* revalidate device */ - ehi->dev_action[dev->devno] |=ATA_EH_REVALIDATE ; -ata_port_schedule_eh (ap); -break ; + ap->pflags |=ATA_PFLAG_EH_PENDING ; +ata_qc_schedule_eh (qc); +return ; + } -case ATA_CMD_SLEEP : - dev->flags |=ATA_DFLAG_SLEEPING ; +/* Some commands need post-processing after successful completion. */ +switch (qc->tf.command) { +case ATA_CMD_SET_FEATURES : +if (qc->tf.feature !=SETFEATURES_WC_ON && + qc->tf.feature !=SETFEATURES_WC_OFF && + qc->tf.feature !=SETFEATURES_RA_ON && + qc->tf.feature !=SETFEATURES_RA_OFF )break ; - } - -if (unlikely (dev->flags &ATA_DFLAG_DUBIOUS_XFER )) -ata_verify_xfer (qc); + fallthrough; +case ATA_CMD_INIT_DEV_PARAMS :/* CHS translation changed */ +case ATA_CMD_SET_MULTI :/* multi_count changed */ +/* revalidate device */ + ehi->dev_action[dev->devno] |=ATA_EH_REVALIDATE ; +ata_port_schedule_eh (ap); +break ; -__ata_qc_complete (qc); - }else { -if (qc->flags &ATA_QCFLAG_EH_SCHEDULED ) -return ; +case ATA_CMD_SLEEP : + dev->flags |=ATA_DFLAG_SLEEPING ; +break ; + } -/* read result TF if failed or requested */ -if (qc->err_mask || qc->flags &ATA_QCFLAG_RESULT_TF ) -fill_result_tf (qc); +if (unlikely (dev->flags &ATA_DFLAG_DUBIOUS_XFER )) +ata_verify_xfer (qc); -__ata_qc_complete (qc); - } +__ata_qc_complete (qc); }EXPORT_SYMBOL_GPL (ata_qc_complete);
@@ -5039,11 +5011,8 @@ void ata_qc_issue(struct ata_queued_cmd *qc)struct ata_link *link = qc->dev->link;u8 prot = qc->tf.protocol; -/* Make sure only one non-NCQ command is outstanding. The -* check is skipped for old EH because it reuses active qc to -* request ATAPI sense. -*/ -WARN_ON_ONCE (ap->ops->error_handler &&ata_tag_valid (link->active_tag)); +/* Make sure only one non-NCQ command is outstanding. */ +WARN_ON_ONCE (ata_tag_valid (link->active_tag));if (ata_is_ncq (prot)) {WARN_ON_ONCE (link->sactive & (1 << qc->hw_tag));
@@ -5917,15 +5886,9 @@ void __ata_port_probe(struct ata_port *ap)int ata_port_probe (struct ata_port *ap) { -int rc =0 ; - -if (ap->ops->error_handler) { -__ata_port_probe (ap); -ata_port_wait_eh (ap); - }else { - rc =ata_bus_probe (ap); - } -return rc; +__ata_port_probe (ap); +ata_port_wait_eh (ap); +return 0 ; }
@@ -6130,9 +6093,6 @@ static void ata_port_detach(struct ata_port *ap)struct ata_link *link;struct ata_device *dev; -if (!ap->ops->error_handler) - goto skip_eh; -/* tell EH we're leaving & flush EH */ spin_lock_irqsave (ap->lock, flags); ap->pflags |=ATA_PFLAG_UNLOADING ;
@@ -6148,7 +6108,6 @@ static void ata_port_detach(struct ata_port *ap)cancel_delayed_work_sync (&ap->hotplug_task);cancel_delayed_work_sync (&ap->scsi_rescan_task); - skip_eh:/* clean up zpodd on port removal */ ata_for_each_link (link, ap,HOST_FIRST ) {ata_for_each_dev (dev, link,ALL ) {
drivers/ata/libata-eh.c +63 -89
228 lines not on this page · raw message
drivers/ata/libata-sata.c +1 -6
@@ -1158,12 +1158,7 @@ EXPORT_SYMBOL_GPL(ata_sas_port_alloc);*/ int ata_sas_port_start (struct ata_port *ap) { -/* -* the port is marked as frozen at allocation time, but if we don't -* have new eh, we won't thaw it -*/ -if (!ap->ops->error_handler) - ap->pflags &= ~ATA_PFLAG_FROZEN ; +/* the port is marked as frozen at allocation time */ return 0 ; }EXPORT_SYMBOL_GPL (ata_sas_port_start);
drivers/ata/libata-scsi.c +11 -150
263 lines not on this page · raw message
drivers/ata/libata-sff.c +10 -20
@@ -883,31 +883,21 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) {struct ata_port *ap = qc->ap; -if (ap->ops->error_handler) { -if (in_wq) { -/* EH might have kicked in while host lock is -* released. -*/ - qc =ata_qc_from_tag (ap, qc->tag); -if (qc) { -if (likely (!(qc->err_mask &AC_ERR_HSM ))) { -ata_sff_irq_on (ap); -ata_qc_complete (qc); - }else -ata_port_freeze (ap); - } - }else { -if (likely (!(qc->err_mask &AC_ERR_HSM ))) +if (in_wq) { +/* EH might have kicked in while host lock is released. */ + qc =ata_qc_from_tag (ap, qc->tag); +if (qc) { +if (likely (!(qc->err_mask &AC_ERR_HSM ))) { +ata_sff_irq_on (ap);ata_qc_complete (qc); -else + }else ata_port_freeze (ap); } }else { -if (in_wq) { -ata_sff_irq_on (ap); -ata_qc_complete (qc); - }else +if (likely (!(qc->err_mask &AC_ERR_HSM )))ata_qc_complete (qc); +else +ata_port_freeze (ap); } }
include/linux/libata.h +1 -1
@@ -1785,7 +1785,7 @@ static inline struct ata_queued_cmd *ata_qc_from_tag(struct ata_port *ap, {struct ata_queued_cmd *qc =__ata_qc_from_tag (ap, tag); -if (unlikely (!qc) || !ap->ops->error_handler) +if (unlikely (!qc))return qc; if ((qc->flags & (ATA_QCFLAG_ACTIVE |
Signature · 1 line
2.40.1
Re: [PATCH 6.5 158/211] ata: libata: remove references to non-existing error_handler()
Quoted 1 line · Greg Kroah-Hartman
6.5-stable review patch. If anyone has any objections, please let me know.
Hello Greg,
I don't think that we should backport this commit.
While the patch did apply without conflicts, it was part of a series that did a bunch of other cleanups as well.
I think that it is best to either have that whole series (and we don't want to backport the whole series), or none of the patches in that series.
(So that at least we know that we have one or the other, not some half-way cleanup that will only live in v6.5 stable.)
Quoted 16 lines
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit
ff8072d589dcff7c1f0345a6ec98b5fc1e9ee2a1]With commit
65a15d6560df("scsi: ipr: Remove SATA support") all libata drivers now have theerror_handler()callback provided, so we can stop checking for non-existingerror_handlercallback.Signed-off-by Hannes Reinecke <[email protected]>[niklas: fixed review comments, rebased, solved conflicts during rebase, fixed bug that unconditionally dumped all QCs, removed the now unused function
ata_dump_status(), removed the now unreachable failure paths inatapi_qc_complete(), removed the non-EH function to request ATAPI sense]
Quoted 6 lines
Signed-off-by Niklas Cassel <[email protected]>Reviewed-by John Garry <[email protected]>Reviewed-by Jason Yan <[email protected]>Reviewed-by Martin K. Petersen <[email protected]>Signed-off-by Damien Le Moal <[email protected]>Stable-dep-of:
5e35a9ac3fe3("ata: libata-core: fetch sense data for successful commands iff CDL enabled")
Yes, it is true that5e35a9ac3fe3 ("ata: libata-core: fetch sense data for successful commands iff CDL enabled") does not apply cleanly to v6.5 stable without this big commit.
I'm attaching a backported version of that patch (which is only 2 lines or so) that can be applied to v6.5 stable instead.
Kind regards,
Niklas
From e8d3e482fd2870fc56e2af7eb3812263e446564f Mon Sep 17 00:00:00 2001
From: Niklas Cassel <[email protected]>
Date: Wed, 13 Sep 2023 17:04:43 +0200
Subject: [PATCH] ata: libata-core: fetch sense data for successful commands
iff CDL enabled
Currently, we fetch sense data for a _successful_ command if either:
1) Command was NCQ and ATA_DFLAG_CDL_ENABLED flag set (flag ATA_DFLAG_CDL_ENABLED will only be set if the Successful NCQ command sense data supported bit is set); or
2) Command was non-NCQ and regular sense data reporting is enabled.
This means that case 2) will trigger for a non-NCQ command which has ATA_SENSE bit set, regardless if CDL is enabled or not.
This decision was by design. If the device reports that it has sense data available, it makes sense to fetch that sense data, since the sk/asc/ascq could be important information regardless if CDL is enabled or not.
However, the fetching of sense data for a successful command is done via ATA EH. Considering how intricate the ATA EH is, we really do not want to invoke ATA EH unless absolutely needed.
Before commit 18bd7718b5c4 ("scsi: ata: libata: Handle completion of CDL commands using policy 0xD") we never fetched sense data for successful commands.
In order to not invoke the ATA EH unless absolutely necessary, even if the device claims support for sense data reporting, only fetch sense data for successful (NCQ and non-NCQ commands) commands that are using CDL.
[Damien] Modified the check to test the qc flag ATA_QCFLAG_HAS_CDL instead of the device support for CDL, which is implied for commands using CDL.
--- drivers/ata/libata-core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/ata/libata-core.c +2 -5
@@ -4935,11 +4935,8 @@ void ata_qc_complete(struct ata_queued_cmd *qc)* timeout using the policy 0xD. For these commands, invoke EH * to get the command sense data. */ -if (qc->result_tf.status &ATA_SENSE && - ((ata_is_ncq (qc->tf.protocol) && - dev->flags &ATA_DFLAG_CDL_ENABLED ) || - (!ata_is_ncq (qc->tf.protocol) && -ata_id_sense_reporting_enabled (dev->id)))) { +if (qc->flags &ATA_QCFLAG_HAS_CDL && + qc->result_tf.status &ATA_SENSE ) {/* * Tell SCSI EH to not overwrite scmd->result even if * this command is finished with result SAM_STAT_GOOD.
Signature · 1 line
2.41.0
Re: [PATCH 6.5 158/211] ata: libata: remove references to non-existing error_handler()
Quoted 6 lines · Niklas Cassel
Quoted 1 line · Greg Kroah-Hartman
6.5-stable review patch. If anyone has any objections, please let me know.
Hello Greg,
I don't think that we should backport this commit.
Yes, we should not. The IPR driver is still in stable, so adding this patch would be wrong.
Quoted 44 lines
While the patch did apply without conflicts, it was part of a series that did a bunch of other cleanups as well.
I think that it is best to either have that whole series (and we don't want to backport the whole series), or none of the patches in that series.
(So that at least we know that we have one or the other, not some half-way cleanup that will only live in v6.5 stable.)
Quoted 16 lines
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit
ff8072d589dcff7c1f0345a6ec98b5fc1e9ee2a1]With commit
65a15d6560df("scsi: ipr: Remove SATA support") all libata drivers now have theerror_handler()callback provided, so we can stop checking for non-existingerror_handlercallback.Signed-off-by Hannes Reinecke <[email protected]>[niklas: fixed review comments, rebased, solved conflicts during rebase, fixed bug that unconditionally dumped all QCs, removed the now unused function
ata_dump_status(), removed the now unreachable failure paths inatapi_qc_complete(), removed the non-EH function to request ATAPI sense]Quoted 6 lines
Signed-off-by Niklas Cassel <[email protected]>Reviewed-by John Garry <[email protected]>Reviewed-by Jason Yan <[email protected]>Reviewed-by Martin K. Petersen <[email protected]>Signed-off-by Damien Le Moal <[email protected]>Stable-dep-of:
5e35a9ac3fe3("ata: libata-core: fetch sense data for successful commands iff CDL enabled")Yes, it is true that
5e35a9ac3fe3("ata: libata-core: fetch sense data for successful commands iff CDL enabled") does not apply cleanly to v6.5 stable without this big commit.I'm attaching a backported version of that patch (which is only 2 lines or so) that can be applied to v6.5 stable instead.
Kind regards,
Niklas
Signature · 2 lines
Damien Le Moal Western Digital Research
Greg Kroah-Hartman
maintainerRe: [PATCH 6.5 158/211] ata: libata: remove references to non-existing error_handler()
In reply to Niklas CasselQuoted 7 lines · Niklas Cassel
Quoted 1 line · Greg Kroah-Hartman
6.5-stable review patch. If anyone has any objections, please let me know.
Hello Greg,
I don't think that we should backport this commit.
Quoted 8 lines
While the patch did apply without conflicts, it was part of a series that did a bunch of other cleanups as well.
I think that it is best to either have that whole series (and we don't want to backport the whole series), or none of the patches in that series.
(So that at least we know that we have one or the other, not some half-way cleanup that will only live in v6.5 stable.)
Thanks, now dropped. It was added for a later patch as a dependancy, but I fixed that up by hand so all should be good now.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 159/211 ata: libata-core: fetch sense data for successful commands iff CDL enabled
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
[ Upstream commit 5e35a9ac3fe3a0d571b899a16ca84253e53dc70c ]
Currently, we fetch sense data for a _successful_ command if either:
1) Command was NCQ and ATA_DFLAG_CDL_ENABLED flag set (flag ATA_DFLAG_CDL_ENABLED will only be set if the Successful NCQ command sense data supported bit is set); or
2) Command was non-NCQ and regular sense data reporting is enabled.
This means that case 2) will trigger for a non-NCQ command which has ATA_SENSE bit set, regardless if CDL is enabled or not.
This decision was by design. If the device reports that it has sense data available, it makes sense to fetch that sense data, since the sk/asc/ascq could be important information regardless if CDL is enabled or not.
However, the fetching of sense data for a successful command is done via ATA EH. Considering how intricate the ATA EH is, we really do not want to invoke ATA EH unless absolutely needed.
Before commit 18bd7718b5c4 ("scsi: ata: libata: Handle completion of CDL commands using policy 0xD") we never fetched sense data for successful commands.
In order to not invoke the ATA EH unless absolutely necessary, even if the device claims support for sense data reporting, only fetch sense data for successful (NCQ and non-NCQ commands) commands that are using CDL.
[Damien] Modified the check to test the qc flag ATA_QCFLAG_HAS_CDL instead of the device support for CDL, which is implied for commands using CDL.
--- drivers/ata/libata-core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/ata/libata-core.c +2 -5
@@ -4919,11 +4919,8 @@ void ata_qc_complete(struct ata_queued_cmd *qc)* been aborted by the device due to a limit timeout using the policy * 0xD. For these commands, invoke EH to get the command sense data. */ -if (qc->result_tf.status &ATA_SENSE && - ((ata_is_ncq (qc->tf.protocol) && - dev->flags &ATA_DFLAG_CDL_ENABLED ) || - (!ata_is_ncq (qc->tf.protocol) && -ata_id_sense_reporting_enabled (dev->id)))) { +if (qc->flags &ATA_QCFLAG_HAS_CDL && + qc->result_tf.status &ATA_SENSE ) {/* * Tell SCSI EH to not overwrite scmd->result even if this * command is finished with result SAM_STAT_GOOD.
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 160/211 x86/boot/compressed: Reserve more memory for page tables
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirill A. Shutemov <[email protected]>
[ Upstream commit f530ee95b72e77b09c141c4b1a4b94d1199ffbd9 ]
The decompressor has a hard limit on the number of page tables it can allocate. This limit is defined at compile-time and will cause boot failure if it is reached.
The kernel is very strict and calculates the limit precisely for the worst-case scenario based on the current configuration. However, it is easy to forget to adjust the limit when a new use-case arises. The worst-case scenario is rarely encountered during sanity checks.
In the case of enabling 5-level paging, a use-case was overlooked. The limit needs to be increased by one to accommodate the additional level. This oversight went unnoticed until Aaron attempted to run the kernel via kexec with 5-level paging and unaccepted memory enabled.
Update wost-case calculations to include 5-level paging.
To address this issue, let's allocate some extra space for page tables. 128K should be sufficient for any use-case. The logic can be simplified by using a single value for all kernel configurations.
[ Also add a warning, should this memory run low - by Dave Hansen. ]
--- arch/x86/boot/compressed/ident_map_64.c | 8 +++++ arch/x86/include/asm/boot.h | 45 +++++++++++++++++-------- 2 files changed, 39 insertions(+), 14 deletions(-)
arch/x86/boot/compressed/ident_map_64.c +8 -0
@@ -59,6 +59,14 @@ static void *alloc_pgt_page(void *context)return NULL ; } +/* Consumed more tables than expected? */ +if (pages->pgt_buf_offset ==BOOT_PGT_SIZE_WARN ) { +debug_putstr ("pgt_buf running low in " __FILE__"\n" ); +debug_putstr ("Need to raise BOOT_PGT_SIZE?\n" ); +debug_putaddr (pages->pgt_buf_offset); +debug_putaddr (pages->pgt_buf_size); + } + entry = pages->pgt_buf + pages->pgt_buf_offset; pages->pgt_buf_offset +=PAGE_SIZE ;
arch/x86/include/asm/boot.h +31 -14
54 lines not on this page · raw message
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 161/211 x86/purgatory: Remove LTO flags
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Song Liu <[email protected]>
[ Upstream commit 75b2f7e4c9e0fd750a5a27ca9736d1daa7a3762a ]
-flto* implies -ffunction-sections. With LTO enabled, ld.lld generates multiple .text sections for purgatory.ro:
$ readelf -S purgatory.ro | grep " .text"
[ 1] .text PROGBITS 0000000000000000 00000040
[ 7] .text.purgatory PROGBITS 0000000000000000 000020e0
[ 9] .text.warn PROGBITS 0000000000000000 000021c0
[13] .text.sha256_upda PROGBITS 0000000000000000 000022f0
[15] .text.sha224_upda PROGBITS 0000000000000000 00002be0
[17] .text.sha256_fina PROGBITS 0000000000000000 00002bf0
[19] .text.sha224_fina PROGBITS 0000000000000000 00002cc0This causes WARNING from kexec_purgatory_setup_sechdrs():
WARNING: CPU: 26 PID: 110894 at kernel/kexec_file.c:919 kexec_load_purgatory+0x37f/0x390
Fix this by disabling LTO for purgatory.
[ AFAICT, x86 is the only arch that supports LTO and purgatory. ]
We could also fix this with an explicit linker script to rejoin .text.* sections back into .text. However, given the benefit of LTOing purgatory is small, simply disable the production of more .text.* sections for now.
--- arch/x86/purgatory/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/purgatory/Makefile +4 -0
@@ -19,6 +19,10 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY # optimization flags. KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) +# When LTO is enabled, llvm emits many text sections, which is not supported +# by kexec. Remove -flto=* flags. +KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO),$(KBUILD_CFLAGS)) + # When linking purgatory.ro with -r unresolved symbols are not checked, # also link a purgatory.chk binary without -r to check for unresolved symbols. PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 162/211 samples/hw_breakpoint: fix building without module unloading
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit b9080468caeddc58a91edd1c3a7d212ea82b0d1d ]
__symbol_put() is really meant as an internal helper and is not available when module unloading is disabled, unlike the previously used symbol_put():
samples/hw_breakpoint/data_breakpoint.c: In function 'hw_break_module_exit':samples/hw_breakpoint/data_breakpoint.c:73:9: error: implicit declaration of function '__symbol_put'; did you mean '__symbol_get'? [-Werror=implicit-function-declaration]
The hw_break_module_exit() function is not actually used when module unloading is disabled, but it still causes the build failure for an undefined identifier. Enclose this one call in an appropriate #ifdef to clarify what the requirement is. Leaving out the entire exit function would also work but feels less clar in this case.
--- samples/hw_breakpoint/data_breakpoint.c | 2 ++ 1 file changed, 2 insertions(+)
samples/hw_breakpoint/data_breakpoint.c +2 -0
@@ -70,7 +70,9 @@ static int __init hw_break_module_init(void) static void __exit hw_break_module_exit(void) {unregister_wide_hw_breakpoint (sample_hbp); +#ifdef CONFIG_MODULE_UNLOAD __symbol_put (ksym_name); +#endif printk (KERN_INFO "HW Breakpoint for %s write uninstalled\n" , ksym_name); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 163/211 blk-mq: prealloc tags when increase tagset nr_hw_queues
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengming Zhou <[email protected]>
commit 7222657e51b5626d10154b3e48ad441c33b5da96 upstream.
Just like blk_mq_alloc_tag_set(), it's better to prepare all tags before using to map to queue ctxs in blk_mq_map_swqueue(), which now have to consider empty set->tags[].
The good point is that we can fallback easily if increasing nr_hw_queues fail, instead of just mapping to hctx[0] when fail in blk_mq_map_swqueue().
And the fallback path already has tags free & clean handling, so all is good.
--- block/blk-mq.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
block/blk-mq.c +10 -0
@@ -4420,6 +4420,16 @@ static int blk_mq_realloc_tag_set_tags(s sizeof(*set->tags));kfree (set->tags); set->tags = new_tags; + +for (i = set->nr_hw_queues; i < new_nr_hw_queues; i++) { +if (!__blk_mq_alloc_map_and_rqs (set, i)) { +while (--i >= set->nr_hw_queues) +__blk_mq_free_map_and_rqs (set, i); +return -ENOMEM ; + } +cond_resched (); + } + done: set->nr_hw_queues = new_nr_hw_queues;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 164/211 blk-mq: fix tags UAF when shrinking q->nr_hw_queues
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengming Zhou <[email protected]>
[ Upstream commit 6be6d112419713334ddd9c01f219ca16adaa4c76 ]
When nr_hw_queues shrink, we free the excess tags before realloc'ing hw_ctxs for each queue. During that resize, we may need to access those tags, like blk_mq_tag_idle(hctx) will access queue shared tags.
This can cause a slab use-after-free, as reported by KASAN. Fix it by moving the releasing of excess tags to the end.
--- block/blk-mq.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
block/blk-mq.c +7 -6
@@ -4404,11 +4404,8 @@ static int blk_mq_realloc_tag_set_tags(sstruct blk_mq_tags **new_tags;int i; -if (set->nr_hw_queues >= new_nr_hw_queues) { -for (i = new_nr_hw_queues; i < set->nr_hw_queues; i++) -__blk_mq_free_map_and_rqs (set, i); +if (set->nr_hw_queues >= new_nr_hw_queues) goto done; - } new_tags =kcalloc_node (new_nr_hw_queues,sizeof (struct blk_mq_tags *),GFP_KERNEL , set->numa_node);
@@ -4718,7 +4715,8 @@ static void __blk_mq_update_nr_hw_queues {struct request_queue *q;LIST_HEAD (head); -int prev_nr_hw_queues; +int prev_nr_hw_queues = set->nr_hw_queues; +int i;lockdep_assert_held (&set->tag_list_lock);
@@ -4745,7 +4743,6 @@ static void __blk_mq_update_nr_hw_queuesblk_mq_sysfs_unregister_hctxs (q); } - prev_nr_hw_queues = set->nr_hw_queues;if (blk_mq_realloc_tag_set_tags (set, nr_hw_queues) <0 ) goto reregister;
@@ -4781,6 +4778,10 @@ switch_back:list_for_each_entry (q, &set->tag_list, tag_set_list)blk_mq_unfreeze_queue (q); + +/* Free the excess tags when nr_hw_queues shrink. */ +for (i = set->nr_hw_queues; i < prev_nr_hw_queues; i++) +__blk_mq_free_map_and_rqs (set, i); }void blk_mq_update_nr_hw_queues (struct blk_mq_tag_set *set,int nr_hw_queues)
Greg Kroah-Hartman
maintainerPATCH 165/211 md/raid1: fix error: ISO C90 forbids mixed declarations
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nigel Croxon <[email protected]>
[ Upstream commit df203da47f4428bc286fc99318936416253a321c ]
There is a compile error when this commit is added:
md: raid1: fix potential OOB in raid1_remove_disk()
drivers/md/raid1.c: In function 'raid1_remove_disk':drivers/md/raid1.c:1844:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
1844 | struct raid1_info *p = conf->mirrors + number;
| ^~~~~~
That's because the new code was inserted before the struct. The change is move the struct command above this commit.
--- drivers/md/raid1.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/md/raid1.c +1 -2
@@ -1829,12 +1829,11 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)struct r1conf *conf = mddev->private;int err =0 ;int number = rdev->raid_disk; +struct raid1_info *p = conf->mirrors + number;if (unlikely (number >= conf->raid_disks)) goto abort; -struct raid1_info *p = conf->mirrors + number; -if (rdev != p->rdev) p = conf->mirrors + conf->raid_disks + number;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 166/211 Revert "SUNRPC: Fail faster on bad verifier"
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit e86fcf0820d914389b46658a5a7e8969c3af2d53 upstream.
This reverts commit 0701214cd6e66585a999b132eb72ae0489beb724.
The premise of this commit was incorrect. There are exactly 2 cases where rpcauth_checkverf() will return an error:
1) If there was an XDR decode problem (i.e. garbage data).
2) If gss_validate() had a problem verifying the RPCSEC_GSS MIC.
In the second case, there are again 2 subcases:
a) The GSS context expires, in which case gss_validate() will force a new context negotiation on retry by invalidating the cred.
b) The sequence number check failed because an RPC call timed out, and the client retransmitted the request using a new sequence number, as required by RFC2203.
In neither subcase is this a fatal error.
--- net/sunrpc/clnt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +1 -1
@@ -2722,7 +2722,7 @@ out_unparsable: out_verifier:trace_rpc_bad_verifier (task); - goto out_err; + goto out_garbage; out_msg_denied: error = -EACCES ;
Greg Kroah-Hartman
maintainerPATCH 167/211 attr: block mode changes of symlinks
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
commit 5d1f903f75a80daa4dfb3d84e114ec8ecbf29956 upstream.
Changing the mode of symlinks is meaningless as the vfs doesn't take the mode of a symlink into account during path lookup permission checking.
However, the vfs doesn't block mode changes on symlinks. This however, has lead to an untenable mess roughly classifiable into the following two categories:
(1) Filesystems that don't implement a i_op->setattr() for symlinks.
Such filesystems may or may not know that without i_op->setattr() defined, notify_change() falls back to simple_setattr() causing the inode's mode in the inode cache to be changed.
That's a generic issue as this will affect all non-size changing inode attributes including ownership changes.
Example: afs
(2) Filesystems that fail with EOPNOTSUPP but change the mode of the symlink nonetheless.
Some filesystems will happily update the mode of a symlink but still return EOPNOTSUPP. This is the biggest source of confusion for userspace.
The EOPNOTSUPP in this case comes from POSIX ACLs. Specifically it comes from filesystems that call posix_acl_chmod(), e.g., btrfs via
if (!err && attr->ia_valid & ATTR_MODE)
err = posix_acl_chmod(idmap, dentry, inode->i_mode);
Filesystems including btrfs don't implement i_op->set_acl() so posix_acl_chmod() will report EOPNOTSUPP.
When posix_acl_chmod() is called, most filesystems will have finished updating the inode.
Perversely, this has the consequences that this behavior may depend on two kconfig options and mount options:
* CONFIG_POSIX_ACL={y,n}
* CONFIG_${FSTYPE}_POSIX_ACL={y,n}
* Opt_acl, Opt_noacl
Example: btrfs, ext4, xfs
The only way to change the mode on a symlink currently involves abusing an O_PATH file descriptor in the following manner:
fd = openat(-1, "/path/to/link", O_CLOEXEC | O_PATH | O_NOFOLLOW);
char path[PATH_MAX];
snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
chmod(path, 0000);But for most major filesystems with POSIX ACL support such as btrfs, ext4, ceph, tmpfs, xfs and others this will fail with EOPNOTSUPP with the mode still updated due to the aforementioned posix_acl_chmod() nonsense.
So, given that for all major filesystems this would fail with EOPNOTSUPP and that both glibc (cf. [1]) and musl (cf. [2]) outright block mode changes on symlinks we should just try and block mode changes on symlinks directly in the vfs and have a clean break with this nonsense.
If this causes any regressions, we do the next best thing and fix up all filesystems that do return EOPNOTSUPP with the mode updated to not call posix_acl_chmod() on symlinks.
But as usual, let's try the clean cut solution first. It's a simple patch that can be easily reverted. Not marking this for backport as I'll do that manually if we're reasonably sure that this works and there are no strong objections.
We could block this in chmod_common() but it's more appropriate to do it notify_change() as it will also mean that we catch filesystems that change symlink permissions explicitly or accidently.
Similar proposals were floated in the past as in [3] and [4] and again recently in [5]. There's also a couple of bugs about this inconsistency as in [6] and [7].
Message-Id: <[email protected]>
--- fs/attr.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
fs/attr.c +18 -2
@@ -394,9 +394,25 @@ int notify_change(struct mnt_idmap *idmareturn error;if ((ia_valid &ATTR_MODE )) { -umode_t amode = attr->ia_mode; +/* +* Don't allow changing the mode of symlinks: +* +* (1) The vfs doesn't take the mode of symlinks into account +* during permission checking. +* (2) This has never worked correctly. Most major filesystems +* did return EOPNOTSUPP due to interactions with POSIX ACLs +* but did still updated the mode of the symlink. +* This inconsistency led system call wrapper providers such +* as libc to block changing the mode of symlinks with +* EOPNOTSUPP already. +* (3) To even do this in the first place one would have to use +* specific file descriptors and quite some effort. +*/ +if (S_ISLNK (inode->i_mode)) +return -EOPNOTSUPP ; +/* Flag setting protected by i_mutex */ -if (is_sxid (amode)) +if (is_sxid (attr->ia_mode)) inode->i_flags &= ~S_NOSEC ; }
Greg Kroah-Hartman
maintainerPATCH 168/211 ovl: fix failed copyup of fileattr on a symlink
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
commit ab048302026d7701e7fbd718917e0dbcff0c4223 upstream.
Some local filesystems support setting persistent fileattr flags (e.g. FS_NOATIME_FL) on directories and regular files via ioctl. Some of those persistent fileattr flags are reflected to vfs as in-memory inode flags (e.g. S_NOATIME).
Overlayfs uses the in-memory inode flags (e.g. S_NOATIME) on a lower file as an indication that a the lower file may have persistent inode fileattr flags (e.g. FS_NOATIME_FL) that need to be copied to upper file.
However, in some cases, the S_NOATIME in-memory flag could be a false indication for persistent FS_NOATIME_FL fileattr. For example, with NFS and FUSE lower fs, as was the case in the two bug reports, the S_NOATIME flag is set unconditionally for all inodes.
Users cannot set persistent fileattr flags on symlinks and special files, but in some local fs, such as ext4/btrfs/tmpfs, the FS_NOATIME_FL fileattr flag are inheritted to symlinks and special files from parent directory.
In both cases described above, when lower symlink has the S_NOATIME flag, overlayfs will try to copy the symlink's fileattrs and fail with error ENOXIO, because it could not open the symlink for the ioctl security hook.
To solve this failure, do not attempt to copyup fileattrs for anything other than directories and regular files.
--- fs/overlayfs/copy_up.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/overlayfs/copy_up.c +2 -1
@@ -617,7 +617,8 @@ static int ovl_copy_up_metadata(struct oif (err)return err; -if (inode->i_flags &OVL_COPY_I_FLAGS_MASK ) { +if (inode->i_flags &OVL_COPY_I_FLAGS_MASK && + (S_ISREG (c->stat.mode) ||S_ISDIR (c->stat.mode))) {/* * Copy the fileattr inode flags that are the source of already * copied i_flags
Greg Kroah-Hartman
maintainerPATCH 169/211 ovl: fix incorrect fdput() on aio completion
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
commit 724768a39374d35b70eaeae8dd87048a2ec7ae8e upstream.
ovl_{read,write}_iter() always call fdput(real) to put one or zero refcounts of the real file, but for aio, whether it was submitted or not, ovl_aio_put() also calls fdput(), which is not balanced. This is only a problem in the less common case when FDPUT_FPUT flag is set.
To fix the problem use get_file() to take file refcount and use fput() instead of fdput() in ovl_aio_put().
--- fs/overlayfs/file.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
fs/overlayfs/file.c +3 -6
@@ -19,7 +19,6 @@ struct ovl_aio_req {struct kiocb iocb;refcount_t ref;struct kiocb *orig_iocb; -struct fd fd; };static struct kmem_cache *ovl_aio_request_cachep;
@@ -277,7 +276,7 @@ static rwf_t ovl_iocb_to_rwf(int ifl)static inline void ovl_aio_put (struct ovl_aio_req *aio_req) {if (refcount_dec_and_test (&aio_req->ref)) { -fdput (aio_req->fd); +fput (aio_req->iocb.ki_filp);kmem_cache_free (ovl_aio_request_cachep, aio_req); } }
@@ -342,10 +341,9 @@ static ssize_t ovl_read_iter(struct kiocif (!aio_req) goto out; - aio_req->fd = real; real.flags =0 ; aio_req->orig_iocb = iocb; -kiocb_clone (&aio_req->iocb, iocb, real.file); +kiocb_clone (&aio_req->iocb, iocb,get_file (real.file)); aio_req->iocb.ki_complete = ovl_aio_rw_complete;refcount_set (&aio_req->ref,2 ); ret =vfs_iocb_iter_read (real.file, &aio_req->iocb, iter);
@@ -413,10 +411,9 @@ static ssize_t ovl_write_iter(struct kio/* Pacify lockdep, same trick as done in aio_write() */ __sb_writers_release (file_inode (real.file)->i_sb,SB_FREEZE_WRITE ); - aio_req->fd = real; real.flags =0 ; aio_req->orig_iocb = iocb; -kiocb_clone (&aio_req->iocb, iocb, real.file); +kiocb_clone (&aio_req->iocb, iocb,get_file (real.file)); aio_req->iocb.ki_flags = ifl; aio_req->iocb.ki_complete = ovl_aio_rw_complete;refcount_set (&aio_req->ref,2 );
Greg Kroah-Hartman
maintainerPATCH 170/211 io_uring/net: fix iter retargeting for selected buf
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit c21a8027ad8a68c340d0d58bf1cc61dcb0bc4d2f upstream.
When using selected buffer feature, io_uring delays data iter setup until later. If io_setup_async_msg() is called before that it might see not correctly setup iterator. Pre-init nr_segs and judge from its state whether we repointing.
--- io_uring/net.c | 5 +++++ 1 file changed, 5 insertions(+)
io_uring/net.c +5 -0
@@ -183,6 +183,10 @@ static int io_setup_async_msg(struct io_memcpy (async_msg, kmsg,sizeof (*kmsg));if (async_msg->msg.msg_name) async_msg->msg.msg_name = &async_msg->addr; + +if ((req->flags &REQ_F_BUFFER_SELECT ) && !async_msg->msg.msg_iter.nr_segs) +return -EAGAIN ; +/* if were using fast_iov, set it to the new one */ if (iter_is_iovec (&kmsg->msg.msg_iter) && !kmsg->free_iov) {size_t fast_idx =iter_iov (&kmsg->msg.msg_iter) - kmsg->fast_iov;
@@ -542,6 +546,7 @@ static int io_recvmsg_copy_hdr(struct io struct io_async_msghdr *iomsg) { iomsg->msg.msg_name = &iomsg->addr; + iomsg->msg.msg_iter.nr_segs =0 ;#ifdef CONFIG_COMPAT if (req->ctx->compat)
Greg Kroah-Hartman
maintainerPATCH 171/211 nvme: avoid bogus CRTO values
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
commit 6cc834ba62998c65c42d0c63499bdd35067151ec upstream.
Some devices are reporting controller ready mode support, but return 0 for CRTO. These devices require a much higher time to ready than that, so they are failing to initialize after the driver starter preferring that value over CAP.TO.
The spec requires that CAP.TO match the appropritate CRTO value, or be set to 0xff if CRTO is larger than that. This means that CAP.TO can be used to validate if CRTO is reliable, and provides an appropriate fallback for setting the timeout value if not. Use whichever is larger.
--- drivers/nvme/host/core.c | 54 ++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 19 deletions(-)
drivers/nvme/host/core.c +35 -19
@@ -2245,25 +2245,8 @@ int nvme_enable_ctrl(struct nvme_ctrl *celse ctrl->ctrl_config =NVME_CC_CSS_NVM ; -if (ctrl->cap &NVME_CAP_CRMS_CRWMS ) { -u32 crto; - - ret = ctrl->ops->reg_read32 (ctrl,NVME_REG_CRTO , &crto); -if (ret) { -dev_err (ctrl->device,"Reading CRTO failed (%d)\n" , - ret); -return ret; - } - -if (ctrl->cap &NVME_CAP_CRMS_CRIMS ) { - ctrl->ctrl_config |=NVME_CC_CRIME ; - timeout =NVME_CRTO_CRIMT (crto); - }else { - timeout =NVME_CRTO_CRWMT (crto); - } - }else { - timeout =NVME_CAP_TIMEOUT (ctrl->cap); - } +if (ctrl->cap &NVME_CAP_CRMS_CRWMS && ctrl->cap &NVME_CAP_CRMS_CRIMS ) + ctrl->ctrl_config |=NVME_CC_CRIME ; ctrl->ctrl_config |= (NVME_CTRL_PAGE_SHIFT -12 ) <<NVME_CC_MPS_SHIFT ; ctrl->ctrl_config |=NVME_CC_AMS_RR |NVME_CC_SHN_NONE ;
@@ -2277,6 +2260,39 @@ int nvme_enable_ctrl(struct nvme_ctrl *cif (ret)return ret; +/* CAP value may change after initial CC write */ + ret = ctrl->ops->reg_read64 (ctrl,NVME_REG_CAP , &ctrl->cap); +if (ret) +return ret; + + timeout =NVME_CAP_TIMEOUT (ctrl->cap); +if (ctrl->cap &NVME_CAP_CRMS_CRWMS ) { +u32 crto, ready_timeout; + + ret = ctrl->ops->reg_read32 (ctrl,NVME_REG_CRTO , &crto); +if (ret) { +dev_err (ctrl->device,"Reading CRTO failed (%d)\n" , + ret); +return ret; + } + +/* +* CRTO should always be greater or equal to CAP.TO, but some +* devices are known to get this wrong. Use the larger of the +* two values. +*/ +if (ctrl->ctrl_config &NVME_CC_CRIME ) + ready_timeout =NVME_CRTO_CRIMT (crto); +else + ready_timeout =NVME_CRTO_CRWMT (crto); + +if (ready_timeout < timeout) +dev_warn_once (ctrl->device,"bad crto:%x cap:%llx\n" , + crto, ctrl->cap); +else + timeout = ready_timeout; + } + ctrl->ctrl_config |=NVME_CC_ENABLE ; ret = ctrl->ops->reg_write32 (ctrl,NVME_REG_CC , ctrl->ctrl_config);if (ret)
Greg Kroah-Hartman
maintainerPATCH 172/211 x86/platform/uv: Use alternate source for socket to node data
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Wahl <[email protected]>
commit 5290e88ba2c742ca77c5f5b690e5af549cfd8591 upstream.
The UV code attempts to build a set of tables to allow it to do bidirectional socket<=>node lookups.
But when nr_cpus is set to a smaller number than actually present, the cpu_to_node() mapping information for unused CPUs is not available to build_socket_tables(). This results in skipping some nodes or sockets when creating the tables and leaving some -1's for later code to trip. over, causing oopses.
The problem is that the socket<=>node lookups are created by doing a loop over all CPUs, then looking up the CPU's APICID and socket. But if a CPU is not present, there is no way to start this lookup.
Instead of looping over all CPUs, take CPUs out of the equation entirely. Loop over all APICIDs which are mapped to a valid NUMA node. Then just extract the socket-id from the APICID.
This avoid tripping over disabled CPUs.
--- arch/x86/kernel/apic/x2apic_uv_x.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
arch/x86/kernel/apic/x2apic_uv_x.c +5 -6
@@ -1571,7 +1571,7 @@ static void __init build_socket_tables(v {struct uv_gam_range_entry *gre = uv_gre_table;int nums, numn, nump; -int cpu, i, lnid; +int i, lnid, apicid;int minsock = _min_socket;int maxsock = _max_socket;int minpnode = _min_pnode;
@@ -1622,15 +1622,14 @@ static void __init build_socket_tables(v/* Set socket -> node values: */ lnid =NUMA_NO_NODE ; -for_each_possible_cpu (cpu) { -int nid =cpu_to_node (cpu); -int apicid, sockid; +for (apicid =0 ; apicid <ARRAY_SIZE (__apicid_to_node); apicid++) { +int nid = __apicid_to_node[apicid]; +int sockid; -if (lnid == nid) +if ((nid ==NUMA_NO_NODE ) || (lnid == nid))continue ; lnid = nid; - apicid =per_cpu (x86_cpu_to_apicid, cpu); sockid = apicid >> uv_cpuid.socketid_shift;if (_socket_to_node[sockid - minsock] ==SOCK_EMPTY )
Greg Kroah-Hartman
maintainerPATCH 173/211 Revert "firewire: core: obsolete usage of GFP_ATOMIC at building node tree"
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit 3c70de9b580998e5d644f4e80a9944c30aa1197b upstream.
This reverts commit 06f45435d985d60d7d2fe2424fbb9909d177a63d.
John Ogness reports the case that the allocation is in atomic context under acquired spin-lock.
[ 12.555784] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306 [ 12.555808] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 70, name: kworker/1:2 [ 12.555814] preempt_count: 1, expected: 0 [ 12.555820] INFO: lockdep is turned off. [ 12.555824] irq event stamp: 208 [ 12.555828] hardirqs last enabled at (207): [<c00000000111e414>] ._raw_spin_unlock_irq+0x44/0x80 [ 12.555850] hardirqs last disabled at (208): [<c00000000110ff94>] .__schedule+0x854/0xfe0 [ 12.555859] softirqs last enabled at (188): [<c000000000f73504>] .addrconf_verify_rtnl+0x2c4/0xb70 [ 12.555872] softirqs last disabled at (182): [<c000000000f732b0>] .addrconf_verify_rtnl+0x70/0xb70 [ 12.555884] CPU: 1 PID: 70 Comm: kworker/1:2 Tainted: G S 6.6.0-rc1 #1 [ 12.555893] Hardware name: PowerMac7,2 PPC970 0x390202 PowerMac [ 12.555898] Workqueue: firewire_ohci .bus_reset_work [firewire_ohci] [ 12.555939] Call Trace: [ 12.555944] [c000000009677830] [c0000000010d83c0] .dump_stack_lvl+0x8c/0xd0 (unreliable) [ 12.555963] [c0000000096778b0] [c000000000140270] .__might_resched+0x320/0x340 [ 12.555978] [c000000009677940] [c000000000497600] .__kmem_cache_alloc_node+0x390/0x460 [ 12.555993] [c000000009677a10] [c0000000003fe620] .__kmalloc+0x70/0x310 [ 12.556007] [c000000009677ac0] [c0003d00004e2268] .fw_core_handle_bus_reset+0x2c8/0xba0 [firewire_core] [ 12.556060] [c000000009677c20] [c0003d0000491190] .bus_reset_work+0x330/0x9b0 [firewire_ohci] [ 12.556079] [c000000009677d10] [c00000000011d0d0] .process_one_work+0x280/0x6f0 [ 12.556094] [c000000009677e10] [c00000000011d8a0] .worker_thread+0x360/0x500 [ 12.556107] [c000000009677ef0] [c00000000012e3b4] .kthread+0x154/0x160 [ 12.556120] [c000000009677f90] [c00000000000bfa8] .start_kernel_thread+0x10/0x14
--- drivers/firewire/core-device.c | 2 +- drivers/firewire/core-topology.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/firewire/core-device.c +1 -1
@@ -1211,7 +1211,7 @@ void fw_node_event(struct fw_card *card,* without actually having a link. */ create: - device =kzalloc (sizeof (*device),GFP_KERNEL ); + device =kzalloc (sizeof (*device),GFP_ATOMIC );if (device ==NULL )break ;
drivers/firewire/core-topology.c +1 -1
@@ -101,7 +101,7 @@ static struct fw_node *fw_node_create(u3 {struct fw_node *node; - node =kzalloc (struct_size (node, ports, port_count),GFP_KERNEL ); + node =kzalloc (struct_size (node, ports, port_count),GFP_ATOMIC );if (node ==NULL )return NULL ;
Greg Kroah-Hartman
maintainerPATCH 174/211 md: Put the right device in md_seq_next
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mariusz Tkaczyk <[email protected]>
commit c8870379a21fbd9ad14ca36204ccfbe9d25def43 upstream.
If there are multiple arrays in system and one mddevice is marked with MD_DELETED and md_seq_next() is called in the middle of removal then it _get()s proper device but it may _put() deleted one. As a result, active counter may never be zeroed for mddevice and it cannot be removed.
Put the device which has been _get with previous md_seq_next() call.
--- drivers/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md.c +1 -1
@@ -8214,7 +8214,7 @@ static void *md_seq_next(struct seq_filespin_unlock (&all_mddevs_lock);if (to_put) -mddev_put (mddev); +mddev_put (to_put);return next_mddev; }
Greg Kroah-Hartman
maintainerPATCH 175/211 drm/amd: Make fence wait in suballocator uninterruptible
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Pilkington <[email protected]>
commit e2884fe84a83c562346eb9d92783a3576ce67177 upstream.
Commit c103a23f2f29
("drm/amd: Convert amdgpu to use suballocation helper.") made the fence wait in amdgpu_sa_bo_new() interruptible but there is no code to handle an interrupt. This caused the kernel to randomly explode in high-VRAM-pressure situations so make it uninterruptible again.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +1 -1
@@ -81,7 +81,7 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_ma unsigned int size) {struct drm_suballoc *sa =drm_suballoc_new (&sa_manager->base, size, -GFP_KERNEL , true,0 ); +GFP_KERNEL , false,0 );if (IS_ERR (sa)) { *sa_bo =NULL ;
Greg Kroah-Hartman
maintainerPATCH 176/211 Revert "drm/amd: Disable S/G for APUs when 64GB or more host memory"
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hamza Mahfooz <[email protected]>
commit 169ed4ece8373f02f10642eae5240e3d1ef5c038 upstream.
This reverts commit 70e64c4d522b732e31c6475a3be2349de337d321.
Since, we now have an actual fix for this issue, we can get rid of this workaround as it can cause pin failures if enough VRAM isn't carved out by the BIOS.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 26 ---------------------- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ++-- 3 files changed, 3 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
@@ -1296,7 +1296,6 @@ int amdgpu_device_gpu_recover(struct amdvoid amdgpu_device_pci_config_reset (struct amdgpu_device *adev);int amdgpu_device_pci_reset (struct amdgpu_device *adev);bool amdgpu_device_need_post (struct amdgpu_device *adev); -bool amdgpu_sg_display_supported (struct amdgpu_device *adev);bool amdgpu_device_pcie_dynamic_switching_supported (void );bool amdgpu_device_should_use_aspm (struct amdgpu_device *adev);bool amdgpu_device_aspm_support_quirk (void );
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -26
@@ -1462,32 +1462,6 @@ bool amdgpu_device_need_post(struct amdg }/* -* On APUs with >= 64GB white flickering has been observed w/ SG enabled. -* Disable S/G on such systems until we have a proper fix. -* https://gitlab.freedesktop.org/drm/amd/-/issues/2354 -* https://gitlab.freedesktop.org/drm/amd/-/issues/2735 -*/ -bool amdgpu_sg_display_supported (struct amdgpu_device *adev) -{ -switch (amdgpu_sg_display) { -case -1 : -break ; -case 0 : -return false; -case 1 : -return true; -default : -return false; - } -if ((totalram_pages () << (PAGE_SHIFT -10 )) + - (adev->gmc.real_vram_size /1024 ) >=64000000 ) { -DRM_WARN ("Disabling S/G due to >=64GB RAM\n" ); -return false; - } -return true; -} - -/* * Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic * speed switching. Until we have confirmation from Intel that a specific host * supports it, it's safer that we keep it disabled for all.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -2
@@ -1638,8 +1638,9 @@ static int amdgpu_dm_init(struct amdgpu_ }break ; } -if (init_data.flags.gpu_vm_support) - init_data.flags.gpu_vm_support =amdgpu_sg_display_supported (adev); +if (init_data.flags.gpu_vm_support && + (amdgpu_sg_display ==0 )) + init_data.flags.gpu_vm_support = false;if (init_data.flags.gpu_vm_support) adev->mode_info.gpu_vm_support = true;
Greg Kroah-Hartman
maintainerPATCH 177/211 dm: dont attempt to queue IO under RCU protection
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit a9ce385344f916cd1c36a33905e564f5581beae9 upstream.
dm looks up the table for IO based on the request type, with an assumption that if the request is marked REQ_NOWAIT, it's fine to attempt to submit that IO while under RCU read lock protection. This is not OK, as REQ_NOWAIT just means that we should not be sleeping waiting on other IO, it does not mean that we can't potentially schedule.
A simple test case demonstrates this quite nicely:
int main(int argc, char *argv[])
{
struct iovec iov;
int fd;
fd = open("/dev/dm-0", O_RDONLY | O_DIRECT);
posix_memalign(&iov.iov_base, 4096, 4096);
iov.iov_len = 4096;
preadv2(fd, &iov, 1, 0, RWF_NOWAIT);
return 0;
}which will instantly spew:
BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5580, name: dm-nowaitpreempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
INFO: lockdep is turned off.
CPU: 7 PID: 5580 Comm: dm-nowait Not tainted 6.6.0-rc1-g39956d2dcd81 #132 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x11d/0x1b0 __might_resched+0x3c3/0x5e0 ? preempt_count_sub+0x150/0x150 mempool_alloc+0x1e2/0x390 ? mempool_resize+0x7d0/0x7d0 ? lock_sync+0x190/0x190 ? lock_release+0x4b7/0x670 ? internal_get_user_pages_fast+0x868/0x2d40 bio_alloc_bioset+0x417/0x8c0 ? bvec_alloc+0x200/0x200 ? internal_get_user_pages_fast+0xb8c/0x2d40 bio_alloc_clone+0x53/0x100 dm_submit_bio+0x27f/0x1a20 ? lock_release+0x4b7/0x670 ? blk_try_enter_queue+0x1a0/0x4d0 ? dm_dax_direct_access+0x260/0x260 ? rcu_is_watching+0x12/0xb0 ? blk_try_enter_queue+0x1cc/0x4d0 __submit_bio+0x239/0x310 ? __bio_queue_enter+0x700/0x700 ? kvm_clock_get_cycles+0x40/0x60 ? ktime_get+0x285/0x470 submit_bio_noacct_nocheck+0x4d9/0xb80 ? should_fail_request+0x80/0x80 ? preempt_count_sub+0x150/0x150 ? lock_release+0x4b7/0x670 ? __bio_add_page+0x143/0x2d0 ? iov_iter_revert+0x27/0x360 submit_bio_noacct+0x53e/0x1b30 submit_bio_wait+0x10a/0x230 ? submit_bio_wait_endio+0x40/0x40 __blkdev_direct_IO_simple+0x4f8/0x780 ? blkdev_bio_end_io+0x4c0/0x4c0 ? stack_trace_save+0x90/0xc0 ? __bio_clone+0x3c0/0x3c0 ? lock_release+0x4b7/0x670 ? lock_sync+0x190/0x190 ? atime_needs_update+0x3bf/0x7e0 ? timestamp_truncate+0x21b/0x2d0 ? inode_owner_or_capable+0x240/0x240 blkdev_direct_IO.part.0+0x84a/0x1810 ? rcu_is_watching+0x12/0xb0 ? lock_release+0x4b7/0x670 ? blkdev_read_iter+0x40d/0x530 ? reacquire_held_locks+0x4e0/0x4e0 ? __blkdev_direct_IO_simple+0x780/0x780 ? rcu_is_watching+0x12/0xb0 ? __mark_inode_dirty+0x297/0xd50 ? preempt_count_add+0x72/0x140 blkdev_read_iter+0x2a4/0x530 do_iter_readv_writev+0x2f2/0x3c0 ? generic_copy_file_range+0x1d0/0x1d0 ? fsnotify_perm.part.0+0x25d/0x630 ? security_file_permission+0xd8/0x100 do_iter_read+0x31b/0x880 ? import_iovec+0x10b/0x140 vfs_readv+0x12d/0x1a0 ? vfs_iter_read+0xb0/0xb0 ? rcu_is_watching+0x12/0xb0 ? rcu_is_watching+0x12/0xb0 ? lock_release+0x4b7/0x670 do_preadv+0x1b3/0x260 ? do_readv+0x370/0x370 __x64_sys_preadv2+0xef/0x150 do_syscall_64+0x39/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f5af41ad806 Code: 41 54 41 89 fc 55 44 89 c5 53 48 89 cb 48 83 ec 18 80 3d e4 dd 0d 00 00 74 7a 45 89 c1 49 89 ca 45 31 c0 b8 47 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 be 00 00 00 48 85 c0 79 4a 48 8b 0d da 55 RSP: 002b:00007ffd3145c7f0 EFLAGS: 00000246 ORIG_RAX: 0000000000000147 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5af41ad806 RDX: 0000000000000001 RSI: 00007ffd3145c850 RDI: 0000000000000003 RBP: 0000000000000008 R08: 0000000000000000 R09: 0000000000000008 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003 R13: 00007ffd3145c850 R14: 000055f5f0431dd8 R15: 0000000000000001 </TASK>
where in fact it is dm itself that attempts to allocate a bio clone with GFP_NOIO under the rcu read lock, regardless of the request type.
Fix this by getting rid of the special casing for REQ_NOWAIT, and just use the normal SRCU protected table lookup. Get rid of the bio based table locking helpers at the same time, as they are now unused.
--- drivers/md/dm.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-)
drivers/md/dm.c +2 -21
@@ -715,24 +715,6 @@ static void dm_put_live_table_fast(strucrcu_read_unlock (); } -static inline struct dm_table *dm_get_live_table_bio (struct mapped_device *md, -int *srcu_idx,blk_opf_t bio_opf) -{ -if (bio_opf &REQ_NOWAIT ) -return dm_get_live_table_fast (md); -else -return dm_get_live_table (md, srcu_idx); -} - -static inline void dm_put_live_table_bio (struct mapped_device *md,int srcu_idx, -blk_opf_t bio_opf) -{ -if (bio_opf &REQ_NOWAIT ) -dm_put_live_table_fast (md); -else -dm_put_live_table (md, srcu_idx); -} -static char *_dm_claim_ptr ="I belong to device-mapper" ;/*
@@ -1833,9 +1815,8 @@ static void dm_submit_bio(struct bio *bistruct mapped_device *md = bio->bi_bdev->bd_disk->private_data;int srcu_idx;struct dm_table *map; -blk_opf_t bio_opf = bio->bi_opf; - map =dm_get_live_table_bio (md, &srcu_idx, bio_opf); + map =dm_get_live_table (md, &srcu_idx);/* If suspended, or map not yet available, queue this IO for later */ if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) ||
@@ -1851,7 +1832,7 @@ static void dm_submit_bio(struct bio *bidm_split_and_process_bio (md, map, bio); out: -dm_put_live_table_bio (md, srcu_idx, bio_opf); +dm_put_live_table (md, srcu_idx); } static bool dm_poll_dm_io(struct dm_io *io, struct io_comp_batch *iob,
Greg Kroah-Hartman
maintainerPATCH 178/211 dm: fix a race condition in retrieve_deps
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit f6007dce0cd35d634d9be91ef3515a6385dcee16 upstream.
There's a race condition in the multipath target when retrieve_deps races with multipath_message calling dm_get_device and dm_put_device. retrieve_deps walks the list of open devices without holding any lock but multipath may add or remove devices to the list while it is running. The end result may be memory corruption or use-after-free memory access.
See this description of a UAF with multipath_message():
https://listman.redhat.com/archives/dm-devel/2022-October/052373.html
Fix this bug by introducing a new rw semaphore "devices_lock". We grab devices_lock for read in retrieve_deps and we grab it for write in dm_get_device and dm_put_device.
--- drivers/md/dm-core.h | 1 + drivers/md/dm-ioctl.c | 7 ++++++- drivers/md/dm-table.c | 32 ++++++++++++++++++++++++-------- 3 files changed, 31 insertions(+), 9 deletions(-)
drivers/md/dm-core.h +1 -0
@@ -214,6 +214,7 @@ struct dm_table {/* a list of devices used by this table */ struct list_head devices; +struct rw_semaphore devices_lock;/* events get handed up using this callback */ void (*event_fn)(void *data);
drivers/md/dm-ioctl.c +6 -1
@@ -1630,6 +1630,8 @@ static void retrieve_deps(struct dm_tablstruct dm_dev_internal *dd;struct dm_target_deps *deps; +down_read (&table->devices_lock); + deps =get_result_buffer (param, param_size, &len);/*
@@ -1644,7 +1646,7 @@ static void retrieve_deps(struct dm_tabl needed =struct_size (deps, dev, count);if (len < needed) { param->flags |=DM_BUFFER_FULL_FLAG ; -return ; + goto out; }/*
@@ -1656,6 +1658,9 @@ static void retrieve_deps(struct dm_tabl deps->dev[count++] =huge_encode_dev (dd->dm_dev->bdev->bd_dev); param->data_size = param->data_start + needed; + +out: +up_read (&table->devices_lock); }static int table_deps (struct file *filp,struct dm_ioctl *param,size_t param_size)
drivers/md/dm-table.c +24 -8
@@ -135,6 +135,7 @@ int dm_table_create(struct dm_table **rereturn -ENOMEM ;INIT_LIST_HEAD (&t->devices); +init_rwsem (&t->devices_lock);if (!num_targets) num_targets =KEYS_PER_NODE ;
@@ -359,16 +360,20 @@ int __ref dm_get_device(struct dm_targetif (dev ==disk_devt (t->md->disk))return -EINVAL ; +down_write (&t->devices_lock); + dd =find_device (&t->devices, dev);if (!dd) { dd =kmalloc (sizeof (*dd),GFP_KERNEL ); -if (!dd) -return -ENOMEM ; +if (!dd) { + r = -ENOMEM ; + goto unlock_ret_r; + } r =dm_get_table_device (t->md, dev, mode, &dd->dm_dev);if (r) {kfree (dd); -return r; + goto unlock_ret_r; }refcount_set (&dd->count,1 );
@@ -378,12 +383,17 @@ int __ref dm_get_device(struct dm_target }else if (dd->dm_dev->mode != (mode | dd->dm_dev->mode)) { r =upgrade_mode (dd, mode, t->md);if (r) -return r; + goto unlock_ret_r; }refcount_inc (&dd->count); out: +up_write (&t->devices_lock); *result = dd->dm_dev;return 0 ; + +unlock_ret_r: +up_write (&t->devices_lock); +return r; }EXPORT_SYMBOL (dm_get_device);
@@ -419,9 +429,12 @@ static int dm_set_device_limits(struct dvoid dm_put_device (struct dm_target *ti,struct dm_dev *d) {int found =0 ; -struct list_head *devices = &ti->table->devices; +struct dm_table *t = ti->table; +struct list_head *devices = &t->devices;struct dm_dev_internal *dd; +down_write (&t->devices_lock); +list_for_each_entry (dd, devices, list) {if (dd->dm_dev == d) { found =1 ;
@@ -430,14 +443,17 @@ void dm_put_device(struct dm_target *ti, }if (!found) {DMERR ("%s: device %s not in table devices list" , -dm_device_name (ti->table->md), d->name); -return ; +dm_device_name (t->md), d->name); + goto unlock_ret; }if (refcount_dec_and_test (&dd->count)) { -dm_put_table_device (ti->table->md, d); +dm_put_table_device (t->md, d);list_del (&dd->list);kfree (dd); } + +unlock_ret: +up_write (&t->devices_lock); }EXPORT_SYMBOL (dm_put_device);
Greg Kroah-Hartman
maintainerPATCH 179/211 btrfs: fix lockdep splat and potential deadlock after failure running delayed items
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit e110f8911ddb93e6f55da14ccbbe705397b30d0b upstream.
When running delayed items we are holding a delayed node's mutex and then we will attempt to modify a subvolume btree to insert/update/delete the delayed items. However if have an error during the insertions for example, btrfs_insert_delayed_items() may return with a path that has locked extent buffers (a leaf at the very least), and then we attempt to release the delayed node at __btrfs_run_delayed_items(), which requires taking the delayed node's mutex, causing an ABBA type of deadlock. This was reported by syzbot and the lockdep splat is the following:
WARNING: possible circular locking dependency detected
6.5.0-rc7-syzkaller-00024-g93f5de5f648d #0 Not tainted
------------------------------------------------------
syz-executor.2/13257 is trying to acquire lock:
ffff88801835c0c0 (&delayed_node->mutex){+.+.}-{3:3}, at: __btrfs_release_delayed_node+0x9a/0xaa0 fs/btrfs/delayed-inode.c:256
but task is already holding lock:
ffff88802a5ab8e8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_lock+0x3c/0x2a0 fs/btrfs/locking.c:198
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (btrfs-tree-00){++++}-{3:3}:
__lock_release kernel/locking/lockdep.c:5475 [inline]
lock_release+0x36f/0x9d0 kernel/locking/lockdep.c:5781
up_write+0x79/0x580 kernel/locking/rwsem.c:1625
btrfs_tree_unlock_rw fs/btrfs/locking.h:189 [inline]
btrfs_unlock_up_safe+0x179/0x3b0 fs/btrfs/locking.c:239
search_leaf fs/btrfs/ctree.c:1986 [inline]
btrfs_search_slot+0x2511/0x2f80 fs/btrfs/ctree.c:2230
btrfs_insert_empty_items+0x9c/0x180 fs/btrfs/ctree.c:4376
btrfs_insert_delayed_item fs/btrfs/delayed-inode.c:746 [inline]
btrfs_insert_delayed_items fs/btrfs/delayed-inode.c:824 [inline]
__btrfs_commit_inode_delayed_items+0xd24/0x2410 fs/btrfs/delayed-inode.c:1111
__btrfs_run_delayed_items+0x1db/0x430 fs/btrfs/delayed-inode.c:1153
flush_space+0x269/0xe70 fs/btrfs/space-info.c:723
btrfs_async_reclaim_metadata_space+0x106/0x350 fs/btrfs/space-info.c:1078
process_one_work+0x92c/0x12c0 kernel/workqueue.c:2600
worker_thread+0xa63/0x1210 kernel/workqueue.c:2751
kthread+0x2b8/0x350 kernel/kthread.c:389
ret_from_fork+0x2e/0x60 arch/x86/kernel/process.c:145
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304-> #0 (&delayed_node->mutex){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3142 [inline]
check_prevs_add kernel/locking/lockdep.c:3261 [inline]
validate_chain kernel/locking/lockdep.c:3876 [inline]
__lock_acquire+0x39ff/0x7f70 kernel/locking/lockdep.c:5144
lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5761
__mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799
__btrfs_release_delayed_node+0x9a/0xaa0 fs/btrfs/delayed-inode.c:256
btrfs_release_delayed_node fs/btrfs/delayed-inode.c:281 [inline]
__btrfs_run_delayed_items+0x2b5/0x430 fs/btrfs/delayed-inode.c:1156
btrfs_commit_transaction+0x859/0x2ff0 fs/btrfs/transaction.c:2276
btrfs_sync_file+0xf56/0x1330 fs/btrfs/file.c:1988
vfs_fsync_range fs/sync.c:188 [inline]
vfs_fsync fs/sync.c:202 [inline]
do_fsync fs/sync.c:212 [inline]
__do_sys_fsync fs/sync.c:220 [inline]
__se_sys_fsync fs/sync.c:218 [inline]
__x64_sys_fsync+0x196/0x1e0 fs/sync.c:218
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcdother info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(btrfs-tree-00);
lock(&delayed_node->mutex);
lock(btrfs-tree-00);
lock(&delayed_node->mutex);*** DEADLOCK ***
3 locks held by syz-executor.2/13257:
#0: ffff88802c1ee370 (btrfs_trans_num_writers){++++}-{0:0}, at: spin_unlock include/linux/spinlock.h:391 [inline] #0: ffff88802c1ee370 (btrfs_trans_num_writers){++++}-{0:0}, at: join_transaction+0xb87/0xe00 fs/btrfs/transaction.c:287 #1: ffff88802c1ee398 (btrfs_trans_num_extwriters){++++}-{0:0}, at: join_transaction+0xbb2/0xe00 fs/btrfs/transaction.c:288 #2: ffff88802a5ab8e8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_lock+0x3c/0x2a0 fs/btrfs/locking.c:198
stack backtrace: CPU: 0 PID: 13257 Comm: syz-executor.2 Not tainted 6.5.0-rc7-syzkaller-00024-g93f5de5f648d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x375/0x4a0 kernel/locking/lockdep.c:2195 check_prev_add kernel/locking/lockdep.c:3142 [inline] check_prevs_add kernel/locking/lockdep.c:3261 [inline] validate_chain kernel/locking/lockdep.c:3876 [inline] __lock_acquire+0x39ff/0x7f70 kernel/locking/lockdep.c:5144 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5761 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 __btrfs_release_delayed_node+0x9a/0xaa0 fs/btrfs/delayed-inode.c:256 btrfs_release_delayed_node fs/btrfs/delayed-inode.c:281 [inline] __btrfs_run_delayed_items+0x2b5/0x430 fs/btrfs/delayed-inode.c:1156 btrfs_commit_transaction+0x859/0x2ff0 fs/btrfs/transaction.c:2276 btrfs_sync_file+0xf56/0x1330 fs/btrfs/file.c:1988 vfs_fsync_range fs/sync.c:188 [inline] vfs_fsync fs/sync.c:202 [inline] do_fsync fs/sync.c:212 [inline] __do_sys_fsync fs/sync.c:220 [inline] __se_sys_fsync fs/sync.c:218 [inline] __x64_sys_fsync+0x196/0x1e0 fs/sync.c:218 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f3ad047cae9 Code: 28 00 00 00 75 (...) RSP: 002b:00007f3ad12510c8 EFLAGS: 00000246 ORIG_RAX: 000000000000004a RAX: ffffffffffffffda RBX: 00007f3ad059bf80 RCX: 00007f3ad047cae9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005 RBP: 00007f3ad04c847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f3ad059bf80 R15: 00007ffe56af92f8 </TASK> ------------[ cut here ]------------
Fix this by releasing the path before releasing the delayed node in the error path at __btrfs_run_delayed_items().
--- fs/btrfs/delayed-inode.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
fs/btrfs/delayed-inode.c +16 -3
@@ -1153,20 +1153,33 @@ static int __btrfs_run_delayed_items(str ret =__btrfs_commit_inode_delayed_items (trans, path, curr_node);if (ret) { -btrfs_release_delayed_node (curr_node); - curr_node =NULL ;btrfs_abort_transaction (trans, ret);break ; } prev_node = curr_node; curr_node =btrfs_next_delayed_node (curr_node); +/* +* See the comment below about releasing path before releasing +* node. If the commit of delayed items was successful the path +* should always be released, but in case of an error, it may +* point to locked extent buffers (a leaf at the very least). +*/ +ASSERT (path->nodes[0 ] ==NULL );btrfs_release_delayed_node (prev_node); } +/* +* Release the path to avoid a potential deadlock and lockdep splat when +* releasing the delayed node, as that requires taking the delayed node's +* mutex. If another task starts running delayed items before we take +* the mutex, it will first lock the mutex and then it may try to lock +* the same btree path (leaf). +*/ +btrfs_free_path (path); +if (curr_node)btrfs_release_delayed_node (curr_node); -btrfs_free_path (path); trans->block_rsv = block_rsv;return ret;
Greg Kroah-Hartman
maintainerPATCH 180/211 btrfs: fix a compilation error if DEBUG is defined in btree_dirty_folio
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit 5e0e879926c1ce7e1f5e0dfaacaf2d105f7d8a05 upstream.
[BUG]
After commit 72a69cd03082 ("btrfs: subpage: pack all subpage bitmaps into a larger bitmap"), the DEBUG section of btree_dirty_folio() would no longer compile.
[CAUSE]
If DEBUG is defined, we would do extra checks for btree_dirty_folio(), mostly to make sure the range we marked dirty has an extent buffer and that extent buffer is dirty.
For subpage, we need to iterate through all the extent buffers covered by that page range, and make sure they all matches the criteria.
However commit 72a69cd03082 ("btrfs: subpage: pack all subpage bitmaps into a larger bitmap") changes how we store the bitmap, we pack all the 16 bits bitmaps into a larger bitmap, which would save some space.
This means we no longer have btrfs_subpage::dirty_bitmap, instead the dirty bitmap is starting at btrfs_subpage_info::dirty_offset, and has a length of btrfs_subpage_info::bitmap_nr_bits.
[FIX]
Although I'm not sure if it still makes sense to maintain such code, at least let it compile.
This patch would let us test the bits one by one through the bitmaps.
--- fs/btrfs/disk-io.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/btrfs/disk-io.c +8 -6
@@ -525,6 +525,7 @@ static bool btree_dirty_folio(struct add struct folio *folio) {struct btrfs_fs_info *fs_info =btrfs_sb (mapping->host->i_sb); +struct btrfs_subpage_info *spi = fs_info->subpage_info;struct btrfs_subpage *subpage;struct extent_buffer *eb;int cur_bit =0 ;
@@ -538,18 +539,19 @@ static bool btree_dirty_folio(struct addbtrfs_assert_tree_write_locked (eb);return filemap_dirty_folio (mapping, folio); } + +ASSERT (spi); subpage =folio_get_private (folio); -ASSERT (subpage->dirty_bitmap); -while (cur_bit <BTRFS_SUBPAGE_BITMAP_SIZE ) { +for (cur_bit = spi->dirty_offset; + cur_bit < spi->dirty_offset + spi->bitmap_nr_bits; + cur_bit++) {unsigned long flags;u64 cur; -u16 tmp = (1 << cur_bit);spin_lock_irqsave (&subpage->lock, flags); -if (!(tmp & subpage->dirty_bitmap)) { +if (!test_bit (cur_bit, subpage->bitmaps)) {spin_unlock_irqrestore (&subpage->lock, flags); - cur_bit++;continue ; }spin_unlock_irqrestore (&subpage->lock, flags);
@@ -562,7 +564,7 @@ static bool btree_dirty_folio(struct addbtrfs_assert_tree_write_locked (eb);free_extent_buffer (eb); - cur_bit += (fs_info->nodesize >> fs_info->sectorsize_bits); + cur_bit += (fs_info->nodesize >> fs_info->sectorsize_bits) -1 ; }return filemap_dirty_folio (mapping, folio); }
Greg Kroah-Hartman
maintainerPATCH 181/211 btrfs: fix race between finishing block group creation and its item update
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 2d6cd791e63ec0c68ae95ecd55dc6c50ac7829cf upstream.
Commit 675dfe1223a6 ("btrfs: fix block group item corruption after inserting new block group") fixed one race that resulted in not persisting a block group's item when its "used" bytes field decreases to zero. However there's another race that can happen in a much shorter time window that results in the same problem. The following sequence of steps explains how it can happen:
1) Task A creates a metadata block group X, its "used" and "commit_used" fields are initialized to 0;
2) Two extents are allocated from block group X, so its "used" field is updated to 32K, and its "commit_used" field remains as 0;
3) Transaction commit starts, by some task B, and it enters btrfs_start_dirty_block_groups(). There it tries to update the block group item for block group X, which currently has its "used" field with a value of 32K and its "commit_used" field with a value of 0. However that fails since the block group item was not yet inserted, so at update_block_group_item(), the btrfs_search_slot() call returns 1, and then we set 'ret' to -ENOENT. Before jumping to the label 'fail'...
4) The block group item is inserted by task A, when for example btrfs_create_pending_block_groups() is called when releasing its transaction handle. This results in insert_block_group_item() inserting the block group item in the extent tree (or block group tree), with a "used" field having a value of 32K and setting "commit_used", in struct btrfs_block_group, to the same value (32K);
5) Task B jumps to the 'fail' label and then resets the "commit_used" field to 0. At btrfs_start_dirty_block_groups(), because -ENOENT was returned from update_block_group_item(), we add the block group again to the list of dirty block groups, so that we will try again in the critical section of the transaction commit when calling btrfs_write_dirty_block_groups();
6) Later the two extents from block group X are freed, so its "used" field becomes 0;
7) If no more extents are allocated from block group X before we get into btrfs_write_dirty_block_groups(), then when we call update_block_group_item() again for block group X, we will not update the block group item to reflect that it has 0 bytes used, because the "used" and "commit_used" fields in struct btrfs_block_group have the same value, a value of 0.
As a result after committing the transaction we have an empty block group with its block group item having a 32K value for its "used" field. This will trigger errors from fsck ("btrfs check" command) and after mounting again the fs, the cleaner kthread will not automatically delete the empty block group, since its "used" field is not 0. Possibly there are other issues due to this inconsistency.
When this issue happens, the error reported by fsck is like this:
[1/7] checking root items
[2/7] checking extents
block group [1104150528 1073741824] used 39796736 but extent items used 0
ERROR: errors found in extent allocation tree or chunk allocation (...)
So fix this by not resetting the "commit_used" field of a block group when we don't find the block group item at update_block_group_item().
--- fs/btrfs/block-group.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/btrfs/block-group.c +10 -2
@@ -3014,8 +3014,16 @@ static int update_block_group_item(strucbtrfs_mark_buffer_dirty (leaf); fail:btrfs_release_path (path); -/* We didn't update the block group item, need to revert @commit_used. */ -if (ret <0 ) { +/* +* We didn't update the block group item, need to revert commit_used +* unless the block group item didn't exist yet - this is to prevent a +* race with a concurrent insertion of the block group item, with +* insert_block_group_item(), that happened just after we attempted to +* update. In that case we would reset commit_used to 0 just after the +* insertion set it to a value greater than 0 - if the block group later +* becomes with 0 used bytes, we would incorrectly skip its update. +*/ +if (ret <0 && ret != -ENOENT ) {spin_lock (&cache->lock); cache->commit_used = old_commit_used;spin_unlock (&cache->lock);
Greg Kroah-Hartman
maintainerPATCH 182/211 btrfs: release path before inode lookup during the ino lookup ioctl
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit ee34a82e890a7babb5585daf1a6dd7d4d1cf142a upstream.
During the ino lookup ioctl we can end up calling btrfs_iget() to get an inode reference while we are holding on a root's btree. If btrfs_iget() needs to lookup the inode from the root's btree, because it's not currently loaded in memory, then it will need to lock another or the same path in the same root btree. This may result in a deadlock and trigger the following lockdep splat:
WARNING: possible circular locking dependency detected 6.5.0-rc7-syzkaller-00004-gf7757129e3de #0 Not tainted
------------------------------------------------------
syz-executor277/5012 is trying to acquire lock:
ffff88802df41710 (btrfs-tree-01){++++}-{3:3}, at: __btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136
but task is already holding lock:
ffff88802df418e8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (btrfs-tree-00){++++}-{3:3}:
down_read_nested+0x49/0x2f0 kernel/locking/rwsem.c:1645
__btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136
btrfs_search_slot+0x13a4/0x2f80 fs/btrfs/ctree.c:2302
btrfs_init_root_free_objectid+0x148/0x320 fs/btrfs/disk-io.c:4955
btrfs_init_fs_root fs/btrfs/disk-io.c:1128 [inline]
btrfs_get_root_ref+0x5ae/0xae0 fs/btrfs/disk-io.c:1338
btrfs_get_fs_root fs/btrfs/disk-io.c:1390 [inline]
open_ctree+0x29c8/0x3030 fs/btrfs/disk-io.c:3494
btrfs_fill_super+0x1c7/0x2f0 fs/btrfs/super.c:1154
btrfs_mount_root+0x7e0/0x910 fs/btrfs/super.c:1519
legacy_get_tree+0xef/0x190 fs/fs_context.c:611
vfs_get_tree+0x8c/0x270 fs/super.c:1519
fc_mount fs/namespace.c:1112 [inline]
vfs_kern_mount+0xbc/0x150 fs/namespace.c:1142
btrfs_mount+0x39f/0xb50 fs/btrfs/super.c:1579
legacy_get_tree+0xef/0x190 fs/fs_context.c:611
vfs_get_tree+0x8c/0x270 fs/super.c:1519
do_new_mount+0x28f/0xae0 fs/namespace.c:3335
do_mount fs/namespace.c:3675 [inline]
__do_sys_mount fs/namespace.c:3884 [inline]
__se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3861
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd-> #0 (btrfs-tree-01){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3142 [inline]
check_prevs_add kernel/locking/lockdep.c:3261 [inline]
validate_chain kernel/locking/lockdep.c:3876 [inline]
__lock_acquire+0x39ff/0x7f70 kernel/locking/lockdep.c:5144
lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5761
down_read_nested+0x49/0x2f0 kernel/locking/rwsem.c:1645
__btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136
btrfs_tree_read_lock fs/btrfs/locking.c:142 [inline]
btrfs_read_lock_root_node+0x292/0x3c0 fs/btrfs/locking.c:281
btrfs_search_slot_get_root fs/btrfs/ctree.c:1832 [inline]
btrfs_search_slot+0x4ff/0x2f80 fs/btrfs/ctree.c:2154
btrfs_lookup_inode+0xdc/0x480 fs/btrfs/inode-item.c:412
btrfs_read_locked_inode fs/btrfs/inode.c:3892 [inline]
btrfs_iget_path+0x2d9/0x1520 fs/btrfs/inode.c:5716
btrfs_search_path_in_tree_user fs/btrfs/ioctl.c:1961 [inline]
btrfs_ioctl_ino_lookup_user+0x77a/0xf50 fs/btrfs/ioctl.c:2105
btrfs_ioctl+0xb0b/0xd40 fs/btrfs/ioctl.c:4683
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xf8/0x170 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcdother info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
rlock(btrfs-tree-00);
lock(btrfs-tree-01);
lock(btrfs-tree-00);
rlock(btrfs-tree-01);*** DEADLOCK ***
1 lock held by syz-executor277/5012:
#0: ffff88802df418e8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136
stack backtrace: CPU: 1 PID: 5012 Comm: syz-executor277 Not tainted 6.5.0-rc7-syzkaller-00004-gf7757129e3de #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x375/0x4a0 kernel/locking/lockdep.c:2195 check_prev_add kernel/locking/lockdep.c:3142 [inline] check_prevs_add kernel/locking/lockdep.c:3261 [inline] validate_chain kernel/locking/lockdep.c:3876 [inline] __lock_acquire+0x39ff/0x7f70 kernel/locking/lockdep.c:5144 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5761 down_read_nested+0x49/0x2f0 kernel/locking/rwsem.c:1645 __btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136 btrfs_tree_read_lock fs/btrfs/locking.c:142 [inline] btrfs_read_lock_root_node+0x292/0x3c0 fs/btrfs/locking.c:281 btrfs_search_slot_get_root fs/btrfs/ctree.c:1832 [inline] btrfs_search_slot+0x4ff/0x2f80 fs/btrfs/ctree.c:2154 btrfs_lookup_inode+0xdc/0x480 fs/btrfs/inode-item.c:412 btrfs_read_locked_inode fs/btrfs/inode.c:3892 [inline] btrfs_iget_path+0x2d9/0x1520 fs/btrfs/inode.c:5716 btrfs_search_path_in_tree_user fs/btrfs/ioctl.c:1961 [inline] btrfs_ioctl_ino_lookup_user+0x77a/0xf50 fs/btrfs/ioctl.c:2105 btrfs_ioctl+0xb0b/0xd40 fs/btrfs/ioctl.c:4683 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xf8/0x170 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f0bec94ea39
Fix this simply by releasing the path before calling btrfs_iget() as at point we don't need the path anymore.
--- fs/btrfs/ioctl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/btrfs/ioctl.c +7 -1
@@ -1958,6 +1958,13 @@ static int btrfs_search_path_in_tree_use goto out_put; } +/* +* We don't need the path anymore, so release it and +* avoid deadlocks and lockdep warnings in case +* btrfs_iget() needs to lookup the inode from its root +* btree and lock the same leaf. +*/ +btrfs_release_path (path); temp_inode =btrfs_iget (sb, key2.objectid, root);if (IS_ERR (temp_inode)) { ret =PTR_ERR (temp_inode);
@@ -1978,7 +1985,6 @@ static int btrfs_search_path_in_tree_use goto out_put; } -btrfs_release_path (path); key.objectid = key.offset; key.offset = (u64)-1 ; dirid = key.objectid;
Greg Kroah-Hartman
maintainerPATCH 183/211 btrfs: check for BTRFS_FS_ERROR in pending ordered assert
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit 4ca8e03cf2bfaeef7c85939fa1ea0c749cd116ab upstream.
If we do fast tree logging we increment a counter on the current transaction for every ordered extent we need to wait for. This means we expect the transaction to still be there when we clear pending on the ordered extent. However if we happen to abort the transaction and clean it up, there could be no running transaction, and thus we'll trip the "ASSERT(trans)" check. This is obviously incorrect, and the code properly deals with the case that the transaction doesn't exist. Fix this ASSERT() to only fire if there's no trans and we don't have BTRFS_FS_ERROR() set on the file system.
--- fs/btrfs/ordered-data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/ordered-data.c +1 -1
@@ -635,7 +635,7 @@ void btrfs_remove_ordered_extent(structrefcount_inc (&trans->use_count);spin_unlock (&fs_info->trans_lock); -ASSERT (trans); +ASSERT (trans ||BTRFS_FS_ERROR (fs_info));if (trans) {if (atomic_dec_and_test (&trans->pending_ordered))wake_up (&trans->pending_wait);
Greg Kroah-Hartman
maintainerPATCH 184/211 tracing/synthetic: Fix order of struct trace_dynamic_info
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (Google) <[email protected]>
commit fc52a64416b010c8324e2cb50070faae868521c1 upstream.
To make handling BIG and LITTLE endian better the offset/len of dynamic fields of the synthetic events was changed into a structure of:
struct trace_dynamic_info {
#ifdef CONFIG_CPU_BIG_ENDIAN u16 offset; u16 len; #else u16 len; u16 offset;
#endif
};
to replace the manual changes of:
data_offset = offset & 0xffff;
data_offest = len << 16;
But if you look closely, the above is:
<len> << 16 | offset
Which in little endian would be in memory:
offset_lo offset_hi len_lo len_hi
and in big endian:
len_hi len_lo offset_hi offset_lo
Which if broken into a structure would be:
struct trace_dynamic_info {
#ifdef CONFIG_CPU_BIG_ENDIAN u16 len; u16 offset; #else u16 offset; u16 len;
#endif
};
Which is the opposite of what was defined.
Fix this and just to be safe also add "__packed".
--- include/linux/trace_events.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/trace_events.h +3 -3
@@ -62,13 +62,13 @@ void trace_event_printf(struct trace_iterator *iter, const char *fmt, ...);/* Used to find the offset and length of dynamic fields in trace events */ struct trace_dynamic_info {#ifdef CONFIG_CPU_BIG_ENDIAN -u16 offset;u16 len; +u16 offset;#else -u16 len;u16 offset; +u16 len;#endif -}; +} __packed;/* * The trace entry - the most basic unit of tracing. This is what
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 185/211 tracing: Have tracing_max_latency inc the trace array ref count
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (Google) <[email protected]>
commit 7d660c9b2bc95107f90a9f4c4759be85309a6550 upstream.
The tracing_max_latency file points to the trace_array max_latency field. For an instance, if the file is opened and the instance is deleted, reading or writing to the file will cause a use after free.
Up the ref count of the trace_array when tracing_max_latency is opened.
--- kernel/trace/trace.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
kernel/trace/trace.c +10 -5
@@ -1772,7 +1772,7 @@ static void trace_create_maxlat_file(strinit_irq_work (&tr->fsnotify_irqwork, latency_fsnotify_workfn_irq); tr->d_max_latency =trace_create_file ("tracing_max_latency" ,TRACE_MODE_WRITE , - d_tracer, &tr->max_latency, + d_tracer, tr, &tracing_max_lat_fops); }
@@ -1805,7 +1805,7 @@ void latency_fsnotify(struct trace_array#define trace_create_maxlat_file (tr, d_tracer) \ trace_create_file("tracing_max_latency", TRACE_MODE_WRITE, \ - d_tracer, &tr->max_latency, &tracing_max_lat_fops) + d_tracer, tr, &tracing_max_lat_fops)#endif
@@ -6706,14 +6706,18 @@ static ssize_t tracing_max_lat_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { - return tracing_nsecs_read(filp->private_data, ubuf, cnt, ppos); + struct trace_array *tr = filp->private_data; + +return tracing_nsecs_read (&tr->max_latency, ubuf, cnt, ppos); }static ssize_t tracing_max_lat_write (struct file *filp,const char __user *ubuf,size_t cnt,loff_t *ppos) { -return tracing_nsecs_write (filp->private_data, ubuf, cnt, ppos); +struct trace_array *tr = filp->private_data; + +return tracing_nsecs_write (&tr->max_latency, ubuf, cnt, ppos); }#endif
@@ -7770,10 +7774,11 @@ static const struct file_operations trac#ifdef CONFIG_TRACER_MAX_TRACE static const struct file_operations tracing_max_lat_fops = { - .open = tracing_open_generic, + .open = tracing_open_generic_tr, .read = tracing_max_lat_read, .write = tracing_max_lat_write, .llseek = generic_file_llseek, + .release = tracing_release_generic_tr, };#endif
Greg Kroah-Hartman
maintainerPATCH 186/211 tracing: Have event inject files inc the trace array ref count
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (Google) <[email protected]>
commit e5c624f027ac74f97e97c8f36c69228ac9f1102d upstream.
The event inject files add events for a specific trace array. For an instance, if the file is opened and the instance is deleted, reading or writing to the file will cause a use after free.
Up the ref count of the trace_array when a event inject file is opened.
--- kernel/trace/trace_events_inject.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/trace_events_inject.c +2 -1
@@ -328,7 +328,8 @@ event_inject_read(struct file *file, cha }const struct file_operations event_inject_fops = { - .open = tracing_open_generic, + .open = tracing_open_file_tr, .read = event_inject_read, .write = event_inject_write, + .release = tracing_release_file_tr, };
Greg Kroah-Hartman
maintainerPATCH 187/211 tracing/synthetic: Print out u64 values properly
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tero Kristo <[email protected]>
commit 62663b849662c1a5126b6274d91671b90566ef13 upstream.
The synth traces incorrectly print pointer to the synthetic event values instead of the actual value when using u64 type. Fix by addressing the contents of the union properly.
--- kernel/trace/trace_events_synth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_events_synth.c +1 -1
@@ -337,7 +337,7 @@ static void print_synth_event_num_val(struct trace_seq *s,break ;default : -trace_seq_printf (s, print_fmt, name, val, space); +trace_seq_printf (s, print_fmt, name, val->as_u64, space);break ; } }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 188/211 tracing: Increase trace array ref count on enable and filter files
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (Google) <[email protected]>
commit f5ca233e2e66dc1c249bf07eefa37e34a6c9346a upstream.
When the trace event enable and filter files are opened, increment the trace array ref counter, otherwise they can be accessed when the trace array is being deleted. The ref counter keeps the trace array from being deleted while those files are opened.
--- kernel/trace/trace.c | 27 +++++++++++++++++++++++++++ kernel/trace/trace.h | 2 ++ kernel/trace/trace_events.c | 6 ++++-- 3 files changed, 33 insertions(+), 2 deletions(-)
kernel/trace/trace.c +27 -0
@@ -4987,6 +4987,33 @@ int tracing_open_generic_tr(struct inodereturn 0 ; } +/* +* The private pointer of the inode is the trace_event_file. +* Update the tr ref count associated to it. +*/ +int tracing_open_file_tr (struct inode *inode,struct file *filp) +{ +struct trace_event_file *file = inode->i_private; +int ret; + + ret =tracing_check_open_get_tr (file->tr); +if (ret) +return ret; + + filp->private_data = inode->i_private; + +return 0 ; +} + +int tracing_release_file_tr (struct inode *inode,struct file *filp) +{ +struct trace_event_file *file = inode->i_private; + +trace_array_put (file->tr); + +return 0 ; +} +static int tracing_mark_open (struct inode *inode,struct file *filp) {stream_open (inode, filp);
kernel/trace/trace.h +2 -0
@@ -601,6 +601,8 @@ void tracing_reset_all_online_cpus(void)void tracing_reset_all_online_cpus_unlocked (void );int tracing_open_generic (struct inode *inode,struct file *filp);int tracing_open_generic_tr (struct inode *inode,struct file *filp); +int tracing_open_file_tr (struct inode *inode,struct file *filp); +int tracing_release_file_tr (struct inode *inode,struct file *filp);bool tracing_is_disabled (void );bool tracer_tracing_is_on (struct trace_array *tr);void tracer_tracing_on (struct trace_array *tr);
kernel/trace/trace_events.c +4 -2
@@ -2103,9 +2103,10 @@ static const struct file_operations ftra };static const struct file_operations ftrace_enable_fops = { - .open = tracing_open_generic, + .open = tracing_open_file_tr, .read = event_enable_read, .write = event_enable_write, + .release = tracing_release_file_tr, .llseek = default_llseek, };
@@ -2122,9 +2123,10 @@ static const struct file_operations ftra };static const struct file_operations ftrace_event_filter_fops = { - .open = tracing_open_generic, + .open = tracing_open_file_tr, .read = event_filter_read, .write = event_filter_write, + .release = tracing_release_file_tr, .llseek = default_llseek, };
Greg Kroah-Hartman
maintainerPATCH 189/211 tracing: Have current_trace inc the trace array ref count
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (Google) <[email protected]>
commit 9b37febc578b2e1ad76a105aab11d00af5ec3d27 upstream.
The current_trace updates the trace array tracer. For an instance, if the file is opened and the instance is deleted, reading or writing to the file will cause a use after free.
Up the ref count of the trace array when current_trace is opened.
--- kernel/trace/trace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/trace.c +2 -1
@@ -7810,10 +7810,11 @@ static const struct file_operations trac#endif static const struct file_operations set_tracer_fops = { - .open = tracing_open_generic, + .open = tracing_open_generic_tr, .read = tracing_set_trace_read, .write = tracing_set_trace_write, .llseek = generic_file_llseek, + .release = tracing_release_generic_tr, };static const struct file_operations tracing_pipe_fops = {
Greg Kroah-Hartman
maintainerPATCH 190/211 tracing: Have option files inc the trace array ref count
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (Google) <[email protected]>
commit 7e2cfbd2d3c86afcd5c26b5c4b1dd251f63c5838 upstream.
The option files update the options for a given trace array. For an instance, if the file is opened and the instance is deleted, reading or writing to the file will cause a use after free.
Up the ref count of the trace_array when an option file is opened.
--- kernel/trace/trace.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
kernel/trace/trace.c +22 -1
@@ -9007,12 +9007,33 @@ trace_options_write(struct file *filp, creturn cnt; } +static int tracing_open_options (struct inode *inode,struct file *filp) +{ +struct trace_option_dentry *topt = inode->i_private; +int ret; + + ret =tracing_check_open_get_tr (topt->tr); +if (ret) +return ret; + + filp->private_data = inode->i_private; +return 0 ; +} + +static int tracing_release_options (struct inode *inode,struct file *file) +{ +struct trace_option_dentry *topt = file->private_data; + +trace_array_put (topt->tr); +return 0 ; +}static const struct file_operations trace_options_fops = { - .open = tracing_open_generic, + .open = tracing_open_options, .read = trace_options_read, .write = trace_options_write, .llseek = generic_file_llseek, + .release = tracing_release_options, };/*
Greg Kroah-Hartman
maintainerPATCH 191/211 selinux: fix handling of empty opts in selinux_fs_context_submount()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ondrej Mosnacek <[email protected]>
commit ccf1dab96be4caed7c5235b1cfdb606ac161b996 upstream.
selinux_set_mnt_opts() relies on the fact that the mount options pointer is always NULL when all options are unset (specifically in its !selinux_initialized() branch. However, the new selinux_fs_context_submount() hook breaks this rule by allocating a new structure even if no options are set. That causes any submount created before a SELinux policy is loaded to be rejected in selinux_set_mnt_opts().
Fix this by making selinux_fs_context_submount() leave fc->security set to NULL when there are no options to be copied from the reference superblock.
--- security/selinux/hooks.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
security/selinux/hooks.c +8 -2
@@ -2748,14 +2748,20 @@ static int selinux_umount(struct vfsmounstatic int selinux_fs_context_submount (struct fs_context *fc,struct super_block *reference) { -const struct superblock_security_struct *sbsec; +const struct superblock_security_struct *sbsec =selinux_superblock (reference);struct selinux_mnt_opts *opts; +/* +* Ensure that fc->security remains NULL when no options are set +* as expected by selinux_set_mnt_opts(). +*/ +if (!(sbsec->flags & (FSCONTEXT_MNT |CONTEXT_MNT |DEFCONTEXT_MNT ))) +return 0 ; + opts =kzalloc (sizeof (*opts),GFP_KERNEL );if (!opts)return -ENOMEM ; - sbsec =selinux_superblock (reference);if (sbsec->flags &FSCONTEXT_MNT ) opts->fscontext_sid = sbsec->sid;if (sbsec->flags &CONTEXT_MNT )
Greg Kroah-Hartman
maintainerPATCH 192/211 nfsd: fix change_info in NFSv4 RENAME replies
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit fdd2630a7398191e84822612e589062063bd4f3d upstream.
nfsd sends the transposed directory change info in the RENAME reply. The source directory is in save_fh and the target is in current_fh.
--- fs/nfsd/nfs4proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4proc.c +2 -2
@@ -1024,8 +1024,8 @@ nfsd4_rename(struct svc_rqst *rqstp, str rename->rn_tname, rename->rn_tnamelen);if (status)return status; -set_change_info (&rename->rn_sinfo, &cstate->current_fh); -set_change_info (&rename->rn_tinfo, &cstate->save_fh); +set_change_info (&rename->rn_sinfo, &cstate->save_fh); +set_change_info (&rename->rn_tinfo, &cstate->current_fh);return nfs_ok; }
Greg Kroah-Hartman
maintainerPATCH 193/211 tracefs: Add missing lockdown check to tracefs_create_dir()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (Google) <[email protected]>
commit 51aab5ffceb43e05119eb059048fd75765d2bc21 upstream.
The function tracefs_create_dir() was missing a lockdown check and was called by the RV code. This gave an inconsistent behavior of this function returning success while other tracefs functions failed. This caused the inode being freed by the wrong kmem_cache.
--- fs/tracefs/inode.c | 3 +++ 1 file changed, 3 insertions(+)
fs/tracefs/inode.c +3 -0
@@ -556,6 +556,9 @@ static struct dentry *__create_dir(const*/ struct dentry *tracefs_create_dir (const char *name,struct dentry *parent) { +if (security_locked_down (LOCKDOWN_TRACEFS )) +return NULL ; +return __create_dir (name, parent, &simple_dir_inode_operations); }
Greg Kroah-Hartman
maintainerPATCH 194/211 i2c: aspeed: Reset the i2c controller when timeout occurs
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tommy Huang <[email protected]>
commit fee465150b458351b6d9b9f66084f3cc3022b88b upstream.
Reset the i2c controller when an i2c transfer timeout occurs. The remaining interrupts and device should be reset to avoid unpredictable controller behavior.
--- drivers/i2c/busses/i2c-aspeed.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-aspeed.c +5 -2
@@ -698,13 +698,16 @@ static int aspeed_i2c_master_xfer(structif (time_left ==0 ) {/* -* If timed out and bus is still busy in a multi master -* environment, attempt recovery at here. +* In a multi-master setup, if a timeout occurs, attempt +* recovery. But if the bus is idle, we still need to reset the +* i2c controller to clear the remaining interrupts. */ if (bus->multi_master && (readl (bus->base +ASPEED_I2C_CMD_REG ) &ASPEED_I2CD_BUS_BUSY_STS ))aspeed_i2c_recover_bus (bus); +else +aspeed_i2c_reset (bus);/* * If timed out and the state is still pending, drop the pending
Greg Kroah-Hartman
maintainerPATCH 195/211 ata: libata: disallow dev-initiated LPM transitions to unsupported states
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit 24e0e61db3cb86a66824531989f1df80e0939f26 upstream.
In AHCI 1.3.1, the register description for CAP.SSC:
"When cleared to ‘0’, software must not allow the HBA to initiate transitions to the Slumber state via agressive link power management nor the PxCMD.ICC field in each port, and the PxSCTL.IPM field in each port must be programmed to disallow device initiated Slumber requests."
In AHCI 1.3.1, the register description for CAP.PSC:
"When cleared to ‘0’, software must not allow the HBA to initiate transitions to the Partial state via agressive link power management nor the PxCMD.ICC field in each port, and the PxSCTL.IPM field in each port must be programmed to disallow device initiated Partial requests."
Ensure that we always set the corresponding bits in PxSCTL.IPM, such that a device is not allowed to initiate transitions to power states which are unsupported by the HBA.
DevSleep is always initiated by the HBA, however, for completeness, set the corresponding bit in PxSCTL.IPM such that agressive link power management cannot transition to DevSleep if DevSleep is not supported.
sata_link_scr_lpm() is used by libahci, ata_piix and libata-pmp. However, only libahci has the ability to read the CAP/CAP2 register to see if these features are supported. Therefore, in order to not introduce any regressions on ata_piix or libata-pmp, create flags that indicate that the respective feature is NOT supported. This way, the behavior for ata_piix and libata-pmp should remain unchanged.
This change is based on a patch originally submitted by Runa Guo-oc.
--- drivers/ata/ahci.c | 9 +++++++++ drivers/ata/libata-sata.c | 19 ++++++++++++++++--- include/linux/libata.h | 4 ++++ 3 files changed, 29 insertions(+), 3 deletions(-)
drivers/ata/ahci.c +9 -0
@@ -1883,6 +1883,15 @@ static int ahci_init_one(struct pci_develse dev_info (&pdev->dev,"SSS flag set, parallel bus scan disabled\n" ); +if (!(hpriv->cap &HOST_CAP_PART )) + host->flags |=ATA_HOST_NO_PART ; + +if (!(hpriv->cap &HOST_CAP_SSC )) + host->flags |=ATA_HOST_NO_SSC ; + +if (!(hpriv->cap2 &HOST_CAP2_SDS )) + host->flags |=ATA_HOST_NO_DEVSLP ; +if (pi.flags &ATA_FLAG_EM )ahci_reset_em (host);
drivers/ata/libata-sata.c +16 -3
@@ -396,10 +396,23 @@ int sata_link_scr_lpm(struct ata_link *lcase ATA_LPM_MED_POWER_WITH_DIPM :case ATA_LPM_MIN_POWER_WITH_PARTIAL :case ATA_LPM_MIN_POWER : -if (ata_link_nr_enabled (link) >0 ) -/* no restrictions on LPM transitions */ +if (ata_link_nr_enabled (link) >0 ) { +/* assume no restrictions on LPM transitions */ scontrol &= ~(0x7 <<8 ); -else { + +/* +* If the controller does not support partial, slumber, +* or devsleep, then disallow these transitions. +*/ +if (link->ap->host->flags &ATA_HOST_NO_PART ) + scontrol |= (0x1 <<8 ); + +if (link->ap->host->flags &ATA_HOST_NO_SSC ) + scontrol |= (0x2 <<8 ); + +if (link->ap->host->flags &ATA_HOST_NO_DEVSLP ) + scontrol |= (0x4 <<8 ); + }else {/* empty port, power off */ scontrol &= ~0xf ; scontrol |= (0x1 <<2 );
include/linux/libata.h +4 -0
@@ -222,6 +222,10 @@ enum {ATA_HOST_PARALLEL_SCAN = (1 <<2 ),/* Ports on this host can be scanned in parallel */ ATA_HOST_IGNORE_ATA = (1 <<3 ),/* Ignore ATA devices on this host. */ +ATA_HOST_NO_PART = (1 <<4 ),/* Host does not support partial */ +ATA_HOST_NO_SSC = (1 <<5 ),/* Host does not support slumber */ +ATA_HOST_NO_DEVSLP = (1 <<6 ),/* Host does not support devslp */ +/* bits 24:31 of host->flags are reserved for LLD specific flags */ /* various lengths of time */
Greg Kroah-Hartman
maintainerPATCH 196/211 ata: libahci: clear pending interrupt status
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Szuying Chen <[email protected]>
commit 737dd811a3dbfd7edd4ad2ba5152e93d99074f83 upstream.
When a CRC error occurs, the HBA asserts an interrupt to indicate an interface fatal error (PxIS.IFS). The ISR clears PxIE and PxIS, then does error recovery. If the adapter receives another SDB FIS with an error (PxIS.TFES) from the device before the start of the EH recovery process, the interrupt signaling the new SDB cannot be serviced as PxIE was cleared already. This in turn results in the HBA inability to issue any command during the error recovery process after setting PxCMD.ST to 1 because PxIS.TFES is still set.
According to AHCI 1.3.1 specifications section 6.2.2, fatal errors notified by setting PxIS.HBFS, PxIS.HBDS, PxIS.IFS or PxIS.TFES will cause the HBA to enter the ERR:Fatal state. In this state, the HBA shall not issue any new commands.
To avoid this situation, introduce the function ahci_port_clear_pending_irq() to clear pending interrupts before executing a COMRESET. This follows the AHCI 1.3.1 - section 6.2.2.2 specification.
--- drivers/ata/libahci.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-)
drivers/ata/libahci.c +23 -12
@@ -1256,6 +1256,26 @@ static ssize_t ahci_activity_show(structreturn sprintf (buf,"%d\n" , emp->blink_policy); } +static void ahci_port_clear_pending_irq (struct ata_port *ap) +{ +struct ahci_host_priv *hpriv = ap->host->private_data; +void __iomem *port_mmio =ahci_port_base (ap); +u32 tmp; + +/* clear SError */ + tmp =readl (port_mmio +PORT_SCR_ERR ); +dev_dbg (ap->host->dev,"PORT_SCR_ERR 0x%x\n" , tmp); +writel (tmp, port_mmio +PORT_SCR_ERR ); + +/* clear port IRQ */ + tmp =readl (port_mmio +PORT_IRQ_STAT ); +dev_dbg (ap->host->dev,"PORT_IRQ_STAT 0x%x\n" , tmp); +if (tmp) +writel (tmp, port_mmio +PORT_IRQ_STAT ); + +writel (1 << ap->port_no, hpriv->mmio +HOST_IRQ_STAT ); +} +static void ahci_port_init (struct device *dev,struct ata_port *ap,int port_no,void __iomem *mmio,void __iomem *port_mmio)
@@ -1270,18 +1290,7 @@ static void ahci_port_init(struct deviceif (rc)dev_warn (dev,"%s (%d)\n" , emsg, rc); -/* clear SError */ - tmp =readl (port_mmio +PORT_SCR_ERR ); -dev_dbg (dev,"PORT_SCR_ERR 0x%x\n" , tmp); -writel (tmp, port_mmio +PORT_SCR_ERR ); - -/* clear port IRQ */ - tmp =readl (port_mmio +PORT_IRQ_STAT ); -dev_dbg (dev,"PORT_IRQ_STAT 0x%x\n" , tmp); -if (tmp) -writel (tmp, port_mmio +PORT_IRQ_STAT ); - -writel (1 << port_no, mmio +HOST_IRQ_STAT ); +ahci_port_clear_pending_irq (ap);/* mark esata ports */ tmp =readl (port_mmio +PORT_CMD );
@@ -1602,6 +1611,8 @@ int ahci_do_hardreset(struct ata_link *l tf.status =ATA_BUSY ;ata_tf_to_fis (&tf,0 ,0 , d2h_fis); +ahci_port_clear_pending_irq (ap); + rc =sata_link_hardreset (link, timing, deadline, online, ahci_check_ready);
Greg Kroah-Hartman
maintainerPATCH 197/211 scsi: megaraid_sas: Fix deadlock on firmware crashdump
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxiao Bi <[email protected]>
commit 0b0747d507bffb827e40fc0f9fb5883fffc23477 upstream.
The following processes run into a deadlock. CPU 41 was waiting for CPU 29 to handle a CSD request while holding spinlock "crashdump_lock", but CPU 29 was hung by that spinlock with IRQs disabled.
PID: 17360 TASK: ffff95c1090c5c40 CPU: 41 COMMAND: "mrdiagd"
!# 0 [ffffb80edbf37b58] __read_once_size at ffffffff9b871a40 include/linux/compiler.h:185:0
!# 1 [ffffb80edbf37b58] atomic_read at ffffffff9b871a40 arch/x86/include/asm/atomic.h:27:0
!# 2 [ffffb80edbf37b58] dump_stack at ffffffff9b871a40 lib/dump_stack.c:54:0
# 3 [ffffb80edbf37b78] csd_lock_wait_toolong at ffffffff9b131ad5 kernel/smp.c:364:0
# 4 [ffffb80edbf37b78] __csd_lock_wait at ffffffff9b131ad5 kernel/smp.c:384:0
# 5 [ffffb80edbf37bf8] csd_lock_wait at ffffffff9b13267a kernel/smp.c:394:0
# 6 [ffffb80edbf37bf8] smp_call_function_many at ffffffff9b13267a kernel/smp.c:843:0
# 7 [ffffb80edbf37c50] smp_call_function at ffffffff9b13279d kernel/smp.c:867:0
# 8 [ffffb80edbf37c50] on_each_cpu at ffffffff9b13279d kernel/smp.c:976:0
# 9 [ffffb80edbf37c78] flush_tlb_kernel_range at ffffffff9b085c4b arch/x86/mm/tlb.c:742:0
#10 [ffffb80edbf37cb8] __purge_vmap_area_lazy at ffffffff9b23a1e0 mm/vmalloc.c:701:0
#11 [ffffb80edbf37ce0] try_purge_vmap_area_lazy at ffffffff9b23a2cc mm/vmalloc.c:722:0
#12 [ffffb80edbf37ce0] free_vmap_area_noflush at ffffffff9b23a2cc mm/vmalloc.c:754:0
#13 [ffffb80edbf37cf8] free_unmap_vmap_area at ffffffff9b23bb3b mm/vmalloc.c:764:0
#14 [ffffb80edbf37cf8] remove_vm_area at ffffffff9b23bb3b mm/vmalloc.c:1509:0
#15 [ffffb80edbf37d18] __vunmap at ffffffff9b23bb8a mm/vmalloc.c:1537:0
#16 [ffffb80edbf37d40] vfree at ffffffff9b23bc85 mm/vmalloc.c:1612:0
#17 [ffffb80edbf37d58] megasas_free_host_crash_buffer [megaraid_sas] at ffffffffc020b7f2 drivers/scsi/megaraid/megaraid_sas_fusion.c:3932:0 #18 [ffffb80edbf37d80] fw_crash_state_store [megaraid_sas] at ffffffffc01f804d drivers/scsi/megaraid/megaraid_sas_base.c:3291:0 #19 [ffffb80edbf37dc0] dev_attr_store at ffffffff9b56dd7b drivers/base/core.c:758:0
#20 [ffffb80edbf37dd0] sysfs_kf_write at ffffffff9b326acf fs/sysfs/file.c:144:0
#21 [ffffb80edbf37de0] kernfs_fop_write at ffffffff9b325fd4 fs/kernfs/file.c:316:0
#22 [ffffb80edbf37e20] __vfs_write at ffffffff9b29418a fs/read_write.c:480:0
#23 [ffffb80edbf37ea8] vfs_write at ffffffff9b294462 fs/read_write.c:544:0
#24 [ffffb80edbf37ee8] SYSC_write at ffffffff9b2946ec fs/read_write.c:590:0
#25 [ffffb80edbf37ee8] SyS_write at ffffffff9b2946ec fs/read_write.c:582:0
#26 [ffffb80edbf37f30] do_syscall_64 at ffffffff9b003ca9 arch/x86/entry/common.c:298:0
#27 [ffffb80edbf37f58] entry_SYSCALL_64 at ffffffff9ba001b1 arch/x86/entry/entry_64.S:238:0
PID: 17355 TASK: ffff95c1090c3d80 CPU: 29 COMMAND: "mrdiagd"
!# 0 [ffffb80f2d3c7d30] __read_once_size at ffffffff9b0f2ab0 include/linux/compiler.h:185:0
!# 1 [ffffb80f2d3c7d30] native_queued_spin_lock_slowpath at ffffffff9b0f2ab0 kernel/locking/qspinlock.c:368:0
# 2 [ffffb80f2d3c7d58] pv_queued_spin_lock_slowpath at ffffffff9b0f244b arch/x86/include/asm/paravirt.h:674:0 # 3 [ffffb80f2d3c7d58] queued_spin_lock_slowpath at ffffffff9b0f244b arch/x86/include/asm/qspinlock.h:53:0 # 4 [ffffb80f2d3c7d68] queued_spin_lock at ffffffff9b8961a6 include/asm-generic/qspinlock.h:90:0
# 5 [ffffb80f2d3c7d68] do_raw_spin_lock_flags at ffffffff9b8961a6 include/linux/spinlock.h:173:0
# 6 [ffffb80f2d3c7d68] __raw_spin_lock_irqsave at ffffffff9b8961a6 include/linux/spinlock_api_smp.h:122:0
# 7 [ffffb80f2d3c7d68] _raw_spin_lock_irqsave at ffffffff9b8961a6 kernel/locking/spinlock.c:160:0
# 8 [ffffb80f2d3c7d88] fw_crash_buffer_store [megaraid_sas] at ffffffffc01f8129 drivers/scsi/megaraid/megaraid_sas_base.c:3205:0 # 9 [ffffb80f2d3c7dc0] dev_attr_store at ffffffff9b56dd7b drivers/base/core.c:758:0
#10 [ffffb80f2d3c7dd0] sysfs_kf_write at ffffffff9b326acf fs/sysfs/file.c:144:0
#11 [ffffb80f2d3c7de0] kernfs_fop_write at ffffffff9b325fd4 fs/kernfs/file.c:316:0
#12 [ffffb80f2d3c7e20] __vfs_write at ffffffff9b29418a fs/read_write.c:480:0
#13 [ffffb80f2d3c7ea8] vfs_write at ffffffff9b294462 fs/read_write.c:544:0
#14 [ffffb80f2d3c7ee8] SYSC_write at ffffffff9b2946ec fs/read_write.c:590:0
#15 [ffffb80f2d3c7ee8] SyS_write at ffffffff9b2946ec fs/read_write.c:582:0
#16 [ffffb80f2d3c7f30] do_syscall_64 at ffffffff9b003ca9 arch/x86/entry/common.c:298:0
#17 [ffffb80f2d3c7f58] entry_SYSCALL_64 at ffffffff9ba001b1 arch/x86/entry/entry_64.S:238:0
The lock is used to synchronize different sysfs operations, it doesn't protect any resource that will be touched by an interrupt. Consequently it's not required to disable IRQs. Replace the spinlock with a mutex to fix the deadlock.
--- drivers/scsi/megaraid/megaraid_sas.h | 2 +- drivers/scsi/megaraid/megaraid_sas_base.c | 21 +++++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +1 -1
@@ -2332,7 +2332,7 @@ struct megasas_instance {u32 support_morethan256jbod;/* FW support for more than 256 PD/JBOD */ bool use_seqnum_jbod_fp;/* Added for PD sequence */ bool smp_affinity_enable; -spinlock_t crashdump_lock; +struct mutex crashdump_lock;struct megasas_register_set __iomem *reg_set;u32 __iomem *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY ];
drivers/scsi/megaraid/megaraid_sas_base.c +9 -12
@@ -3271,14 +3271,13 @@ fw_crash_buffer_store(struct device *cdestruct megasas_instance *instance = (struct megasas_instance *) shost->hostdata;int val =0 ; -unsigned long flags;if (kstrtoint (buf,0 , &val) !=0 )return -EINVAL ; -spin_lock_irqsave (&instance->crashdump_lock, flags); +mutex_lock (&instance->crashdump_lock); instance->fw_crash_buffer_offset = val; -spin_unlock_irqrestore (&instance->crashdump_lock, flags); +mutex_unlock (&instance->crashdump_lock);return strlen (buf); }
@@ -3293,24 +3292,23 @@ fw_crash_buffer_show(struct device *cdevunsigned long dmachunk =CRASH_DMA_BUF_SIZE ;unsigned long chunk_left_bytes;unsigned long src_addr; -unsigned long flags;u32 buff_offset; -spin_lock_irqsave (&instance->crashdump_lock, flags); +mutex_lock (&instance->crashdump_lock); buff_offset = instance->fw_crash_buffer_offset;if (!instance->crash_dump_buf || !((instance->fw_crash_state ==AVAILABLE ) || (instance->fw_crash_state ==COPYING ))) {dev_err (&instance->pdev->dev,"Firmware crash dump is not available\n" ); -spin_unlock_irqrestore (&instance->crashdump_lock, flags); +mutex_unlock (&instance->crashdump_lock);return -EINVAL ; }if (buff_offset > (instance->fw_crash_buffer_size * dmachunk)) {dev_err (&instance->pdev->dev,"Firmware crash dump offset is out of range\n" ); -spin_unlock_irqrestore (&instance->crashdump_lock, flags); +mutex_unlock (&instance->crashdump_lock);return 0 ; }
@@ -3322,7 +3320,7 @@ fw_crash_buffer_show(struct device *cdev src_addr = (unsigned long )instance->crash_buf[buff_offset / dmachunk] + (buff_offset % dmachunk);memcpy (buf, (void *)src_addr, size); -spin_unlock_irqrestore (&instance->crashdump_lock, flags); +mutex_unlock (&instance->crashdump_lock);return size; }
@@ -3347,7 +3345,6 @@ fw_crash_state_store(struct device *cdevstruct megasas_instance *instance = (struct megasas_instance *) shost->hostdata;int val =0 ; -unsigned long flags;if (kstrtoint (buf,0 , &val) !=0 )return -EINVAL ;
@@ -3361,9 +3358,9 @@ fw_crash_state_store(struct device *cdev instance->fw_crash_state = val;if ((val ==COPIED ) || (val ==COPY_ERROR )) { -spin_lock_irqsave (&instance->crashdump_lock, flags); +mutex_lock (&instance->crashdump_lock);megasas_free_host_crash_buffer (instance); -spin_unlock_irqrestore (&instance->crashdump_lock, flags); +mutex_unlock (&instance->crashdump_lock);if (val ==COPY_ERROR )dev_info (&instance->pdev->dev,"application failed to " "copy Firmware crash dump\n" );
@@ -7422,7 +7419,7 @@ static inline void megasas_init_ctrl_parinit_waitqueue_head (&instance->int_cmd_wait_q);init_waitqueue_head (&instance->abort_cmd_wait_q); -spin_lock_init (&instance->crashdump_lock); +mutex_init (&instance->crashdump_lock);spin_lock_init (&instance->mfi_pool_lock);spin_lock_init (&instance->hba_lock);spin_lock_init (&instance->stream_lock);
Greg Kroah-Hartman
maintainerPATCH 198/211 scsi: qla2xxx: Use raw_smp_processor_id() instead of smp_processor_id()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
commit 59f10a05b5c7b675256a66e3161741239889ff80 upstream.
The following call trace was observed:
localhost kernel: nvme nvme0: NVME-FC{0}: controller connect complete
localhost kernel: BUG: using smp_processor_id() in preemptible [00000000] code: kworker/u129:4/75092
localhost kernel: nvme nvme0: NVME-FC{0}: new ctrl: NQN "nqn.1992-08.com.netapp:sn.b42d198afb4d11ecad6d00a098d6abfa:subsystem.PR_Channel2022_RH84_subsystem_291" localhost kernel: caller is qla_nvme_post_cmd+0x216/0x1380 [qla2xxx]
localhost kernel: CPU: 6 PID: 75092 Comm: kworker/u129:4 Kdump: loaded Tainted: G B W OE --------- --- 5.14.0-70.22.1.el9_0.x86_64+debug #1
localhost kernel: Hardware name: HPE ProLiant XL420 Gen10/ProLiant XL420 Gen10, BIOS U39 01/13/2022
localhost kernel: Workqueue: nvme-wq nvme_async_event_work [nvme_core]
localhost kernel: Call Trace:
localhost kernel: dump_stack_lvl+0x57/0x7d
localhost kernel: check_preemption_disabled+0xc8/0xd0
localhost kernel: qla_nvme_post_cmd+0x216/0x1380 [qla2xxx]
Use raw_smp_processor_id() instead of smp_processor_id().
Also use queue_work() across the driver instead of queue_work_on() thus avoiding usage of smp_processor_id() when CONFIG_DEBUG_PREEMPT is enabled.
--- drivers/scsi/qla2xxx/qla_inline.h | 2 +- drivers/scsi/qla2xxx/qla_isr.c | 6 +++--- drivers/scsi/qla2xxx/qla_target.c | 3 +-- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-)
drivers/scsi/qla2xxx/qla_inline.h +1 -1
@@ -577,7 +577,7 @@ fcport_is_bigger(fc_port_t *fcport)static inline struct qla_qpair *qla_mapq_nvme_select_qpair (struct qla_hw_data *ha,struct qla_qpair *qpair) { -int cpuid =smp_processor_id (); +int cpuid =raw_smp_processor_id ();if (qpair->cpuid != cpuid && ha->qp_cpu_map[cpuid]) {
drivers/scsi/qla2xxx/qla_isr.c +3 -3
@@ -3817,7 +3817,7 @@ void qla24xx_process_response_queue(struif (!ha->flags.fw_started)return ; -if (rsp->qpair->cpuid !=smp_processor_id () || !rsp->qpair->rcv_intr) { +if (rsp->qpair->cpuid !=raw_smp_processor_id () || !rsp->qpair->rcv_intr) { rsp->qpair->rcv_intr =1 ;if (!rsp->qpair->cpu_mapped)
@@ -4308,7 +4308,7 @@ qla2xxx_msix_rsp_q(int irq, void *dev_id } ha = qpair->hw; -queue_work_on (smp_processor_id (), ha->wq, &qpair->q_work); +queue_work (ha->wq, &qpair->q_work);return IRQ_HANDLED ; }
@@ -4334,7 +4334,7 @@ qla2xxx_msix_rsp_q_hs(int irq, void *devwrt_reg_dword (®->hccr,HCCRX_CLR_RISC_INT );spin_unlock_irqrestore (&ha->hardware_lock, flags); -queue_work_on (smp_processor_id (), ha->wq, &qpair->q_work); +queue_work (ha->wq, &qpair->q_work);return IRQ_HANDLED ; }
drivers/scsi/qla2xxx/qla_target.c +1 -2
@@ -4425,8 +4425,7 @@ static int qlt_handle_cmd_for_atio(strucqueue_work_on (cmd->se_cmd.cpuid, qla_tgt_wq, &cmd->work); }else if (ha->msix_count) {if (cmd->atio.u.isp24.fcp_cmnd.rddata) -queue_work_on (smp_processor_id (), qla_tgt_wq, - &cmd->work); +queue_work (qla_tgt_wq, &cmd->work);else queue_work_on (cmd->se_cmd.cpuid, qla_tgt_wq, &cmd->work);
drivers/scsi/qla2xxx/tcm_qla2xxx.c +2 -2
@@ -310,7 +310,7 @@ static void tcm_qla2xxx_free_cmd(struct cmd->trc_flags |=TRC_CMD_DONE ;INIT_WORK (&cmd->work, tcm_qla2xxx_complete_free); -queue_work_on (smp_processor_id (), tcm_qla2xxx_free_wq, &cmd->work); +queue_work (tcm_qla2xxx_free_wq, &cmd->work); }/*
@@ -547,7 +547,7 @@ static void tcm_qla2xxx_handle_data(stru cmd->trc_flags |=TRC_DATA_IN ; cmd->cmd_in_wq =1 ;INIT_WORK (&cmd->work, tcm_qla2xxx_handle_data_work); -queue_work_on (smp_processor_id (), tcm_qla2xxx_free_wq, &cmd->work); +queue_work (tcm_qla2xxx_free_wq, &cmd->work); }static int tcm_qla2xxx_chk_dif_tags (uint32_t tag)
Greg Kroah-Hartman
maintainerPATCH 199/211 scsi: pm8001: Setup IRQs on resume
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit c91774818b041ed290df29fb1dc0725be9b12e83 upstream.
The function pm8001_pci_resume() only calls pm8001_request_irq() without calling pm8001_setup_irq(). This causes the IRQ allocation to fail, which leads all drives being removed from the system.
Fix this issue by integrating the code for pm8001_setup_irq() directly inside pm8001_request_irq() so that MSI-X setup is performed both during normal initialization and resume operations.
--- drivers/scsi/pm8001/pm8001_init.c | 51 ++++++++++++-------------------------- 1 file changed, 17 insertions(+), 34 deletions(-)
drivers/scsi/pm8001/pm8001_init.c +17 -34
@@ -275,7 +275,6 @@ static irqreturn_t pm8001_interrupt_handreturn ret; } -static u32 pm8001_setup_irq (struct pm8001_hba_info *pm8001_ha);static u32 pm8001_request_irq (struct pm8001_hba_info *pm8001_ha);/**
@@ -296,13 +295,6 @@ static int pm8001_alloc(struct pm8001_hbpm8001_dbg (pm8001_ha,INIT ,"pm8001_alloc: PHY:%x\n" , pm8001_ha->chip->n_phy); -/* Setup Interrupt */ - rc =pm8001_setup_irq (pm8001_ha); -if (rc) { -pm8001_dbg (pm8001_ha,FAIL , -"pm8001_setup_irq failed [ret: %d]\n" , rc); - goto err_out; - }/* Request Interrupt */ rc =pm8001_request_irq (pm8001_ha);if (rc)
@@ -1034,47 +1026,38 @@ static u32 pm8001_request_msix(struct pm }#endif -static u32 pm8001_setup_irq (struct pm8001_hba_info *pm8001_ha) -{ -struct pci_dev *pdev; - - pdev = pm8001_ha->pdev; - -#ifdef PM8001_USE_MSIX -if (pci_find_capability (pdev,PCI_CAP_ID_MSIX )) -return pm8001_setup_msix (pm8001_ha); -pm8001_dbg (pm8001_ha,INIT ,"MSIX not supported!!!\n" ); -#endif -return 0 ; -} -/** * pm8001_request_irq - register interrupt * @pm8001_ha: our ha struct. */ static u32 pm8001_request_irq (struct pm8001_hba_info *pm8001_ha) { -struct pci_dev *pdev; +struct pci_dev *pdev = pm8001_ha->pdev; +#ifdef PM8001_USE_MSIX int rc; - pdev = pm8001_ha->pdev; +if (pci_find_capability (pdev,PCI_CAP_ID_MSIX )) { + rc =pm8001_setup_msix (pm8001_ha); +if (rc) { +pm8001_dbg (pm8001_ha,FAIL , +"pm8001_setup_irq failed [ret: %d]\n" , rc); +return rc; + } -#ifdef PM8001_USE_MSIX -if (pdev->msix_cap &&pci_msi_enabled ()) -return pm8001_request_msix (pm8001_ha); -else { -pm8001_dbg (pm8001_ha,INIT ,"MSIX not supported!!!\n" ); - goto intx; +if (pdev->msix_cap &&pci_msi_enabled ()) +return pm8001_request_msix (pm8001_ha); } + +pm8001_dbg (pm8001_ha,INIT ,"MSIX not supported!!!\n" );#endif -intx:/* initialize the INT-X interrupt */ pm8001_ha->irq_vector[0 ].irq_id =0 ; pm8001_ha->irq_vector[0 ].drv_inst = pm8001_ha; - rc =request_irq (pdev->irq, pm8001_interrupt_handler_intx,IRQF_SHARED , - pm8001_ha->name,SHOST_TO_SAS_HA (pm8001_ha->shost)); -return rc; + +return request_irq (pdev->irq, pm8001_interrupt_handler_intx, +IRQF_SHARED , pm8001_ha->name, +SHOST_TO_SAS_HA (pm8001_ha->shost)); }/**
Greg Kroah-Hartman
maintainerPATCH 200/211 Revert "comedi: add HAS_IOPORT dependencies"
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 98a15816636044f25be4644db2a3e09fad68aaf7 upstream.
This reverts commit b5c75b68b7ded84d4c82118974ce3975a4dcaa74.
The commit makes it impossible to select configuration options that depend on COMEDI_8254, COMEDI_DAS08, COMEDI_NI_LABPC, or COMEDI_AMPLC_DIO200 options due to changing 'select' directives to 'depends on' directives and there being no other way to select those codependent configuration options.
--- drivers/comedi/Kconfig | 103 ++++++++++++++++--------------------------------- 1 file changed, 35 insertions(+), 68 deletions(-)
drivers/comedi/Kconfig +35 -68
@@ -67,7 +67,6 @@ config COMEDI_TEST config COMEDI_PARPORT tristate "Parallel port support" - depends on HAS_IOPORT help Enable support for the standard parallel port. A cheap and easy way to get a few more digital I/O lines. Steal
@@ -80,7 +79,6 @@ config COMEDI_PARPORT config COMEDI_SSV_DNP tristate "SSV Embedded Systems DIL/Net-PC support" depends on X86_32 || COMPILE_TEST - depends on HAS_IOPORT help Enable support for SSV Embedded Systems DIL/Net-PC
@@ -91,7 +89,6 @@ endif # COMEDI_MISC_DRIVERS menuconfig COMEDI_ISA_DRIVERS bool "Comedi ISA and PC/104 drivers" - depends on ISA help Enable comedi ISA and PC/104 drivers to be built
@@ -103,8 +100,7 @@ if COMEDI_ISA_DRIVERS config COMEDI_PCL711 tristate "Advantech PCL-711/711b and ADlink ACL-8112 ISA card support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for Advantech PCL-711 and 711b, ADlink ACL-8112
@@ -165,9 +161,8 @@ config COMEDI_PCL730 config COMEDI_PCL812 tristate "Advantech PCL-812/813 and ADlink ACL-8112/8113/8113/8216" - depends on HAS_IOPORT select COMEDI_ISADMA if ISA_DMA_API - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for Advantech PCL-812/PG, PCL-813/B, ADLink ACL-8112DG/HG/PG, ACL-8113, ACL-8216, ICP DAS A-821PGH/PGL/PGL-NDA,
@@ -178,9 +173,8 @@ config COMEDI_PCL812 config COMEDI_PCL816 tristate "Advantech PCL-814 and PCL-816 ISA card support" - depends on HAS_IOPORT select COMEDI_ISADMA if ISA_DMA_API - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for Advantech PCL-814 and PCL-816 ISA cards
@@ -189,9 +183,8 @@ config COMEDI_PCL816 config COMEDI_PCL818 tristate "Advantech PCL-718 and PCL-818 ISA card support" - depends on HAS_IOPORT select COMEDI_ISADMA if ISA_DMA_API - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for Advantech PCL-818 ISA cards PCL-818L, PCL-818H, PCL-818HD, PCL-818HG, PCL-818 and PCL-718
@@ -210,7 +203,7 @@ config COMEDI_PCM3724 config COMEDI_AMPLC_DIO200_ISA tristate "Amplicon PC212E/PC214E/PC215E/PC218E/PC272E" - depends on COMEDI_AMPLC_DIO200 + select COMEDI_AMPLC_DIO200 help Enable support for Amplicon PC212E, PC214E, PC215E, PC218E and PC272E ISA DIO boards
@@ -262,8 +255,7 @@ config COMEDI_DAC02 config COMEDI_DAS16M1 tristate "MeasurementComputing CIO-DAS16/M1DAS-16 ISA card support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 select COMEDI_8255 help Enable support for Measurement Computing CIO-DAS16/M1 ISA cards.
@@ -273,7 +265,7 @@ config COMEDI_DAS16M1 config COMEDI_DAS08_ISA tristate "DAS-08 compatible ISA and PC/104 card support" - depends on COMEDI_DAS08 + select COMEDI_DAS08 help Enable support for Keithley Metrabyte/ComputerBoards DAS08 and compatible ISA and PC/104 cards:
@@ -286,9 +278,8 @@ config COMEDI_DAS08_ISA config COMEDI_DAS16 tristate "DAS-16 compatible ISA and PC/104 card support" - depends on HAS_IOPORT select COMEDI_ISADMA if ISA_DMA_API - depends on COMEDI_8254 + select COMEDI_8254 select COMEDI_8255 help Enable support for Keithley Metrabyte/ComputerBoards DAS16
@@ -305,8 +296,7 @@ config COMEDI_DAS16 config COMEDI_DAS800 tristate "DAS800 and compatible ISA card support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for Keithley Metrabyte DAS800 and compatible ISA cards Keithley Metrabyte DAS-800, DAS-801, DAS-802
@@ -318,9 +308,8 @@ config COMEDI_DAS800 config COMEDI_DAS1800 tristate "DAS1800 and compatible ISA card support" - depends on HAS_IOPORT select COMEDI_ISADMA if ISA_DMA_API - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for DAS1800 and compatible ISA cards Keithley Metrabyte DAS-1701ST, DAS-1701ST-DA, DAS-1701/AO,
@@ -334,8 +323,7 @@ config COMEDI_DAS1800 config COMEDI_DAS6402 tristate "DAS6402 and compatible ISA card support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for DAS6402 and compatible ISA cards Computerboards, Keithley Metrabyte DAS6402 and compatibles
@@ -414,8 +402,7 @@ config COMEDI_FL512 config COMEDI_AIO_AIO12_8 tristate "I/O Products PC/104 AIO12-8 Analog I/O Board support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 select COMEDI_8255 help Enable support for I/O Products PC/104 AIO12-8 Analog I/O Board
@@ -469,9 +456,8 @@ config COMEDI_ADQ12B config COMEDI_NI_AT_A2150 tristate "NI AT-A2150 ISA card support" - depends on HAS_IOPORT select COMEDI_ISADMA if ISA_DMA_API - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for National Instruments AT-A2150 cards
@@ -480,8 +466,7 @@ config COMEDI_NI_AT_A2150 config COMEDI_NI_AT_AO tristate "NI AT-AO-6/10 EISA card support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for National Instruments AT-AO-6/10 cards
@@ -512,7 +497,7 @@ config COMEDI_NI_ATMIO16D config COMEDI_NI_LABPC_ISA tristate "NI Lab-PC and compatibles ISA support" - depends on COMEDI_NI_LABPC + select COMEDI_NI_LABPC help Enable support for National Instruments Lab-PC and compatibles Lab-PC-1200, Lab-PC-1200AI, Lab-PC+.
@@ -576,7 +561,7 @@ endif # COMEDI_ISA_DRIVERS menuconfig COMEDI_PCI_DRIVERS tristate "Comedi PCI drivers" - depends on PCI && HAS_IOPORT + depends on PCI help Enable support for comedi PCI drivers.
@@ -725,8 +710,7 @@ config COMEDI_ADL_PCI8164 config COMEDI_ADL_PCI9111 tristate "ADLink PCI-9111HR support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for ADlink PCI9111 cards
@@ -736,7 +720,7 @@ config COMEDI_ADL_PCI9111 config COMEDI_ADL_PCI9118 tristate "ADLink PCI-9118DG, PCI-9118HG, PCI-9118HR support" depends on HAS_DMA - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for ADlink PCI-9118DG, PCI-9118HG, PCI-9118HR cards
@@ -745,8 +729,7 @@ config COMEDI_ADL_PCI9118 config COMEDI_ADV_PCI1710 tristate "Advantech PCI-171x and PCI-1731 support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for Advantech PCI-1710, PCI-1710HG, PCI-1711, PCI-1713 and PCI-1731
@@ -790,8 +773,7 @@ config COMEDI_ADV_PCI1760 config COMEDI_ADV_PCI_DIO tristate "Advantech PCI DIO card support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 select COMEDI_8255 help Enable support for Advantech PCI DIO cards
@@ -804,7 +786,7 @@ config COMEDI_ADV_PCI_DIO config COMEDI_AMPLC_DIO200_PCI tristate "Amplicon PCI215/PCI272/PCIe215/PCIe236/PCIe296 DIO support" - depends on COMEDI_AMPLC_DIO200 + select COMEDI_AMPLC_DIO200 help Enable support for Amplicon PCI215, PCI272, PCIe215, PCIe236 and PCIe296 DIO boards.
@@ -832,8 +814,7 @@ config COMEDI_AMPLC_PC263_PCI config COMEDI_AMPLC_PCI224 tristate "Amplicon PCI224 and PCI234 support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for Amplicon PCI224 and PCI234 AO boards
@@ -842,8 +823,7 @@ config COMEDI_AMPLC_PCI224 config COMEDI_AMPLC_PCI230 tristate "Amplicon PCI230 and PCI260 support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 select COMEDI_8255 help Enable support for Amplicon PCI230 and PCI260 Multifunction I/O
@@ -862,7 +842,7 @@ config COMEDI_CONTEC_PCI_DIO config COMEDI_DAS08_PCI tristate "DAS-08 PCI support" - depends on COMEDI_DAS08 + select COMEDI_DAS08 help Enable support for PCI DAS-08 cards.
@@ -949,8 +929,7 @@ config COMEDI_CB_PCIDAS64 config COMEDI_CB_PCIDAS tristate "MeasurementComputing PCI-DAS support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 select COMEDI_8255 help Enable support for ComputerBoards/MeasurementComputing PCI-DAS with
@@ -974,8 +953,7 @@ config COMEDI_CB_PCIDDA config COMEDI_CB_PCIMDAS tristate "MeasurementComputing PCIM-DAS1602/16, PCIe-DAS1602/16 support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 select COMEDI_8255 help Enable support for ComputerBoards/MeasurementComputing PCI Migration
@@ -995,8 +973,7 @@ config COMEDI_CB_PCIMDDA config COMEDI_ME4000 tristate "Meilhaus ME-4000 support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for Meilhaus PCI data acquisition cards ME-4650, ME-4670i, ME-4680, ME-4680i and ME-4680is
@@ -1054,7 +1031,7 @@ config COMEDI_NI_670X config COMEDI_NI_LABPC_PCI tristate "NI Lab-PC PCI-1200 support" - depends on COMEDI_NI_LABPC + select COMEDI_NI_LABPC help Enable support for National Instruments Lab-PC PCI-1200.
@@ -1076,7 +1053,6 @@ config COMEDI_NI_PCIDIO config COMEDI_NI_PCIMIO tristate "NI PCI-MIO-E series and M series support" depends on HAS_DMA - depends on HAS_IOPORT select COMEDI_NI_TIOCMD select COMEDI_8255 help
@@ -1098,8 +1074,7 @@ config COMEDI_NI_PCIMIO config COMEDI_RTD520 tristate "Real Time Devices PCI4520/DM7520 support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for Real Time Devices PCI4520/DM7520
@@ -1139,8 +1114,7 @@ if COMEDI_PCMCIA_DRIVERS config COMEDI_CB_DAS16_CS tristate "CB DAS16 series PCMCIA support" - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 help Enable support for the ComputerBoards/MeasurementComputing PCMCIA cards DAS16/16, PCM-DAS16D/12 and PCM-DAS16s/16
@@ -1150,7 +1124,7 @@ config COMEDI_CB_DAS16_CS config COMEDI_DAS08_CS tristate "CB DAS08 PCMCIA support" - depends on COMEDI_DAS08 + select COMEDI_DAS08 help Enable support for the ComputerBoards/MeasurementComputing DAS-08 PCMCIA card
@@ -1160,7 +1134,6 @@ config COMEDI_DAS08_CS config COMEDI_NI_DAQ_700_CS tristate "NI DAQCard-700 PCMCIA support" - depends on HAS_IOPORT help Enable support for the National Instruments PCMCIA DAQCard-700 DIO
@@ -1169,7 +1142,6 @@ config COMEDI_NI_DAQ_700_CS config COMEDI_NI_DAQ_DIO24_CS tristate "NI DAQ-Card DIO-24 PCMCIA support" - depends on HAS_IOPORT select COMEDI_8255 help Enable support for the National Instruments PCMCIA DAQ-Card DIO-24
@@ -1179,7 +1151,7 @@ config COMEDI_NI_DAQ_DIO24_CS config COMEDI_NI_LABPC_CS tristate "NI DAQCard-1200 PCMCIA support" - depends on COMEDI_NI_LABPC + select COMEDI_NI_LABPC help Enable support for the National Instruments PCMCIA DAQCard-1200
@@ -1188,7 +1160,6 @@ config COMEDI_NI_LABPC_CS config COMEDI_NI_MIO_CS tristate "NI DAQCard E series PCMCIA support" - depends on HAS_IOPORT select COMEDI_NI_TIO select COMEDI_8255 help
@@ -1201,7 +1172,6 @@ config COMEDI_NI_MIO_CS config COMEDI_QUATECH_DAQP_CS tristate "Quatech DAQP PCMCIA data capture card support" - depends on HAS_IOPORT help Enable support for the Quatech DAQP PCMCIA data capture cards DAQP-208 and DAQP-308
@@ -1278,14 +1248,12 @@ endif # COMEDI_USB_DRIVERS config COMEDI_8254 tristate - depends on HAS_IOPORT config COMEDI_8255 tristate config COMEDI_8255_SA tristate "Standalone 8255 support" - depends on HAS_IOPORT select COMEDI_8255 help Enable support for 8255 digital I/O as a standalone driver.
@@ -1317,7 +1285,7 @@ config COMEDI_KCOMEDILIB called kcomedilib. config COMEDI_AMPLC_DIO200 - depends on COMEDI_8254 + select COMEDI_8254 tristate config COMEDI_AMPLC_PC236
@@ -1326,7 +1294,7 @@ config COMEDI_AMPLC_PC236 config COMEDI_DAS08 tristate - depends on COMEDI_8254 + select COMEDI_8254 select COMEDI_8255 config COMEDI_ISADMA
@@ -1334,8 +1302,7 @@ config COMEDI_ISADMA config COMEDI_NI_LABPC tristate - depends on HAS_IOPORT - depends on COMEDI_8254 + select COMEDI_8254 select COMEDI_8255 config COMEDI_NI_LABPC_ISADMA
Greg Kroah-Hartman
maintainerPATCH 201/211 ext4: fix rec_len verify error
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shida Zhang <[email protected]>
commit 7fda67e8c3ab6069f75888f67958a6d30454a9f6 upstream.
With the configuration PAGE_SIZE 64k and filesystem blocksize 64k, a problem occurred when more than 13 million files were directly created under a directory:
EXT4-fs error (device xx): ext4_dx_csum_set:492: inode #xxxx: comm xxxxx: dir seems corrupt? Run e2fsck -D. EXT4-fs error (device xx): ext4_dx_csum_verify:463: inode #xxxx: comm xxxxx: dir seems corrupt? Run e2fsck -D. EXT4-fs error (device xx): dx_probe:856: inode #xxxx: block 8188: comm xxxxx: Directory index failed checksum
When enough files are created, the fake_dirent->reclen will be 0xffff. it doesn't equal to the blocksize 65536, i.e. 0x10000.
But it is not the same condition when blocksize equals to 4k. when enough files are created, the fake_dirent->reclen will be 0x1000. it equals to the blocksize 4k, i.e. 0x1000.
The problem seems to be related to the limitation of the 16-bit field when the blocksize is set to 64k.
To address this, helpers like ext4_rec_len_{from,to}_disk has already been introduced to complete the conversion between the encoded and the plain form of rec_len.
So fix this one by using the helper, and all the other in this file too.
--- fs/ext4/namei.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
fs/ext4/namei.c +15 -11
@@ -343,17 +343,17 @@ static struct ext4_dir_entry_tail *get_d struct buffer_head *bh) {struct ext4_dir_entry_tail *t; +int blocksize =EXT4_BLOCK_SIZE (inode->i_sb);#ifdef PARANOID struct ext4_dir_entry *d, *top; d = (struct ext4_dir_entry *)bh->b_data; top = (struct ext4_dir_entry *)(bh->b_data + - (EXT4_BLOCK_SIZE (inode->i_sb) - -sizeof (struct ext4_dir_entry_tail ))); -while (d < top && d->rec_len) + (blocksize -sizeof (struct ext4_dir_entry_tail ))); +while (d < top &&ext4_rec_len_from_disk (d->rec_len, blocksize)) d = (struct ext4_dir_entry *)(((void *)d) + -le16_to_cpu (d->rec_len)); +ext4_rec_len_from_disk (d->rec_len, blocksize));if (d != top)return NULL ;
@@ -364,7 +364,8 @@ static struct ext4_dir_entry_tail *get_d#endif if (t->det_reserved_zero1 || -le16_to_cpu (t->det_rec_len) !=sizeof (struct ext4_dir_entry_tail ) || + (ext4_rec_len_from_disk (t->det_rec_len, blocksize) != +sizeof (struct ext4_dir_entry_tail )) || t->det_reserved_zero2 || t->det_reserved_ft !=EXT4_FT_DIR_CSUM )return NULL ;
@@ -445,13 +446,14 @@ static struct dx_countlimit *get_dx_counstruct ext4_dir_entry *dp;struct dx_root_info *root;int count_offset; +int blocksize =EXT4_BLOCK_SIZE (inode->i_sb); +unsigned int rlen =ext4_rec_len_from_disk (dirent->rec_len, blocksize); -if (le16_to_cpu (dirent->rec_len) ==EXT4_BLOCK_SIZE (inode->i_sb)) +if (rlen == blocksize) count_offset =8 ; -else if (le16_to_cpu (dirent->rec_len) ==12 ) { +else if (rlen ==12 ) { dp = (struct ext4_dir_entry *)(((void *)dirent) +12 ); -if (le16_to_cpu (dp->rec_len) != -EXT4_BLOCK_SIZE (inode->i_sb) -12 ) +if (ext4_rec_len_from_disk (dp->rec_len, blocksize) != blocksize -12 )return NULL ; root = (struct dx_root_info *)(((void *)dp +12 )); if (root->reserved_zero ||
@@ -1315,6 +1317,7 @@ static int dx_make_map(struct inode *dirunsigned int buflen = bh->b_size;char *base = bh->b_data;struct dx_hash_info h = *hinfo; +int blocksize =EXT4_BLOCK_SIZE (dir->i_sb);if (ext4_has_metadata_csum (dir->i_sb)) buflen -=sizeof (struct ext4_dir_entry_tail );
@@ -1335,11 +1338,12 @@ static int dx_make_map(struct inode *dir map_tail--; map_tail->hash = h.hash; map_tail->offs = ((char *) de - base)>>2 ; - map_tail->size =le16_to_cpu (de->rec_len); + map_tail->size =ext4_rec_len_from_disk (de->rec_len, + blocksize); count++;cond_resched (); } - de =ext4_next_entry (de, dir->i_sb->s_blocksize); + de =ext4_next_entry (de, blocksize); }return count; }
Greg Kroah-Hartman
maintainerPATCH 202/211 drm/radeon: make fence wait in suballocator uninterrruptable
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit dcbad727513d277144aee482b2ffbcd2255c37aa upstream.
Commit 254986e324ad ("drm/radeon: Use the drm suballocation manager implementation.") made the fence wait in amdgpu_sa_bo_new() interruptible but there is no code to handle an interrupt. This caused the kernel to randomly explode in high-VRAM-pressure situations so make it uninterruptible again.
--- drivers/gpu/drm/radeon/radeon_sa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_sa.c +1 -1
@@ -123,7 +123,7 @@ int radeon_sa_bo_new(struct radeon_sa_ma unsigned int size, unsigned int align) {struct drm_suballoc *sa =drm_suballoc_new (&sa_manager->base, size, -GFP_KERNEL , true, align); +GFP_KERNEL , false, align);if (IS_ERR (sa)) { *sa_bo =NULL ;
Greg Kroah-Hartman
maintainerPATCH 203/211 drm/i915: Only check eDP HPD when AUX CH is shared
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ville Syrjälä <[email protected]>
commit 7c95ec3b59479bb24093918bbfc801c9f31826f2 upstream.
Apparently Acer Chromebook C740 (BDW-ULT) doesn't have the eDP HPD line properly connected, and thus fails the new HPD check during eDP probe. The result is that we lose the eDP output.
I suspect all such machines would be Chromebooks or other Linux exclusive systems as the Windows driver likely wouldn't work either. I did check a few other BDW machines here and those do have eDP HPD connected, one of them even is a different Chromebook (Samus).
To account for these funky machines let's skip the HPD check when it looks like the eDP port is the only one using that specific AUX channel. In case of multiple ports sharing the same AUX CH (eg. on Asrock B250M-HDV) we still do the check and thus should correctly ignore the eDP port in favor of the other DP port (usually a DP->VGA converter).
v2: Don't oops during list iteration
--- drivers/gpu/drm/i915/display/intel_bios.c | 21 +++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_bios.h | 1 + drivers/gpu/drm/i915/display/intel_dp.c | 7 ++++++- 3 files changed, 28 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_bios.c +21 -0
@@ -3659,6 +3659,27 @@ enum aux_ch intel_bios_dp_aux_ch(const sreturn map_aux_ch (devdata->i915, devdata->child.aux_channel); } +bool intel_bios_dp_has_shared_aux_ch (const struct intel_bios_encoder_data *devdata) +{ +struct drm_i915_private *i915; +u8 aux_channel; +int count =0 ; + +if (!devdata || !devdata->child.aux_channel) +return false; + + i915 = devdata->i915; + aux_channel = devdata->child.aux_channel; + +list_for_each_entry (devdata, &i915->display.vbt.display_devices, node) { +if (intel_bios_encoder_supports_dp (devdata) && + aux_channel == devdata->child.aux_channel) + count++; + } + +return count >1 ; +} +int intel_bios_dp_boost_level (const struct intel_bios_encoder_data *devdata) {if (!devdata || devdata->i915->display.vbt.version <196 || !devdata->child.iboost)
drivers/gpu/drm/i915/display/intel_bios.h +1 -0
@@ -271,6 +271,7 @@ enum aux_ch intel_bios_dp_aux_ch(const sint intel_bios_dp_boost_level (const struct intel_bios_encoder_data *devdata);int intel_bios_dp_max_lane_count (const struct intel_bios_encoder_data *devdata);int intel_bios_dp_max_link_rate (const struct intel_bios_encoder_data *devdata); +bool intel_bios_dp_has_shared_aux_ch (const struct intel_bios_encoder_data *devdata);int intel_bios_hdmi_boost_level (const struct intel_bios_encoder_data *devdata);int intel_bios_hdmi_ddc_pin (const struct intel_bios_encoder_data *devdata);int intel_bios_hdmi_level_shift (const struct intel_bios_encoder_data *devdata);
drivers/gpu/drm/i915/display/intel_dp.c +6 -1
@@ -5503,8 +5503,13 @@ static bool intel_edp_init_connector(str/* * VBT and straps are liars. Also check HPD as that seems * to be the most reliable piece of information available. +* +* ... expect on devices that forgot to hook HPD up for eDP +* (eg. Acer Chromebook C710), so we'll check it only if multiple +* ports are attempting to use the same AUX CH, according to VBT. */ -if (!intel_digital_port_connected (encoder)) { +if (intel_bios_dp_has_shared_aux_ch (encoder->devdata) && + !intel_digital_port_connected (encoder)) {/* * If this fails, presume the DPCD answer came * from some other port using the same AUX CH.
Greg Kroah-Hartman
maintainerPATCH 204/211 drm/amdkfd: Insert missing TLB flush on GFX10 and later
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harish Kasiviswanathan <[email protected]>
commit edcfe22985d09ee8e2346c9217f5a52ab150099f upstream.
Heavy-weight TLB flush is required after unmap on all GPUs for correctness and security.
--- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -2
@@ -1487,8 +1487,7 @@ void kfd_flush_tlb(struct kfd_process_destatic inline bool kfd_flush_tlb_after_unmap (struct kfd_dev *dev) { -return KFD_GC_VERSION (dev) ==IP_VERSION (9 ,4 ,3 ) || -KFD_GC_VERSION (dev) ==IP_VERSION (9 ,4 ,2 ) || +return KFD_GC_VERSION (dev) >IP_VERSION (9 ,4 ,2 ) || (KFD_GC_VERSION (dev) ==IP_VERSION (9 ,4 ,1 ) && dev->sdma_fw_version >=18 ) ||KFD_GC_VERSION (dev) ==IP_VERSION (9 ,4 ,0 ); }
Greg Kroah-Hartman
maintainerPATCH 205/211 drm/tests: helpers: Avoid a driver uaf
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellström <[email protected]>
commit 139a27854bf5ce93ff9805f9f7683b88c13074dc upstream.
when using __drm_kunit_helper_alloc_drm_device() the driver may be dereferenced by device-managed resources up until the device is freed, which is typically later than the kunit-managed resource code frees it. Fix this by simply make the driver device-managed as well.
In short, the sequence leading to the UAF is as follows:
INIT:
Code allocates a struct device as a kunit-managed resource. Code allocates a drm driver as a kunit-managed resource. Code allocates a drm device as a device-managed resource.
EXIT:
Kunit resource cleanup frees the drm driver
Kunit resource cleanup puts the struct device, which starts a
device-managed resource cleanup
device-managed cleanup calls drm_dev_put() drm_dev_put() dereferences the (now freed) drm driver -> Boom.
Related KASAN message:
[55272.551542] ================================================================== [55272.551551] BUG: KASAN: slab-use-after-free in drm_dev_put.part.0+0xd4/0xe0 [drm] [55272.551603] Read of size 8 at addr ffff888127502828 by task kunit_try_catch/10353
[55272.551612] CPU: 4 PID: 10353 Comm: kunit_try_catch Tainted: G U N 6.5.0-rc7+ #155 [55272.551620] Hardware name: ASUS System Product Name/PRIME B560M-A AC, BIOS 0403 01/26/2021 [55272.551626] Call Trace: [55272.551629] <TASK> [55272.551633] dump_stack_lvl+0x57/0x90 [55272.551639] print_report+0xcf/0x630 [55272.551645] ? _raw_spin_lock_irqsave+0x5f/0x70 [55272.551652] ? drm_dev_put.part.0+0xd4/0xe0 [drm] [55272.551694] kasan_report+0xd7/0x110 [55272.551699] ? drm_dev_put.part.0+0xd4/0xe0 [drm] [55272.551742] drm_dev_put.part.0+0xd4/0xe0 [drm] [55272.551783] devres_release_all+0x15d/0x1f0 [55272.551790] ? __pfx_devres_release_all+0x10/0x10 [55272.551797] device_unbind_cleanup+0x16/0x1a0 [55272.551802] device_release_driver_internal+0x3e5/0x540 [55272.551808] ? kobject_put+0x5d/0x4b0 [55272.551814] bus_remove_device+0x1f1/0x3f0 [55272.551819] device_del+0x342/0x910 [55272.551826] ? __pfx_device_del+0x10/0x10 [55272.551830] ? lock_release+0x339/0x5e0 [55272.551836] ? kunit_remove_resource+0x128/0x290 [kunit] [55272.551845] ? __pfx_lock_release+0x10/0x10 [55272.551851] platform_device_del.part.0+0x1f/0x1e0 [55272.551856] ? _raw_spin_unlock_irqrestore+0x30/0x60 [55272.551863] kunit_remove_resource+0x195/0x290 [kunit] [55272.551871] ? _raw_spin_unlock_irqrestore+0x30/0x60 [55272.551877] kunit_cleanup+0x78/0x120 [kunit] [55272.551885] ? __kthread_parkme+0xc1/0x1f0 [55272.551891] ? __pfx_kunit_try_run_case_cleanup+0x10/0x10 [kunit] [55272.551900] ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10 [kunit] [55272.551909] kunit_generic_run_threadfn_adapter+0x4a/0x90 [kunit] [55272.551919] kthread+0x2e7/0x3c0 [55272.551924] ? __pfx_kthread+0x10/0x10 [55272.551929] ret_from_fork+0x2d/0x70 [55272.551935] ? __pfx_kthread+0x10/0x10 [55272.551940] ret_from_fork_asm+0x1b/0x30 [55272.551948] </TASK>
[55272.551953] Allocated by task 10351: [55272.551956] kasan_save_stack+0x1c/0x40 [55272.551962] kasan_set_track+0x21/0x30 [55272.551966] __kasan_kmalloc+0x8b/0x90 [55272.551970] __kmalloc+0x5e/0x160 [55272.551976] kunit_kmalloc_array+0x1c/0x50 [kunit] [55272.551984] drm_exec_test_init+0xfa/0x2c0 [drm_exec_test] [55272.551991] kunit_try_run_case+0xdd/0x250 [kunit] [55272.551999] kunit_generic_run_threadfn_adapter+0x4a/0x90 [kunit] [55272.552008] kthread+0x2e7/0x3c0 [55272.552012] ret_from_fork+0x2d/0x70 [55272.552017] ret_from_fork_asm+0x1b/0x30
[55272.552024] Freed by task 10353: [55272.552027] kasan_save_stack+0x1c/0x40 [55272.552032] kasan_set_track+0x21/0x30 [55272.552036] kasan_save_free_info+0x27/0x40 [55272.552041] __kasan_slab_free+0x106/0x180 [55272.552046] slab_free_freelist_hook+0xb3/0x160 [55272.552051] __kmem_cache_free+0xb2/0x290 [55272.552056] kunit_remove_resource+0x195/0x290 [kunit] [55272.552064] kunit_cleanup+0x78/0x120 [kunit] [55272.552072] kunit_generic_run_threadfn_adapter+0x4a/0x90 [kunit] [55272.552080] kthread+0x2e7/0x3c0 [55272.552085] ret_from_fork+0x2d/0x70 [55272.552089] ret_from_fork_asm+0x1b/0x30
[55272.552096] The buggy address belongs to the object at ffff888127502800
which belongs to the cache kmalloc-512 of size 512
[55272.552105] The buggy address is located 40 bytes inside of
freed 512-byte region [ffff888127502800, ffff888127502a00)[55272.552115] The buggy address belongs to the physical page: [55272.552119] page:00000000af6c70ff refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x127500 [55272.552127] head:00000000af6c70ff order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [55272.552133] anon flags: 0x17ffffc0010200(slab|head|node=0|zone=2|lastcpupid=0x1fffff) [55272.552141] page_type: 0xffffffff() [55272.552145] raw: 0017ffffc0010200 ffff888100042c80 0000000000000000 dead000000000001 [55272.552152] raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000 [55272.552157] page dumped because: kasan: bad access detected
[55272.552163] Memory state around the buggy address: [55272.552167] ffff888127502700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [55272.552173] ffff888127502780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [55272.552178] >ffff888127502800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [55272.552184] ^ [55272.552187] ffff888127502880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [55272.552193] ffff888127502900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [55272.552198] ================================================================== [55272.552203] Disabling lock debugging due to kernel taint
v2:
- Update commit message, add Fixes: tag and Cc stable. v3:
- Further commit message updates (Maxime Ripard).
--- include/drm/drm_kunit_helpers.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/drm/drm_kunit_helpers.h +3 -1
@@ -3,6 +3,8 @@#ifndef DRM_KUNIT_HELPERS_H_ #define DRM_KUNIT_HELPERS_H_ +#include <linux/device.h> +#include <kunit/test.h> struct drm_device ;
@@ -51,7 +53,7 @@ __drm_kunit_helper_alloc_drm_device(struct kunit *test, {struct drm_driver *driver; - driver =kunit_kzalloc (test,sizeof (*driver),GFP_KERNEL ); + driver =devm_kzalloc (dev,sizeof (*driver),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, driver); driver->driver_features = features;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 206/211 drm/amd/display: Adjust the MST resume flow
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wayne Lin <[email protected]>
commit ec5fa9fcdeca69edf7dab5ca3b2e0ceb1c08fe9a upstream.
[Why]
In drm_dp_mst_topology_mgr_resume() today, it will resume the mst branch to be ready handling mst mode and also consecutively do the mst topology probing. Which will cause the dirver have chance to fire hotplug event before restoring the old state. Then Userspace will react to the hotplug event based on a wrong state.
[How]
Adjust the mst resume flow as:
1. set dpcd to resume mst branch status
2. restore source old state
3. Do mst resume topology probing
For drm_dp_mst_topology_mgr_resume(), it's better to adjust it to pull out topology probing work into a 2nd part procedure of the mst resume. Will have a follow up patch in drm.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 93 ++++++++++++++++++---- 1 file changed, 80 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +80 -13
@@ -2329,14 +2329,62 @@ static int dm_late_init(void *handle)return detect_mst_link_for_all_connectors (adev_to_drm (adev)); } +static void resume_mst_branch_status (struct drm_dp_mst_topology_mgr *mgr) +{ +int ret; +u8 guid[16 ]; +u64 tmp64; + +mutex_lock (&mgr->lock); +if (!mgr->mst_primary) + goto out_fail; + +if (drm_dp_read_dpcd_caps (mgr->aux, mgr->dpcd) <0 ) { +drm_dbg_kms (mgr->dev,"dpcd read failed - undocked during suspend?\n" ); + goto out_fail; + } + + ret =drm_dp_dpcd_writeb (mgr->aux,DP_MSTM_CTRL , +DP_MST_EN | +DP_UP_REQ_EN | +DP_UPSTREAM_IS_SRC ); +if (ret <0 ) { +drm_dbg_kms (mgr->dev,"mst write failed - undocked during suspend?\n" ); + goto out_fail; + } + +/* Some hubs forget their guids after they resume */ + ret =drm_dp_dpcd_read (mgr->aux,DP_GUID , guid,16 ); +if (ret !=16 ) { +drm_dbg_kms (mgr->dev,"dpcd read failed - undocked during suspend?\n" ); + goto out_fail; + } + +if (memchr_inv (guid,0 ,16 ) ==NULL ) { + tmp64 =get_jiffies_64 (); +memcpy (&guid[0 ], &tmp64,sizeof (u64)); +memcpy (&guid[8 ], &tmp64,sizeof (u64)); + + ret =drm_dp_dpcd_write (mgr->aux,DP_GUID , guid,16 ); + +if (ret !=16 ) { +drm_dbg_kms (mgr->dev,"check mstb guid failed - undocked during suspend?\n" ); + goto out_fail; + } + } + +memcpy (mgr->mst_primary->guid, guid,16 ); + +out_fail: +mutex_unlock (&mgr->lock); +} +static void s3_handle_mst (struct drm_device *dev,bool suspend) {struct amdgpu_dm_connector *aconnector;struct drm_connector *connector;struct drm_connector_list_iter iter;struct drm_dp_mst_topology_mgr *mgr; -int ret; -bool need_hotplug = false;drm_connector_list_iter_begin (dev, &iter);drm_for_each_connector_iter (connector, &iter) {
@@ -2358,18 +2406,15 @@ static void s3_handle_mst(struct drm_devif (!dp_is_lttpr_present (aconnector->dc_link))try_to_configure_aux_timeout (aconnector->dc_link->ddc,LINK_AUX_DEFAULT_TIMEOUT_PERIOD ); - ret =drm_dp_mst_topology_mgr_resume (mgr, true); -if (ret <0 ) { -dm_helpers_dp_mst_stop_top_mgr (aconnector->dc_link->ctx, - aconnector->dc_link); - need_hotplug = true; - } +/* TODO: move resume_mst_branch_status() into drm mst resume again +* once topology probing work is pulled out from mst resume into mst +* resume 2nd step. mst resume 2nd step should be called after old +* state getting restored (i.e. drm_atomic_helper_resume()). +*/ +resume_mst_branch_status (mgr); } }drm_connector_list_iter_end (&iter); - -if (need_hotplug) -drm_kms_helper_hotplug_event (dev); }static int amdgpu_dm_smu_write_watermarks_table (struct amdgpu_device *adev)
@@ -2763,7 +2808,8 @@ static int dm_resume(void *handle)struct dm_atomic_state *dm_state =to_dm_atomic_state (dm->atomic_obj.state);enum dc_connection_type new_connection_type = dc_connection_none;struct dc_state *dc_state; -int i, r, j; +int i, r, j, ret; +bool need_hotplug = false;if (amdgpu_in_reset (adev)) { dc_state = dm->cached_dc_state;
@@ -2861,7 +2907,7 @@ static int dm_resume(void *handle)continue ;/* -* this is the case when traversing through already created +* this is the case when traversing through already created end sink * MST connectors, should be skipped */ if (aconnector && aconnector->mst_root)
@@ -2921,6 +2967,27 @@ static int dm_resume(void *handle) dm->cached_state =NULL ; +/* Do mst topology probing after resuming cached state*/ +drm_connector_list_iter_begin (ddev, &iter); +drm_for_each_connector_iter (connector, &iter) { + aconnector =to_amdgpu_dm_connector (connector); +if (aconnector->dc_link->type != dc_connection_mst_branch || + aconnector->mst_root) +continue ; + + ret =drm_dp_mst_topology_mgr_resume (&aconnector->mst_mgr, true); + +if (ret <0 ) { +dm_helpers_dp_mst_stop_top_mgr (aconnector->dc_link->ctx, + aconnector->dc_link); + need_hotplug = true; + } + } +drm_connector_list_iter_end (&iter); + +if (need_hotplug) +drm_kms_helper_hotplug_event (ddev); +amdgpu_dm_irq_resume_late (adev);amdgpu_dm_smu_write_watermarks_table (adev);
Greg Kroah-Hartman
maintainerPATCH 207/211 drm/amd/display: fix the white screen issue when >= 64GB DRAM
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifan Zhang <[email protected]>
commit ef064187a9709393a981a56cce1e31880fd97107 upstream.
Dropping bit 31:4 of page table base is wrong, it makes page table base points to wrong address if phys addr is beyond 64GB; dropping page_table_start/end bit 31:4 is unnecessary since dcn20_vmid_setup will do that. Also, while we are at it, cleanup the assignments using upper_32_bits()/lower_32_bits() and AMDGPU_GPU_PAGE_SHIFT.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9 -5
@@ -1272,11 +1272,15 @@ static void mmhub_read_system_context(st pt_base =amdgpu_gmc_pd_addr (adev->gart.bo); - page_table_start.high_part = (u32)(adev->gmc.gart_start >>44 ) &0xF ; - page_table_start.low_part = (u32)(adev->gmc.gart_start >>12 ); - page_table_end.high_part = (u32)(adev->gmc.gart_end >>44 ) &0xF ; - page_table_end.low_part = (u32)(adev->gmc.gart_end >>12 ); - page_table_base.high_part =upper_32_bits (pt_base) &0xF ; + page_table_start.high_part =upper_32_bits (adev->gmc.gart_start >> +AMDGPU_GPU_PAGE_SHIFT ); + page_table_start.low_part =lower_32_bits (adev->gmc.gart_start >> +AMDGPU_GPU_PAGE_SHIFT ); + page_table_end.high_part =upper_32_bits (adev->gmc.gart_end >> +AMDGPU_GPU_PAGE_SHIFT ); + page_table_end.low_part =lower_32_bits (adev->gmc.gart_end >> +AMDGPU_GPU_PAGE_SHIFT ); + page_table_base.high_part =upper_32_bits (pt_base); page_table_base.low_part =lower_32_bits (pt_base); pa_config->system_aperture.start_addr = (uint64_t )logical_addr_low <<18 ;
Greg Kroah-Hartman
maintainerPATCH 208/211 drm/amd/display: Add DPIA Link Encoder Assignment Fix
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mustapha Ghaddar <[email protected]>
commit 64be47ba286117ee4e3dd9d064c88ea2913e3269 upstream.
For DPIA we should have preferred DIG assignment based on DPIA selected as per the ASIC design.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c | 35 +++++++++++++--- drivers/gpu/drm/amd/display/dc/dc.h | 1 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 23 ++++++++++ drivers/gpu/drm/amd/display/dc/inc/core_types.h | 1 drivers/gpu/drm/amd/display/dc/link/link_factory.c | 4 + 5 files changed, 58 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c +29 -6
@@ -169,11 +169,23 @@ static void add_link_enc_assignment(/* Return first available DIG link encoder. */ static enum engine_id find_first_avail_link_enc (const struct dc_context *ctx, -const struct dc_state *state) +const struct dc_state *state, +enum engine_id eng_id_requested) {enum engine_id eng_id =ENGINE_ID_UNKNOWN ;int i; +if (eng_id_requested !=ENGINE_ID_UNKNOWN ) { + +for (i =0 ; i < ctx->dc->res_pool->res_cap->num_dig_link_enc; i++) { + eng_id = state->res_ctx.link_enc_cfg_ctx.link_enc_avail[i]; +if (eng_id == eng_id_requested) +return eng_id; + } + } + + eng_id =ENGINE_ID_UNKNOWN ; +for (i =0 ; i < ctx->dc->res_pool->res_cap->num_dig_link_enc; i++) { eng_id = state->res_ctx.link_enc_cfg_ctx.link_enc_avail[i];if (eng_id !=ENGINE_ID_UNKNOWN )
@@ -287,7 +299,7 @@ void link_enc_cfg_link_encs_assign( struct dc_stream_state *streams[], uint8_t stream_count) { -enum engine_id eng_id =ENGINE_ID_UNKNOWN ; +enum engine_id eng_id =ENGINE_ID_UNKNOWN , eng_id_req =ENGINE_ID_UNKNOWN ;int i;int j;
@@ -377,8 +389,15 @@ void link_enc_cfg_link_encs_assign(* assigned to that endpoint. */ link_enc =get_link_enc_used_by_link (state, stream->link); -if (link_enc ==NULL ) - eng_id =find_first_avail_link_enc (stream->ctx, state); +if (link_enc ==NULL ) { + +if (stream->link->ep_type ==DISPLAY_ENDPOINT_USB4_DPIA && + stream->link->dpia_preferred_eng_id !=ENGINE_ID_UNKNOWN ) + eng_id_req = stream->link->dpia_preferred_eng_id; + +if (eng_id ==ENGINE_ID_UNKNOWN ) + eng_id =find_first_avail_link_enc (stream->ctx, state, eng_id_req); + }else eng_id = link_enc->preferred_engine;
@@ -402,7 +421,9 @@ void link_enc_cfg_link_encs_assign(DC_LOG_DEBUG ("%s: CUR %s(%d) - enc_id(%d)\n" , __func__, assignment.ep_id.ep_type ==DISPLAY_ENDPOINT_PHY ?"PHY" :"DPIA" , - assignment.ep_id.link_id.enum_id -1 , + assignment.ep_id.ep_type ==DISPLAY_ENDPOINT_PHY ? + assignment.ep_id.link_id.enum_id : + assignment.ep_id.link_id.enum_id -1 , assignment.eng_id); }for (i =0 ; i <MAX_PIPES ; i++) {
@@ -413,7 +434,9 @@ void link_enc_cfg_link_encs_assign(DC_LOG_DEBUG ("%s: NEW %s(%d) - enc_id(%d)\n" , __func__, assignment.ep_id.ep_type ==DISPLAY_ENDPOINT_PHY ?"PHY" :"DPIA" , - assignment.ep_id.link_id.enum_id -1 , + assignment.ep_id.ep_type ==DISPLAY_ENDPOINT_PHY ? + assignment.ep_id.link_id.enum_id : + assignment.ep_id.link_id.enum_id -1 , assignment.eng_id); }
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -1479,6 +1479,7 @@ struct dc_link {* object creation. */ enum engine_id eng_id; +enum engine_id dpia_preferred_eng_id;bool test_pattern_enabled;union compliance_test_state compliance_test_state;
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +23 -0
@@ -1029,6 +1029,28 @@ static const struct dce_i2c_mask i2c_mas I2C_COMMON_MASK_SH_LIST_DCN30(_MASK) }; +/* ========================================================== */ + +/* +* DPIA index | Preferred Encoder | Host Router +* 0 | C | 0 +* 1 | First Available | 0 +* 2 | D | 1 +* 3 | First Available | 1 +*/ +/* ========================================================== */ +static const enum engine_id dpia_to_preferred_enc_id_table[] = { +ENGINE_ID_DIGC , +ENGINE_ID_DIGC , +ENGINE_ID_DIGD , +ENGINE_ID_DIGD +}; + +static enum engine_id dcn314_get_preferred_eng_id_dpia (unsigned int dpia_index) +{ +return dpia_to_preferred_enc_id_table[dpia_index]; +} +static struct dce_i2c_hw *dcn31_i2c_hw_create (struct dc_context *ctx,uint32_t inst)
@@ -1777,6 +1799,7 @@ static struct resource_funcs dcn314_res_ .update_bw_bounding_box = dcn314_update_bw_bounding_box, .patch_unknown_plane_state = dcn20_patch_unknown_plane_state, .get_panel_config_defaults = dcn314_get_panel_config_defaults, + .get_preferred_eng_id_dpia = dcn314_get_preferred_eng_id_dpia, }; static struct clock_source *dcn30_clock_source_create(
drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -0
@@ -65,6 +65,7 @@ struct resource_context;struct clk_bw_params ;struct resource_funcs { +enum engine_id (*get_preferred_eng_id_dpia)(unsigned int dpia_index);void (*destroy)(struct resource_pool **pool);void (*link_init)(struct dc_link *link); struct panel_cntl*(*panel_cntl_create)(
drivers/gpu/drm/amd/display/dc/link/link_factory.c +4 -0
@@ -783,6 +783,10 @@ static bool construct_dpia(struct dc_lin/* Set dpia port index : 0 to number of dpia ports */ link->ddc_hw_inst = init_params->connector_index; +// Assign Dpia preferred eng_id +if (link->dc->res_pool->funcs->get_preferred_eng_id_dpia) + link->dpia_preferred_eng_id = link->dc->res_pool->funcs->get_preferred_eng_id_dpia (link->ddc_hw_inst); +/* TODO: Create link encoder */ link->psr_settings.psr_version =DC_PSR_VERSION_UNSUPPORTED ;
Greg Kroah-Hartman
maintainerPATCH 209/211 drm/amd/display: Fix 2nd DPIA encoder Assignment
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mustapha Ghaddar <[email protected]>
commit 29319378449035c6fc6391b31a3c2cbaf75be221 upstream.
[HOW & Why]
There seems to be an issue with 2nd DPIA acquiring link encoder for tiled displays. Solution is to remove check for eng_id before we get first dynamic encoder for it
--- drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c +1 -3
@@ -395,8 +395,7 @@ void link_enc_cfg_link_encs_assign( stream->link->dpia_preferred_eng_id != ENGINE_ID_UNKNOWN) eng_id_req = stream->link->dpia_preferred_eng_id; -if (eng_id ==ENGINE_ID_UNKNOWN ) - eng_id =find_first_avail_link_enc (stream->ctx, state, eng_id_req); + eng_id =find_first_avail_link_enc (stream->ctx, state, eng_id_req); }else eng_id = link_enc->preferred_engine;
@@ -501,7 +500,6 @@ struct dc_link *link_enc_cfg_get_link_usif (stream) link = stream->link; -// dm_output_to_console("%s: No link using DIG(%d).\n", __func__, eng_id); return link; }
Greg Kroah-Hartman
maintainerPATCH 210/211 Revert "memcg: drop kmem.limit_in_bytes"
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
This reverts commit 75bb29b6c44f486e9bd048759669c205dccb2048 which is commit 86327e8eb94c52eca4f93cfece2e29d1bf52acbf upstream.
It breaks existing runc systems, as the tool always thinks the file should be present.
--- Documentation/admin-guide/cgroup-v1/memory.rst | 2 ++ mm/memcontrol.c | 10 ++++++++++ 2 files changed, 12 insertions(+)
Documentation/admin-guide/cgroup-v1/memory.rst +2 -0
@@ -92,6 +92,8 @@ Brief summary of control files. memory.oom_control set/show oom controls. memory.numa_stat show the number of memory usage per numa node + memory.kmem.limit_in_bytes This knob is deprecated and writing to + it will return -ENOTSUPP. memory.kmem.usage_in_bytes show current kernel memory allocation memory.kmem.failcnt show the number of kernel memory usage hits limits
mm/memcontrol.c +10 -0
@@ -3871,6 +3871,10 @@ static ssize_t mem_cgroup_write(struct kcase _MEMSWAP: ret =mem_cgroup_resize_max (memcg, nr_pages, true);break ; +case _KMEM: +/* kmem.limit_in_bytes is deprecated. */ + ret = -EOPNOTSUPP ; +break ;case _TCP: ret =memcg_update_tcp_max (memcg, nr_pages);break ;
@@ -5082,6 +5086,12 @@ static struct cftype mem_cgroup_legacy_f },#endif { + .name = "kmem.limit_in_bytes", + .private = MEMFILE_PRIVATE(_KMEM, RES_LIMIT), + .write = mem_cgroup_write, + .read_u64 = mem_cgroup_read_u64, + }, + { .name = "kmem.usage_in_bytes", .private = MEMFILE_PRIVATE(_KMEM, RES_USAGE), .read_u64 = mem_cgroup_read_u64,
Greg Kroah-Hartman
maintainerPATCH 211/211 drm/amdgpu: fix amdgpu_cs_p1_user_fence
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit 35588314e963938dfdcdb792c9170108399377d6 upstream.
The offset is just 32bits here so this can potentially overflow if somebody specifies a large value. Instead reduce the size to calculate the last possible offset.
The error handling path incorrectly drops the reference to the user fence BO resulting in potential reference count underflow.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +5 -15
@@ -127,7 +127,6 @@ static int amdgpu_cs_p1_user_fence(strucstruct drm_gem_object *gobj;struct amdgpu_bo *bo;unsigned long size; -int r; gobj =drm_gem_object_lookup (p->filp, data->handle);if (gobj ==NULL )
@@ -139,23 +138,14 @@ static int amdgpu_cs_p1_user_fence(strucdrm_gem_object_put (gobj); size =amdgpu_bo_size (bo); -if (size !=PAGE_SIZE || (data->offset +8 ) > size) { - r = -EINVAL ; - goto error_unref; - } - -if (amdgpu_ttm_tt_get_usermm (bo->tbo.ttm)) { - r = -EINVAL ; - goto error_unref; - } +if (size !=PAGE_SIZE || data->offset > (size -8 )) +return -EINVAL ; - *offset = data->offset; +if (amdgpu_ttm_tt_get_usermm (bo->tbo.ttm)) +return -EINVAL ; + *offset = data->offset;return 0 ; - -error_unref: -amdgpu_bo_unref (&bo); -return r; } static int amdgpu_cs_p1_bo_handles(struct amdgpu_cs_parser *p,
Hello,
Quoted 5 lines · On Wed, 20 Sep 2023 13:27:24 +0200 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.5.5 release. There are 211 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.
Quoted 8 lines
Responses should be made by Fri, 22 Sep 2023 11:28:09 +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.5.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.
This rc kernel passes DAMON functionality test[1] on my test machine. Attaching the test results summary below. Please note that I retrieved the kernel from linux-stable-rc tree[2].
[1] https://github.com/awslabs/damon-tests/tree/next/corr
[2] 9e47a110b1b5 ("Linux 6.5.5-rc1")
Thanks,
SJ
[...]
---
ok 1 selftests: damon: debugfs_attrs.sh
ok 2 selftests: damon: debugfs_schemes.sh
ok 3 selftests: damon: debugfs_target_ids.sh
ok 4 selftests: damon: debugfs_empty_targets.sh
ok 5 selftests: damon: debugfs_huge_count_read_write.sh
ok 6 selftests: damon: debugfs_duplicate_context_creation.sh
ok 7 selftests: damon: debugfs_rm_non_contexts.sh
ok 8 selftests: damon: sysfs.sh
ok 9 selftests: damon: sysfs_update_removed_scheme_dir.sh
ok 10 selftests: damon: reclaim.sh
ok 11 selftests: damon: lru_sort.sh
ok 1 selftests: damon-tests: kunit.sh
ok 2 selftests: damon-tests: huge_count_read_write.sh
ok 3 selftests: damon-tests: buffer_overflow.sh
ok 4 selftests: damon-tests: rm_contexts.sh
ok 5 selftests: damon-tests: record_null_deref.sh
ok 6 selftests: damon-tests: dbgfs_target_ids_read_before_terminate_race.sh ok 7 selftests: damon-tests: dbgfs_target_ids_pid_leak.sh
ok 8 selftests: damon-tests: damo_tests.sh
ok 9 selftests: damon-tests: masim-record.sh
ok 10 selftests: damon-tests: build_i386.sh
ok 11 selftests: damon-tests: build_m68k.sh
ok 12 selftests: damon-tests: build_arm64.sh
ok 13 selftests: damon-tests: build_i386_idle_flag.sh
ok 14 selftests: damon-tests: build_i386_highpte.sh
ok 15 selftests: damon-tests: build_nomemcg.sh
[33m
[92mPASS [39m
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.5 release. There are 211 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 Fri, 22 Sep 2023 11:28:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.5 release. There are 211 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 Fri, 22 Sep 2023 11:28:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.5 release. There are 211 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 Fri, 22 Sep 2023 11:28:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.5 release. There are 211 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 Fri, 22 Sep 2023 11:28:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.5 release. There are 211 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.
Successfully compiled and installed bindeb-pkgs on my computer (Acer Aspire E15, Intel Core i3 Haswell). No noticeable regressions.
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.5 release. There are 211 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.
Thanks,
Conor.
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.5 release. There are 211 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 Fri, 22 Sep 2023 11:28:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 6.5.5-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-6.5.y
* git commit: 9e47a110b1b588900a2455918785c47d03dc01f0
* git describe: v6.5.4-212-g9e47a110b1b5
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.5.y/build/v6.5.4-212-g9e47a110b1b5
## Test Regressions (compared to v6.5.4)
## Metric Regressions (compared to v6.5.4)
## Test Fixes (compared to v6.5.4)
## Metric Fixes (compared to v6.5.4)
## Test result summary
total: 127706, pass: 110002, fail: 1740, skip: 15783, xfail: 181
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 145 total, 144 passed, 1 failed
* arm64: 53 total, 51 passed, 2 failed
* i386: 41 total, 41 passed, 0 failed
* mips: 30 total, 28 passed, 2 failed
* parisc: 4 total, 4 passed, 0 failed
* powerpc: 38 total, 36 passed, 2 failed
* riscv: 26 total, 24 passed, 2 failed
* s390: 16 total, 13 passed, 3 failed
* sh: 14 total, 12 passed, 2 failed
* sparc: 8 total, 8 passed, 0 failed
* x86_64: 46 total, 43 passed, 3 failed
## Test suites summary
* boot
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-user_events
* kselftest-vDSO
* kselftest-vm
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* perf
* rcutorture
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.5 release. There are 211 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 Fri, 22 Sep 2023 11:28:09 +0000. Anything received after that time might be too late.
Build results:
total: 157 pass: 157 fail: 0 Qemu test results: total: 530 pass: 530 fail: 0
Note that there is a new lockdep warning, inherited from mainline.
[ 11.144387] INFO: trying to register non-static key. [ 11.144483] The code is fine but needs lockdep annotation, or maybe [ 11.144568] you didn't initialize this object before use? [ 11.144640] turning off the locking correctness validator. [ 11.144845] CPU: 2 PID: 688 Comm: ip Tainted: G N 6.6.0-rc2 #1 [ 11.144956] Hardware name: Allwinner sun8i Family [ 11.145137] unwind_backtrace from show_stack+0x10/0x14 [ 11.145610] show_stack from dump_stack_lvl+0x68/0x90 [ 11.145692] dump_stack_lvl from register_lock_class+0x99c/0x9b0 [ 11.145779] register_lock_class from __lock_acquire+0x6c/0x2244 [ 11.145861] __lock_acquire from lock_acquire+0x11c/0x368 [ 11.145938] lock_acquire from stmmac_get_stats64+0x350/0x374 [ 11.146021] stmmac_get_stats64 from dev_get_stats+0x3c/0x160
...
I didn't bisect, but it looks like it was introduced by commit a828c9b08531 ("net: stmmac: use per-queue 64 bit statistics where necessary").
Guenter
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.5 release. There are 211 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.
Quoted 8 lines
Responses should be made by Fri, 22 Sep 2023 11:28:09 +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.5.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.
For RCU,
thanks,
- Joel
Quoted 946 lines
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:Greg Kroah-Hartman <[email protected]>
Linux 6.5.5-rc1Christian König <[email protected]>
drm/amdgpu: fixamdgpu_cs_p1_user_fenceGreg Kroah-Hartman <[email protected]>
Revert "memcg: drop kmem.limit_in_bytes"Mustapha Ghaddar <[email protected]>
drm/amd/display: Fix 2nd DPIA encoder AssignmentMustapha Ghaddar <[email protected]>
drm/amd/display: Add DPIA Link Encoder Assignment FixYifan Zhang <[email protected]>
drm/amd/display: fix the white screen issue when >= 64GB DRAMWayne Lin <[email protected]>
drm/amd/display: Adjust the MST resume flowThomas Hellström <[email protected]>
drm/tests: helpers: Avoid a driver uafHarish Kasiviswanathan <[email protected]>
drm/amdkfd: Insert missing TLB flush on GFX10 and laterVille Syrjälä <[email protected]>
drm/i915: Only check eDP HPD when AUX CH is sharedAlex Deucher <[email protected]>
drm/radeon: make fence wait in suballocator uninterrruptableShida Zhang <[email protected]>
ext4: fixrec_lenverify errorIan Abbott <[email protected]>
Revert "comedi: addHAS_IOPORTdependencies"Damien Le Moal <[email protected]>
scsi: pm8001: Setup IRQs on resumeNilesh Javali <[email protected]>
scsi: qla2xxx: Useraw_smp_processor_id()instead ofsmp_processor_id()Junxiao Bi <[email protected]>
scsi:megaraid_sas: Fix deadlock on firmware crashdumpSzuying Chen <[email protected]>
ata: libahci: clear pending interrupt statusNiklas Cassel <[email protected]>
ata: libata: disallow dev-initiated LPM transitions to unsupported statesTommy Huang <[email protected]>
i2c: aspeed: Reset the i2c controller when timeout occursSteven Rostedt (Google) <[email protected]>
tracefs: Add missing lockdown check totracefs_create_dir()Jeff Layton <[email protected]>
nfsd: fixchange_infoin NFSv4 RENAME repliesOndrej Mosnacek <[email protected]>
selinux: fix handling of empty opts inselinux_fs_context_submount()Steven Rostedt (Google) <[email protected]>
tracing: Have option files inc the trace array ref countSteven Rostedt (Google) <[email protected]>
tracing: Havecurrent_traceinc the trace array ref countSteven Rostedt (Google) <[email protected]>
tracing: Increase trace array ref count on enable and filter filesTero Kristo <[email protected]>
tracing/synthetic: Print out u64 values properlySteven Rostedt (Google) <[email protected]>
tracing: Have event inject files inc the trace array ref countSteven Rostedt (Google) <[email protected]>
tracing: Havetracing_max_latencyinc the trace array ref countSteven Rostedt (Google) <[email protected]>
tracing/synthetic: Fix order of structtrace_dynamic_infoJosef Bacik <[email protected]>
btrfs: check forBTRFS_FS_ERRORin pending ordered assertFilipe Manana <[email protected]>
btrfs: release path before inode lookup during the ino lookup ioctlFilipe Manana <[email protected]>
btrfs: fix race between finishing block group creation and its item updateQu Wenruo <[email protected]>
btrfs: fix a compilation error if DEBUG is defined inbtree_dirty_folioFilipe Manana <[email protected]>
btrfs: fix lockdep splat and potential deadlock after failure running delayed itemsMikulas Patocka <[email protected]>
dm: fix a race condition inretrieve_depsJens Axboe <[email protected]>
dm: don't attempt to queue IO under RCU protectionHamza Mahfooz <[email protected]>
Revert "drm/amd: Disable S/G for APUs when 64GB or more host memory"Simon Pilkington <[email protected]>
drm/amd: Make fence wait in suballocator uninterruptibleMariusz Tkaczyk <[email protected]>
md: Put the right device inmd_seq_nextTakashi Sakamoto <[email protected]>
Revert "firewire: core: obsolete usage ofGFP_ATOMICat building node tree"Steve Wahl <[email protected]>
x86/platform/uv: Use alternate source for socket to node dataKeith Busch <[email protected]>
nvme: avoid bogus CRTO valuesPavel Begunkov <[email protected]>
io_uring/net: fix iter retargeting for selected bufAmir Goldstein <[email protected]>
ovl: fix incorrectfdput()on aio completionAmir Goldstein <[email protected]>
ovl: fix failed copyup of fileattr on a symlinkChristian Brauner <[email protected]>
attr: block mode changes of symlinksTrond Myklebust <[email protected]>
Revert "SUNRPC: Fail faster on bad verifier"Nigel Croxon <[email protected]>
md/raid1: fix error: ISO C90 forbids mixed declarationsChengming Zhou <[email protected]>
blk-mq: fix tags UAF when shrinking q->nr_hw_queuesChengming Zhou <[email protected]>
blk-mq: prealloc tags when increase tagsetnr_hw_queuesArnd Bergmann <[email protected]>
samples/hw_breakpoint: fix building without module unloadingSong Liu <[email protected]>
x86/purgatory: Remove LTO flagsKirill A. Shutemov <[email protected]>
x86/boot/compressed: Reserve more memory for page tablesNiklas Cassel <[email protected]>
ata: libata-core: fetch sense data for successful commands iff CDL enabledHannes Reinecke <[email protected]>
ata: libata: remove references to non-existingerror_handler()Lukas Wunner <[email protected]>
panic: Reenable preemption in WARN slowpathJinjie Ruan <[email protected]>
scsi: lpfc: Fix the NULL vsIS_ERR()bug fordebugfs_create_file()David Disseldorp <[email protected]>
scsi: target: core: Fixtarget_cmd_counterleakRicardo Neri <[email protected]>
x86/sched: Restore theSD_ASYM_PACKINGflag in the DIE domainSong Shuai <[email protected]>
riscv: kexec: Align the kexeced kernel entryPeter Zijlstra <[email protected]>
x86/ibt: Avoid duplicate ENDBR in __put_user_nocheck*()Peter Zijlstra <[email protected]>
x86/ibt: Suppress spurious ENDBRMasami Hiramatsu (Google) <[email protected]>
selftests: tracing: Fix to unmount tracefs for recovering environmentChen Yu <[email protected]>
PM: hibernate: Fix the exclusive get block device intest_resumemodeHeinrich Schuchardt <[email protected]>
efivarfs: fixstatfs()on efivarfsYu Kuai <[email protected]>
md: fix warning for holder mismatch fromexport_rdev()Yu Kuai <[email protected]>
md: don't dereference mddev afterexport_rdev()Jinjie Ruan <[email protected]>
scsi: qla2xxx: Fix NULL vsIS_ERR()bug fordebugfs_create_dir()Jinjie Ruan <[email protected]>
drm: gm12u320: Fix the timeout usage forusb_bulk_msg()Varun Prakash <[email protected]>
nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()Anand Jain <[email protected]>
btrfs: compare the correct fsid/metadata_uuid inbtrfs_validate_superAnand Jain <[email protected]>
btrfs: add a helper to read the superblockmetadata_uuidTakahiro Kuwano <[email protected]>
mtd: spi-nor: spansion: preserve CFR2V[7] when writing MEMLATTakahiro Kuwano <[email protected]>
mtd: spi-nor: spansion: use CLPEF as an alternative to CLSRNaohiro Aota <[email protected]>
btrfs: zoned: activate metadata block group on write timeNaohiro Aota <[email protected]>
btrfs: zoned: defer advancing meta write pointerNaohiro Aota <[email protected]>
btrfs: zoned: return int frombtrfs_check_meta_write_pointerNaohiro Aota <[email protected]>
btrfs: zoned: introduce block group context tobtrfs_eb_write_contextNaohiro Aota <[email protected]>
btrfs: introduce struct to consolidate extent buffer write contextBaokun Li <[email protected]>
ext4: fix BUG inext4_mb_new_inode_pa()due to overflowJohn Ogness <[email protected]>
printk: Renameabandon_console_lock_in_panic()toother_cpu_in_panic()John Ogness <[email protected]>
printk: Consolidate console deferred printingJohn Ogness <[email protected]>
printk: Do not take console lock forconsole_flush_on_panic()John Ogness <[email protected]>
printk: Keep non-panic-CPUs out of console lockJohn Ogness <[email protected]>
printk: Reduceconsole_unblank()usage in unsafe scenariosDmitry Baryshkov <[email protected]>
usb: typec: qcom-pmic-typec: registerdrm_bridgeRob Clark <[email protected]>
interconnect: Fix locking for runpm vs reclaimZhen Lei <[email protected]>
kobject: Add sanity check for kset->kobj.ktype in kset_register()Sakari Ailus <[email protected]>
media: pci: ipu3-cio2: Initialise timing struct to avoid a compiler warningXu Yang <[email protected]>
usb: chipidea: add workaround for chipidea PEC bugXu Yang <[email protected]>
usb: ehci: add workaround for chipidea PORTSC.PEC bugLadislav Michl <[email protected]>
usb: dwc3: dwc3-octeon: Verify clock dividerBaoquan He <[email protected]>
misc: open-dice: makeOPEN_DICEdepend onHAS_IOMEMChristophe Leroy <[email protected]>
serial:cpm_uart: Avoid suspicious lockingKonstantin Shelekhin <[email protected]>
scsi: target: iscsi: Fix buffer overflow inlio_target_nacl_info_show()Chenyuan Mi <[email protected]>
tools: iio:iio_generic_buffer: Fix some integer type and calculationMa Ke <[email protected]>
usb: gadget:fsl_qe_udc: validate endpoint index for ch9 udcMadhu M <[email protected]>
usb: typec:intel_pmc_mux: Add new ACPI ID for Lunar Lake IOM deviceXiaolei Wang <[email protected]>
usb: cdns3: Put the cdns set active part outside the spin lockHans Verkuil <[email protected]>
media: pci: cx23885: replace BUG with error returnHans Verkuil <[email protected]>
media: tuners: qt1010: replaceBUG_ONwith a regular errorJustin Tee <[email protected]>
scsi: lpfc: Abort outstanding ELS cmds when mailbox timeout error is detectedZhang Shurong <[email protected]>
media: dvb-usb-v2: gl861: Fix null-ptr-deref in gl861_i2c_master_xferZhang Shurong <[email protected]>
media: az6007: Fix null-ptr-deref in az6007_i2c_xfer()Zhang Shurong <[email protected]>
media: anysee: fix null-ptr-deref inanysee_master_xferZhang Shurong <[email protected]>
media: af9005: Fix null-ptr-deref in af9005_i2c_xferZhang Shurong <[email protected]>
media: dw2102: Fix null-ptr-deref in dw2102_i2c_transfer()Zhang Shurong <[email protected]>
media: dvb-usb-v2: af9035: Fix null-ptr-deref in af9035_i2c_master_xferLu Hongfei <[email protected]>
media: mdp3: Fix resource leaks inof_find_device_by_nodeYong-Xuan Wang <[email protected]>
PCI: fu740: Set the number of MSI vectorsNirmal Patel <[email protected]>
PCI: vmd: Disable bridge window for domain resetruanjinjie <[email protected]>
powerpc/pseries: fix possible memory leak inibmebus_bus_init()Mårten Lindahl <[email protected]>
ARM: 9317/1: kexec: Make smp stop calls asynchronousMark Brown <[email protected]>
PCI: dwc: Provide deinit callback for i.MXBaokun Li <[email protected]>
ext4: avoid overlapping preallocations due to overflowBaokun Li <[email protected]>
ext4: add two helper functionsextent_logical_end()andpa_logical_end()Liu Shixin via Jfs-discussion <[email protected]>
jfs: fix invalid free of JFS_IP(ipimap)->i_imap in diUnmountAndrew Kanner <[email protected]>
fs/jfs: prevent double-free indbUnmount()after failedjfs_remount()Mateusz Guzik <[email protected]>
x86: bring back rep movsq for user access on CPUs without ERMSVijendar Mukunda <[email protected]>
ASoC: SOF: amd: clear panic mask status when panic occursChengming Zhou <[email protected]>
blk-mq: fix tags leak when shrinknr_hw_queuesGeorg Ottinger <[email protected]>
ext2: fix datatype of block number inext2_xattr_set2()Zhang Shurong <[email protected]>
md: raid1: fix potential OOB inraid1_remove_disk()Konrad Dybcio <[email protected]>
arm64: dts: qcom: sc8280xp-x13s: Add camera activity LEDTony Lindgren <[email protected]>
bus: ti-sysc: Configure uart quirks for k3 SoCAngeloGioacchino Del Regno <[email protected]>
drm/mediatek: dp: Change logging to dev formtk_dp_aux_transfer()Jens Axboe <[email protected]>
io_uring: annotate the structio_kiocbslab for appropriate user copyTuo Li <[email protected]>
drm/exynos: fix a possible null-pointer dereference due to data race inexynos_drm_crtc_atomic_disable()Rob Clark <[email protected]>
drm/msm/adreno: Use quirk to identify cached-coherent supportRob Clark <[email protected]>
drm/msm/adreno: Use quirk identifyhw_aprivAlvin Lee <[email protected]>
drm/amd/display: Use max memclk variable when setting max memclkLeo Chen <[email protected]>
drm/amd/display: Blocking invalid 420 modes on HDMI TMDS for DCN314Leo Chen <[email protected]>
drm/amd/display: Blocking invalid 420 modes on HDMI TMDS for DCN31Austin Zheng <[email protected]>
drm/amd/display: Use DTBCLK as refclk instead of DPREFCLKPierre-Louis Bossart <[email protected]>
ALSA: hda: intel-dsp-cfg: add LunarLake supportUday M Bhat <[email protected]>
ASoC: Intel:sof_sdw: Update BT offload config for soundwire configPierre-Louis Bossart <[email protected]>
ASoC: SOF: topology: simplify code to prevent static analysis warningsLeo Ma <[email protected]>
drm/amd/display: Fix underflow issue on 175hz timingLijo Lazar <[email protected]>
drm/amdgpu: Update ring scheduler info as neededRong Tao <[email protected]>
samples/hw_breakpoint: Fix kernel BUG 'invalid opcode: 0000'Philip Yang <[email protected]>
drm/amdgpu: Increase soft IH ring sizeKrzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm8250-edo: correct ramoops pmsg-sizeKrzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm8150-kumano: correct ramoops pmsg-sizeKrzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm6350: correct ramoops pmsg-sizeKrzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm6125-sprout: correct ramoops pmsg-sizeKrzysztof Kozlowski <[email protected]>
arm64: dts: qcom: sm6125-pdx201: correct ramoops pmsg-sizeMarek Vasut <[email protected]>
drm: bridge: samsung-dsim: Drain command transfer FIFO before transferRalph Campbell <[email protected]>
drm/edid: Add quirk for OSVR HDK 2.0Marek Vasut <[email protected]>
drm/bridge: tc358762: Instruct DSI host to generate HSE packetsDave Marchevsky <[email protected]>
bpf: Consider non-owning refs to refcounted nodes RCU protectedDave Marchevsky <[email protected]>
bpf: Consider non-owning refs trustedAlan Stern <[email protected]>
Fix nomenclature for USB and PCI wireless devicesWen Gong <[email protected]>
wifi: ath12k: add check max message length while scanning with extraieRajat Soni <[email protected]>
wifi: ath12k: Fix memory leak inrx_descandtx_descHao Luo <[email protected]>
libbpf: Freebtf_vmlinuxwhen closingbpf_objectJohannes Berg <[email protected]>
Revert "wifi:mac80211_hwsim: check the return value ofnla_put_u32"Johannes Berg <[email protected]>
wifi:mac80211_hwsim: drop short framesJohannes Berg <[email protected]>
wifi: mac80211: check for station first in client probeJohannes Berg <[email protected]>
wifi: cfg80211: ocb: don't leave if not joinedJohannes Berg <[email protected]>
wifi: cfg80211: reject auth/assoc to AP with our addressGONG, Ruiqi <[email protected]>
netfilter: ebtables: fix fortify warnings insize_entry_mwt()Johannes Berg <[email protected]>
wifi: mac80211: check S1G action frame sizeAvraham Stern <[email protected]>
wifi: iwlwifi: pcie: avoid a warning in case prepare card failedGONG, Ruiqi <[email protected]>
alx: fix OOB-read compiler warningGiulio Benetti <[email protected]>
mmc: sdhci-esdhc-imx: improveESDHC_FLAG_ERR010450Alexander Steffen <[email protected]>
tpm_tis: Resend command to recover from data transfer errorsEric Dumazet <[email protected]>
netlink: convert nlk->flags to atomic flagsRoger Gammans <[email protected]>
Bluetooth: btusb: Add support for another MediaTek 7922 VID/PIDYing Hsu <[email protected]>
Bluetooth: Fixhci_suspend_synccrashChris Lu <[email protected]>
Bluetooth: btusb: Add new VID/PID 04ca/3804 for MT7922Chris Lu <[email protected]>
Bluetooth: btusb: Add new VID/PID 0489/e102 for MT7922Chris Lu <[email protected]>
Bluetooth: btusb: Add a new VID/PID 0489/e0f6 for MT7922Valentin David <[email protected]>
Bluetooth: btusb: Add device 0489:e0f5 as MT7922 deviceMark O'Donovan <[email protected]>
crypto: lib/mpi - avoid null pointer deref inmpi_cmp_ui()xu xin <[email protected]>
net/ipv4: return the real errno instead of-EINVALWen Gong <[email protected]>
wifi: ath12k: avoid array overflow of hw mode forpreferred_hw_modeWen Gong <[email protected]>
wifi: ath12k: Fix a NULL pointer dereference inath12k_mac_op_hw_scan()Kuniyuki Iwashima <[email protected]>
net: Usesockaddr_storageforgetsockopt(SO_PEERNAME).John Watts <[email protected]>
can:sun4i_can: Add support for the Allwinner D1John Watts <[email protected]>
can:sun4i_can: Add acceptance register quirkDmitry Antipov <[email protected]>
wifi: wil6210: fix fortify warningsMatt Whitlock <[email protected]>
mt76: mt7921: don't assume adequate headroom for SDIO headersDmitry Antipov <[email protected]>
wifi: mwifiex: fix fortify warningDmitry Antipov <[email protected]>
wifi: rtw88: delete timer and free skb queue when unloadingDongliang Mu <[email protected]>
wifi: ath9k: fix printk specifierDmitry Antipov <[email protected]>
wifi: ath9k: fix fortify warningsWojciech Drewek <[email protected]>
ice: Don't tx before switchdev is fully configuredJisheng Zhang <[email protected]>
net: stmmac: use per-queue 64 bit statistics where necessaryAzeem Shaikh <[email protected]>
crypto: lrw,xts - Replace strlcpy with strscpyJiri Pirko <[email protected]>
devlink: remove reload failed checks in params get/set callbacksMaksim Kiselev <[email protected]>
spi: sun6i: add quirk for dual and quad SPI modes supportThomas Weißschuh <[email protected]>
selftests/nolibc: prevent out of bounds access inexpect_vfprintfZhangjin Wu <[email protected]>
selftests/nolibc: fix up kernel parameters supportMario Limonciello <[email protected]>
ACPI: x86: s2idle: Catch multipleACPI_TYPE_PACKAGEobjectsTomislav Novak <[email protected]>
hw_breakpoint: fix single-stepping when usingbpf_overflow_handlerHans de Goede <[email protected]>
ACPI: video: Add backlight=native DMI quirk for Apple iMac12,1 and iMac12,2Xu Yang <[email protected]>
perf/imx_ddr: speed up overflow frequency of cycleDing Xiang <[email protected]>
kselftest/arm64: fix a memleak inzt_regs_run()Alexander Gordeev <[email protected]>
s390/boot: cleanup number of page table levels setupYicong Yang <[email protected]>
perf/smmuv3: Enable HiSilicon Erratum 162001900 quirk for HIP08/09Avadhut Naik <[email protected]>
x86/amd_nb: Add PCI IDs for AMD Family 1Ah-based modelsRob Barnes <[email protected]>
platform/chrome:cros_ec_lpc: Remove EC panic shutdown timeoutJiri Slaby (SUSE) <[email protected]>
ACPI: video: Add backlight=native DMI quirk for Lenovo Ideapad Z470Paul E. McKenney <[email protected]>
scftorture: Forgive memory-allocation failure if KASANZqiang <[email protected]>
rcuscale: Movercu_scale_writer()schedule_timeout_uninterruptible()to_idle()Wander Lairson Costa <[email protected]>
kernel/fork: beware of__put_task_struct()calling contextAbhishek Mainkar <[email protected]>
ACPICA: AddAML_NO_OPERAND_RESOLVEflag to TimerWill Shiu <[email protected]>
locks: fix KASAN: use-after-free intrace_event_raw_event_filelock_lockQu Wenruo <[email protected]>
btrfs: output extra debug info if we failed to find an inline backrefQu Wenruo <[email protected]>
btrfs: handle errors properly inupdate_inline_extent_backref()Fedor Pchelkin <[email protected]>
autofs: fix memory leak of waitqueues inautofs_catatonic_modeRitesh Harjani (IBM) <[email protected]>
iomap: Fix possible overflow condition iniomap_write_delalloc_scan-------------
Diffstat:
Documentation/admin-guide/cgroup-v1/memory.rst | 2 + Documentation/arch/arm64/silicon-errata.rst | 3 + Makefile | 4 +- arch/arm/kernel/hw_breakpoint.c | 8 +- arch/arm/kernel/machine_kexec.c | 14 +- .../dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 16 ++ .../dts/qcom/sm6125-sony-xperia-seine-pdx201.dts | 2 +- .../boot/dts/qcom/sm6125-xiaomi-laurel-sprout.dts | 2 +- arch/arm64/boot/dts/qcom/sm6350.dtsi | 2 +- .../boot/dts/qcom/sm8150-sony-xperia-kumano.dtsi | 2 +- .../boot/dts/qcom/sm8250-sony-xperia-edo.dtsi | 2 +- arch/arm64/kernel/hw_breakpoint.c | 4 +- arch/mips/cavium-octeon/octeon-usb.c | 8 +- arch/powerpc/platforms/pseries/ibmebus.c | 1 + arch/riscv/kernel/elf_kexec.c | 8 +- arch/s390/boot/startup.c | 9 +- arch/x86/boot/compressed/ident_map_64.c | 8 + arch/x86/include/asm/boot.h | 45 +++-- arch/x86/include/asm/linkage.h | 8 + arch/x86/include/asm/uaccess_64.h | 2 +- arch/x86/kernel/amd_nb.c | 8 + arch/x86/kernel/apic/x2apic_uv_x.c | 11 +- arch/x86/kernel/smpboot.c | 12 +- arch/x86/lib/copy_user_64.S | 57 ++---- arch/x86/lib/putuser.S | 4 - arch/x86/purgatory/Makefile | 4 + block/blk-mq.c | 19 +- crypto/lrw.c | 6 +- crypto/xts.c | 6 +- drivers/acpi/acpica/psopcode.c | 2 +- drivers/acpi/arm64/iort.c | 5 +- drivers/acpi/video_detect.c | 27 +++ drivers/acpi/x86/s2idle.c | 6 + drivers/ata/ahci.c | 9 + drivers/ata/libahci.c | 35 ++-- drivers/ata/libata-core.c | 206 ++++++++------------- drivers/ata/libata-eh.c | 152 +++++++-------- drivers/ata/libata-sata.c | 26 ++- drivers/ata/libata-scsi.c | 161 ++-------------- drivers/ata/libata-sff.c | 30 +-- drivers/bluetooth/btusb.c | 15 ++ drivers/bus/ti-sysc.c | 2 + drivers/char/tpm/tpm_tis_core.c | 13 +- drivers/comedi/Kconfig | 103 ++++------- drivers/firewire/core-device.c | 2 +- drivers/firewire/core-topology.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 18 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 26 --- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 7 +- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 2 +- .../gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c | 2 +- drivers/gpu/drm/amd/amdgpu/ih_v6_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 4 +- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 4 +- drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 4 +- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 112 +++++++++-- .../amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c | 2 +- .../gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c | 35 +++- drivers/gpu/drm/amd/display/dc/dc.h | 1 + .../drm/amd/display/dc/dcn314/dcn314_resource.c | 23 +++ drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dccg.c | 3 +- .../amd/display/dc/dml/dcn31/display_mode_vba_31.c | 4 +- .../display/dc/dml/dcn314/display_mode_vba_314.c | 4 +- .../dc/dml/dcn32/display_mode_vba_util_32.c | 7 +- drivers/gpu/drm/amd/display/dc/inc/core_types.h | 1 + drivers/gpu/drm/amd/display/dc/link/link_factory.c | 4 + drivers/gpu/drm/bridge/samsung-dsim.c | 2 +- drivers/gpu/drm/bridge/tc358762.c | 2 +- drivers/gpu/drm/drm_edid.c | 1 + drivers/gpu/drm/exynos/exynos_drm_crtc.c | 5 +- drivers/gpu/drm/i915/display/intel_bios.c | 21 +++ drivers/gpu/drm/i915/display/intel_bios.h | 1 + drivers/gpu/drm/i915/display/intel_dp.c | 7 +- drivers/gpu/drm/mediatek/mtk_dp.c | 6 +- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 3 +- drivers/gpu/drm/msm/adreno/adreno_device.c | 19 +- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 2 + drivers/gpu/drm/radeon/radeon_sa.c | 2 +- drivers/gpu/drm/tiny/gm12u320.c | 10 +- drivers/i2c/busses/i2c-aspeed.c | 7 +- drivers/interconnect/core.c | 8 +- drivers/md/dm-core.h | 1 + drivers/md/dm-ioctl.c | 7 +- drivers/md/dm-table.c | 32 +++- drivers/md/dm.c | 23 +-- drivers/md/md.c | 23 ++- drivers/md/md.h | 3 + drivers/md/raid1.c | 3 + drivers/media/pci/cx23885/cx23885-video.c | 2 +- drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 2 +- .../media/platform/mediatek/mdp3/mtk-mdp3-comp.c | 2 + drivers/media/tuners/qt1010.c | 11 +- drivers/media/usb/dvb-usb-v2/af9035.c | 9 +- drivers/media/usb/dvb-usb-v2/anysee.c | 2 +- drivers/media/usb/dvb-usb-v2/az6007.c | 8 + drivers/media/usb/dvb-usb-v2/gl861.c | 2 +- drivers/media/usb/dvb-usb/af9005.c | 5 + drivers/media/usb/dvb-usb/dw2102.c | 24 +++ drivers/misc/Kconfig | 1 + drivers/mmc/host/sdhci-esdhc-imx.c | 7 +- drivers/mtd/spi-nor/atmel.c | 8 +- drivers/mtd/spi-nor/core.c | 23 ++- drivers/mtd/spi-nor/core.h | 4 +- drivers/mtd/spi-nor/issi.c | 4 +- drivers/mtd/spi-nor/macronix.c | 4 +- drivers/mtd/spi-nor/micron-st.c | 4 +- drivers/mtd/spi-nor/spansion.c | 86 +++++++-- drivers/mtd/spi-nor/sst.c | 8 +- drivers/mtd/spi-nor/winbond.c | 4 +- drivers/mtd/spi-nor/xilinx.c | 4 +- drivers/net/can/Kconfig | 4 +- drivers/net/can/sun4i_can.c | 22 ++- drivers/net/ethernet/atheros/alx/ethtool.c | 5 +- drivers/net/ethernet/intel/ice/ice_eswitch.c | 3 + drivers/net/ethernet/stmicro/stmmac/common.h | 39 ++-- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 12 +- drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c | 7 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 16 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 15 +- drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 12 +- .../net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 6 +- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 14 +- drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 20 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 12 +- drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 15 +- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 + .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 123 +++++++++--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 200 +++++++++++++++----- drivers/net/wireless/ath/ath10k/pci.c | 2 +- drivers/net/wireless/ath/ath10k/usb.c | 2 +- drivers/net/wireless/ath/ath11k/pci.c | 2 +- drivers/net/wireless/ath/ath12k/dp.c | 30 ++- drivers/net/wireless/ath/ath12k/dp.h | 2 + drivers/net/wireless/ath/ath12k/mac.c | 7 +- drivers/net/wireless/ath/ath12k/pci.c | 2 +- drivers/net/wireless/ath/ath12k/wmi.c | 24 ++- drivers/net/wireless/ath/ath9k/ahb.c | 4 +- drivers/net/wireless/ath/ath9k/mac.h | 6 +- drivers/net/wireless/ath/ath9k/pci.c | 4 +- drivers/net/wireless/ath/ath9k/xmit.c | 4 +- drivers/net/wireless/ath/wil6210/txrx.c | 2 +- drivers/net/wireless/ath/wil6210/txrx.h | 6 +- drivers/net/wireless/ath/wil6210/txrx_edma.c | 2 +- drivers/net/wireless/ath/wil6210/txrx_edma.h | 6 +- drivers/net/wireless/atmel/at76c50x-usb.c | 8 +- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 11 +- .../net/wireless/intersil/orinoco/orinoco_usb.c | 12 +- drivers/net/wireless/legacy/rndis_wlan.c | 2 +- drivers/net/wireless/marvell/mwifiex/tdls.c | 9 +- drivers/net/wireless/mediatek/mt76/mt7603/Kconfig | 2 +- drivers/net/wireless/mediatek/mt76/mt7615/Kconfig | 2 +- drivers/net/wireless/mediatek/mt76/mt76x0/Kconfig | 4 +- drivers/net/wireless/mediatek/mt76/mt76x2/Kconfig | 4 +- drivers/net/wireless/mediatek/mt76/mt7915/Kconfig | 2 +- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 4 + drivers/net/wireless/mediatek/mt76/mt7996/Kconfig | 2 +- drivers/net/wireless/mediatek/mt7601u/Kconfig | 2 +- drivers/net/wireless/purelifi/plfxlc/Kconfig | 2 +- drivers/net/wireless/ralink/rt2x00/Kconfig | 2 +- drivers/net/wireless/realtek/rtw88/main.c | 4 +- drivers/net/wireless/realtek/rtw88/pci.c | 2 +- drivers/net/wireless/realtek/rtw88/usb.c | 2 +- drivers/net/wireless/realtek/rtw89/pci.c | 2 +- drivers/net/wireless/virtual/mac80211_hwsim.c | 12 +- drivers/net/wireless/zydas/zd1201.c | 6 +- drivers/nvme/host/core.c | 54 ++++-- drivers/nvme/target/tcp.c | 2 +- drivers/pci/controller/dwc/pci-imx6.c | 1 + drivers/pci/controller/dwc/pcie-fu740.c | 1 + drivers/pci/controller/vmd.c | 19 +- drivers/perf/arm_smmuv3_pmu.c | 46 ++++- drivers/perf/fsl_imx8_ddr_perf.c | 21 +++ drivers/platform/chrome/cros_ec_lpc.c | 4 +- drivers/platform/x86/eeepc-laptop.c | 2 +- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_debugfs.c | 14 +- drivers/scsi/lpfc/lpfc_els.c | 25 ++- drivers/scsi/lpfc/lpfc_init.c | 20 +- drivers/scsi/lpfc/lpfc_sli.c | 8 +- drivers/scsi/megaraid/megaraid_sas.h | 2 +- drivers/scsi/megaraid/megaraid_sas_base.c | 21 +-- drivers/scsi/pm8001/pm8001_init.c | 51 ++--- drivers/scsi/qla2xxx/qla_dfs.c | 6 +- drivers/scsi/qla2xxx/qla_inline.h | 2 +- drivers/scsi/qla2xxx/qla_isr.c | 6 +- drivers/scsi/qla2xxx/qla_target.c | 3 +- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +- drivers/spi/spi-sun6i.c | 29 ++- drivers/staging/wlan-ng/prism2usb.c | 48 ++--- drivers/target/iscsi/iscsi_target_configfs.c | 54 +++--- drivers/target/target_core_transport.c | 1 + drivers/tty/serial/cpm_uart/cpm_uart_core.c | 13 +- drivers/usb/cdns3/cdns3-plat.c | 3 +- drivers/usb/cdns3/cdnsp-pci.c | 3 +- drivers/usb/cdns3/core.c | 15 +- drivers/usb/cdns3/core.h | 7 +- drivers/usb/chipidea/ci.h | 1 + drivers/usb/chipidea/ci_hdrc_imx.c | 4 +- drivers/usb/chipidea/core.c | 2 + drivers/usb/chipidea/host.c | 1 + drivers/usb/gadget/udc/fsl_qe_udc.c | 2 + drivers/usb/host/ehci-hcd.c | 8 +- drivers/usb/host/ehci-hub.c | 10 +- drivers/usb/host/ehci.h | 10 + drivers/usb/typec/mux/intel_pmc_mux.c | 25 ++- drivers/usb/typec/tcpm/Kconfig | 1 + drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 37 ++++ fs/attr.c | 20 +- fs/autofs/waitq.c | 3 +- fs/btrfs/block-group.c | 23 ++- fs/btrfs/delayed-inode.c | 19 +- fs/btrfs/disk-io.c | 22 +-- fs/btrfs/extent-tree.c | 78 ++++++-- fs/btrfs/extent_io.c | 43 ++--- fs/btrfs/extent_io.h | 7 + fs/btrfs/fs.h | 3 + fs/btrfs/ioctl.c | 8 +- fs/btrfs/ordered-data.c | 2 +- fs/btrfs/volumes.c | 8 + fs/btrfs/volumes.h | 1 + fs/btrfs/zoned.c | 131 ++++++++++--- fs/btrfs/zoned.h | 20 +- fs/efivarfs/super.c | 14 +- fs/ext2/xattr.c | 4 +- fs/ext4/mballoc.c | 61 +++--- fs/ext4/mballoc.h | 14 ++ fs/ext4/namei.c | 26 +-- fs/iomap/buffered-io.c | 2 +- fs/jfs/jfs_dmap.c | 1 + fs/jfs/jfs_imap.c | 1 + fs/locks.c | 2 +- fs/nfsd/nfs4proc.c | 4 +- fs/overlayfs/copy_up.c | 3 +- fs/overlayfs/file.c | 9 +- fs/tracefs/inode.c | 3 + include/drm/drm_kunit_helpers.h | 4 +- include/linux/acpi_iort.h | 1 + include/linux/bpf.h | 3 +- include/linux/bpf_verifier.h | 2 +- include/linux/instruction_pointer.h | 5 + include/linux/libata.h | 6 +- include/linux/pci_ids.h | 2 + include/linux/perf_event.h | 22 ++- include/linux/sched/task.h | 28 ++- include/linux/trace_events.h | 6 +- include/linux/usb/chipidea.h | 1 + include/uapi/linux/netfilter_bridge/ebtables.h | 14 +- io_uring/io_uring.c | 16 +- io_uring/net.c | 5 + kernel/bpf/verifier.c | 13 +- kernel/fork.c | 8 + kernel/panic.c | 1 + kernel/power/hibernate.c | 12 +- kernel/printk/internal.h | 2 + kernel/printk/printk.c | 139 ++++++++++---- kernel/printk/printk_safe.c | 9 +- kernel/rcu/rcuscale.c | 2 +- kernel/scftorture.c | 6 +- kernel/trace/trace.c | 68 ++++++- kernel/trace/trace.h | 2 + kernel/trace/trace_events.c | 6 +- kernel/trace/trace_events_inject.c | 3 +- kernel/trace/trace_events_synth.c | 2 +- lib/kobject.c | 5 + lib/mpi/mpi-cmp.c | 8 +- mm/memcontrol.c | 10 + net/bluetooth/hci_core.c | 4 + net/bridge/netfilter/ebtables.c | 3 +- net/core/sock.c | 6 +- net/devlink/leftover.c | 4 +- net/ipv4/ip_output.c | 2 +- net/mac80211/cfg.c | 15 +- net/mac80211/rx.c | 4 + net/netlink/af_netlink.c | 90 +++------ net/netlink/af_netlink.h | 22 ++- net/netlink/diag.c | 10 +- net/sunrpc/clnt.c | 2 +- net/wireless/mlme.c | 13 ++ net/wireless/ocb.c | 3 + samples/hw_breakpoint/data_breakpoint.c | 4 +- security/selinux/hooks.c | 10 +- sound/hda/intel-dsp-config.c | 8 + sound/soc/intel/boards/sof_sdw.c | 4 +- sound/soc/sof/amd/acp-ipc.c | 4 + sound/soc/sof/topology.c | 5 +- tools/iio/iio_generic_buffer.c | 17 +- tools/lib/bpf/libbpf.c | 1 + .../selftests/arm64/signal/testcases/zt_regs.c | 1 + tools/testing/selftests/ftrace/ftracetest | 8 + tools/testing/selftests/nolibc/nolibc-test.c | 35 +++- 294 files changed, 2745 insertions(+), 1554 deletions(-)
Jon Hunter
maintainerHi Greg,
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.5 release. There are 211 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 Fri, 22 Sep 2023 11:28:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
I am also seeing suspend regressions on this update. I am guessing it is the same issue with linux-6.1.y.
Test results for stable-v6.5:
11 builds: 11 pass, 0 fail
28 boots: 28 pass, 0 fail
116 tests: 110 pass, 6 failLinux version: 6.5.5-rc1-g9e47a110b1b5
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Test failures: tegra124-jetson-tk1: pm-system-suspend.sh
tegra186-p2771-0000: tegra-audio-dmic-capture.sh
tegra20-ventana: pm-system-suspend.sh
tegra30-cardhu-a04: pm-system-suspend.shI will see if I can figure out which change is causing this.
Jon
Signature · 1 line
nvpublic