ploop: Check for top_delta in ploop_congested()

Submitted by Kirill Tkhai on May 6, 2019, 12:11 p.m.


Message ID 155714469872.21039.17298483908748255597.stgit@localhost.localdomain
State New
Series "ploop: Check for top_delta in ploop_congested()"
Headers show

Commit Message

Kirill Tkhai May 6, 2019, 12:11 p.m.
Sometimes we may meet empty delta list in ploop_congested():

BUG: unable to handle kernel NULL pointer dereference at 0000000000000148
IP: [<ffffffffc009f05c>] ploop_congested+0x1c/0x40 [ploop]
PGD 8000005e75efd067 PUD 5709a95067 PMD 0
Oops: 0000 [#1] SMP
Workqueue: cgroup_destroy cgroup_offline_fn
task: ffffa137e0303420 ti: ffffa134b9324000 task.ti: ffffa134b9324000
RIP: 0010:[<ffffffffc009f05c>]  [<ffffffffc009f05c>] ploop_congested+0x1c/0x40 [ploop]
RSP: 0018:ffffa134b9327890  EFLAGS: 00010246
RAX: ffffa12db23249e0 RBX: ffffa134b9327d20 RCX: 0000000000000000
RDX: ffffa12db23249e0 RSI: 0000000000000002 RDI: 0000000000000000
RBP: ffffa134b9327990 R08: ffffa1094cd513c8 R09: 0000000000000001
R10: 000000007fffffff R11: 0000000000000230 R12: ffffdad02aa2b860
R13: ffffa134b9327a38 R14: ffffdad02aa2b840 R15: 0000000000000001
FS:  0000000000000000(0000) GS:ffffa13b7bfc0000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000148 CR3: 0000004b780e4000 CR4: 00000000007607e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 00000000
Call Trace:
[<ffffffff9e9be2fd>] ? shrink_page_list+0x22d/0xaa0
[<ffffffff9e9bf153>] shrink_inactive_list+0x1b3/0x6f0
[<ffffffff9e9bf9e8>] ? shrink_active_list+0x358/0x470
[<ffffffff9e9bfea1>] shrink_lruvec+0x3a1/0x720
[<ffffffff9e9bc505>] ? do_shrink_slab+0x45/0x270
[<ffffffff9e9c0392>] shrink_zone+0x172/0x440
[<ffffffff9e9c0a48>] do_try_to_free_pages+0x1a8/0x630
[<ffffffff9ef48ae7>] ? __schedule+0x3f7/0x8d0
[<ffffffff9e9c111e>] try_to_free_mem_cgroup_pages+0xee/0x1b0
[<ffffffff9ea2c093>] mem_cgroup_css_offline+0xd3/0x2a0
[<ffffffff9e92cf42>] cgroup_offline_fn+0x92/0x190
[<ffffffff9e8b7622>] process_one_work+0x182/0x440
[<ffffffff9e8b87d6>] worker_thread+0x126/0x3c0
[<ffffffff9e8b86b0>] ? manage_workers.isra.24+0x2a0/0x2a0
[<ffffffff9e8bf741>] kthread+0xd1/0xe0

Currently we don't know the actual way we came into this
situation, because crash dump is incomplete (and I don't see
the way in code). But it's possible, since we crashed,
so let's fix the problem.

Signed-off-by: Kirill Tkhai <>
 drivers/block/ploop/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 18ffb1092ff8..eb60d37cd9df 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -1116,7 +1116,7 @@  static int ploop_congested(void *data, int bits)
 	int ret = 0;
 	top_delta = ploop_top_delta(plo);
-	if (top_delta->io.ops->congested)
+	if (top_delta && top_delta->io.ops->congested)
 		ret |= top_delta->io.ops->congested(&top_delta->io, bits);
 	return ret;