block: null_blk: fix use after free
PATCH 1/1 block: null_blk: fix use after free
entry(cmd->ll_list) may belong to new request once end_cmd() returns, so fix the bug with the patch.
Without the change, it is easy to observe oops when doing null_blk(timer) test.
Signed-off-by Ming Lei <[email protected]>
--- drivers/block/null_blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/null_blk.c +1 -1
@@ -203,8 +203,8 @@ static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer) entry =llist_reverse_order (entry);do { cmd = container_of(entry, struct nullb_cmd, ll_list); -end_cmd (cmd); entry = entry->next; +end_cmd (cmd); }while (entry); }
Signature · 1 line
1.7.9.5
Jens Axboe
maintainerQuoted 16 lines · Ming Lei
entry(cmd->ll_list)may belong to new request onceend_cmd()returns, so fix the bug with the patch.Without the change, it is easy to observe oops when doing
null_blk(timer)test.Signed-off-by Ming Lei <[email protected]>--- drivers/block/null_blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/null_blk.c +0
-0
drivers/block/null_blk.c static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer) · line 209
Quoted 8 lines
drivers/block/null_blk.c +1
-1@@ -203,8 +203,8 @@ static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer) entry =llist_reverse_order (entry);do { cmd = container_of(entry, struct nullb_cmd, ll_list); -end_cmd (cmd); entry = entry->next; +end_cmd (cmd); }while (entry); }
Good catch, applied.
Signature · 1 line
Jens Axboe