summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-12-29 20:41:40 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2023-12-29 20:41:40 +0100
commit09c57a762e797a55f6336c9798f576c889658ba5 (patch)
tree1f4dd67d2a054a23a8e427a3bcf437392c81c047 /block
parentMerge tag '6.7rc7-smb3-srv-fix' of git://git.samba.org/ksmbd (diff)
parentblock: renumber QUEUE_FLAG_HW_WC (diff)
downloadlinux-09c57a762e797a55f6336c9798f576c889658ba5.tar.xz
linux-09c57a762e797a55f6336c9798f576c889658ba5.zip
Merge tag 'block-6.7-2023-12-29' of git://git.kernel.dk/linux
Pull block fixes from Jens Axboe: "Fix for a badly numbered flag, and a regression fix for the badblocks updates from this merge window" * tag 'block-6.7-2023-12-29' of git://git.kernel.dk/linux: block: renumber QUEUE_FLAG_HW_WC badblocks: avoid checking invalid range in badblocks_check()
Diffstat (limited to 'block')
-rw-r--r--block/badblocks.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/block/badblocks.c b/block/badblocks.c
index fc92d4e18aa3..db4ec8b9b2a8 100644
--- a/block/badblocks.c
+++ b/block/badblocks.c
@@ -1312,12 +1312,14 @@ re_check:
prev = prev_badblocks(bb, &bad, hint);
/* start after all badblocks */
- if ((prev + 1) >= bb->count && !overlap_front(bb, prev, &bad)) {
+ if ((prev >= 0) &&
+ ((prev + 1) >= bb->count) && !overlap_front(bb, prev, &bad)) {
len = sectors;
goto update_sectors;
}
- if (overlap_front(bb, prev, &bad)) {
+ /* Overlapped with front badblocks record */
+ if ((prev >= 0) && overlap_front(bb, prev, &bad)) {
if (BB_ACK(p[prev]))
acked_badblocks++;
else