From: Dave Jones <davej@redhat.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: snitzer@redhat.com, axboe@fb.com
Subject: block: free q->flush_rq in blk_init_allocated_queue error paths.
Date: Wed, 19 Mar 2014 15:12:21 -0400 [thread overview]
Message-ID: <20140319191221.GA10034@redhat.com> (raw)
In-Reply-To: <20140318010053.D08A2660CC5@gitolite.kernel.org>
Commit 7982e90c3a ("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>
diff --git a/block/blk-core.c b/block/blk-core.c
index 4cd5ffc18442..bfe16d5af9f9 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -713,7 +713,7 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
return NULL;
if (blk_init_rl(&q->root_rl, q, GFP_KERNEL))
- return NULL;
+ goto fail;
q->request_fn = rfn;
q->prep_rq_fn = NULL;
@@ -737,12 +737,16 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
/* init elevator */
if (elevator_init(q, NULL)) {
mutex_unlock(&q->sysfs_lock);
- return NULL;
+ goto fail;
}
mutex_unlock(&q->sysfs_lock);
return q;
+
+fail:
+ kfree(q->flush_rq);
+ return NULL;
}
EXPORT_SYMBOL(blk_init_allocated_queue);
next parent reply other threads:[~2014-03-19 19:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20140318010053.D08A2660CC5@gitolite.kernel.org>
2014-03-19 19:12 ` Dave Jones [this message]
2014-03-19 19:22 ` Mike Snitzer
2014-03-20 14:34 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140319191221.GA10034@redhat.com \
--to=davej@redhat.com \
--cc=axboe@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome