Skip to content

floppy: avoid stale cont use after BH is queued - #1041

Open
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1138048=>linus-master
Open

floppy: avoid stale cont use after BH is queued#1041
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1138048=>linus-master

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Aug 2, 2026

Copy link
Copy Markdown

Pull request for series with
subject: floppy: avoid stale cont use after BH is queued
version: 2
url: https://patchwork.kernel.org/project/linux-block/list/?series=1138048

@blktests-ci

blktests-ci Bot commented Aug 2, 2026

Copy link
Copy Markdown
Author

Upstream branch: 2d2338c
series: https://patchwork.kernel.org/project/linux-block/list/?series=1138048
version: 2

@blktests-ci

blktests-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown
Author

Upstream branch: 0d83957
series: https://patchwork.kernel.org/project/linux-block/list/?series=1138048
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1138048=>linus-master branch from 261ec3d to 93a95a7 Compare August 6, 2026 09:23
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch 2 times, most recently from 612ae31 to 863d43a Compare August 9, 2026 07:24
@blktests-ci

blktests-ci Bot commented Aug 9, 2026

Copy link
Copy Markdown
Author

Upstream branch: 06cf618
series: https://patchwork.kernel.org/project/linux-block/list/?series=1138048
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1138048=>linus-master branch from 93a95a7 to 95d2480 Compare August 9, 2026 08:49
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch from 863d43a to 29ac21d Compare August 10, 2026 22:28
@blktests-ci

blktests-ci Bot commented Aug 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: d58772d
series: https://patchwork.kernel.org/project/linux-block/list/?series=1138048
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1138048=>linus-master branch from 95d2480 to 3ebae52 Compare August 10, 2026 23:20
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch from 29ac21d to ea2c39d Compare August 12, 2026 13:27
@blktests-ci

blktests-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown
Author

Upstream branch: f5bbbfe
series: https://patchwork.kernel.org/project/linux-block/list/?series=1138048
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1138048=>linus-master branch from 3ebae52 to 6b98cdb Compare August 12, 2026 14:55
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch from ea2c39d to 4082a30 Compare August 12, 2026 18:56
@blktests-ci

blktests-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown
Author

Upstream branch: 3d6d817
series: https://patchwork.kernel.org/project/linux-block/list/?series=1138048
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1138048=>linus-master branch from 6b98cdb to 9c91495 Compare August 12, 2026 20:08
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch from 4082a30 to 36bd7eb Compare August 13, 2026 19:18
@blktests-ci

blktests-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown
Author

Upstream branch: 3aa1dca
series: https://patchwork.kernel.org/project/linux-block/list/?series=1138048
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1138048=>linus-master branch from 9c91495 to 0c570ee Compare August 13, 2026 21:04
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch 2 times, most recently from d89ab11 to fdba928 Compare August 16, 2026 18:34
@blktests-ci

blktests-ci Bot commented Aug 16, 2026

Copy link
Copy Markdown
Author

Upstream branch: fd923b3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1138048
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1138048=>linus-master branch from 0c570ee to 1dfdc9f Compare August 16, 2026 21:13
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch from fdba928 to 60442a3 Compare August 17, 2026 14:10
@blktests-ci

blktests-ci Bot commented Aug 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 8d3ae59
series: https://patchwork.kernel.org/project/linux-block/list/?series=1138048
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1138048=>linus-master branch from 1dfdc9f to 6e93723 Compare August 17, 2026 20:37
@blktests-ci
blktests-ci Bot force-pushed the linus-master_base branch from 60442a3 to 3df366e Compare August 19, 2026 05:25
reset_fdc() arms do_floppy = reset_interrupt; the IRQ handler then
queues that function via schedule_bh(). If unlock_fdc() or do_wakeup()
clears cont before the work runs, reset_interrupt() dereferences a NULL
cont and oopses.

Example crash excerpt:

[ 1070.468148] status=80
[ 1070.468152] fdc_busy=1
[ 1070.468158] cont=          (null)
[ 1070.468161] current_req=          (null)
[ 1070.468162] command_status=-1
[ 1070.468163]
[ 1070.557051] floppy0: floppy timeout called
[ 1070.557053] no cont in shutdown!
[ 1070.557056] floppy0: floppy_shutdown: timeout handler died.
[ 1074.419509] floppy0: FDC access conflict!
[ 1074.419782] BUG: unable to handle kernel NULL pointer dereference at
0000000000000008
[ 1074.421969] PGD 0 P4D 0
[ 1074.422320] Oops: 0000 [#1] SMP NOPTI
[ 1074.422648] CPU: 10 PID: 3269 Comm: kworker/u256:4 Kdump: loaded
[ 1074.423830] Hardware name: inspur Standard PC (i440FX + PIIX, 1996),
BIOS 0.0.0 02/06/2015
[ 1074.424284] Workqueue: floppy floppy_work_workfn [floppy]
[ 1074.424757] RIP: 0010:reset_interrupt+0x3a/0xa0 [floppy]

The same NULL deref has also been reported by syzbot on upstream.

While a stale reset_interrupt() sits in result(), unlock_fdc() can
also clear cont and let a new request install another continuation, so
a plain !cont check after result() is not enough. Bump cont_seq when
clearing cont, sample it in schedule_bh() as bh_seq, and use cont in
reset_interrupt() only when the sequences still match.

Reported-by: syzbot+619e27617b2abe6b9b72@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=619e27617b2abe6b9b72
Link: https://lore.kernel.org/linux-block/00000000000093c4d105f9aa34d6@google.com/
Link: https://lists.openwall.net/linux-kernel/2021/10/27/56
Assisted-by: Cursor:Composer
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
@blktests-ci

blktests-ci Bot commented Aug 19, 2026

Copy link
Copy Markdown
Author

Upstream branch: bd5f485
series: https://patchwork.kernel.org/project/linux-block/list/?series=1138048
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1138048=>linus-master branch from 6e93723 to 0764ce2 Compare August 19, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants