Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: free q->flush_rq in blk_init_allocated_queue error paths

Commit 7982e90c3a57 ("block: fix q->flush_rq NULL pointer crash on
dm-mpath flush") moved an allocation to blk_init_allocated_queue(), but
neglected to free that allocation on the error paths that follow.

Signed-off-by: Dave Jones <davej@fedoraproject.org>
Acked-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Dave Jones and committed by
Linus Torvalds
708f04d2 11d4616b

+6 -2
+6 -2
block/blk-core.c
··· 713 713 return NULL; 714 714 715 715 if (blk_init_rl(&q->root_rl, q, GFP_KERNEL)) 716 - return NULL; 716 + goto fail; 717 717 718 718 q->request_fn = rfn; 719 719 q->prep_rq_fn = NULL; ··· 737 737 /* init elevator */ 738 738 if (elevator_init(q, NULL)) { 739 739 mutex_unlock(&q->sysfs_lock); 740 - return NULL; 740 + goto fail; 741 741 } 742 742 743 743 mutex_unlock(&q->sysfs_lock); 744 744 745 745 return q; 746 + 747 + fail: 748 + kfree(q->flush_rq); 749 + return NULL; 746 750 } 747 751 EXPORT_SYMBOL(blk_init_allocated_queue); 748 752