From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:34455 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751076AbcBMXC7 (ORCPT ); Sat, 13 Feb 2016 18:02:59 -0500 Subject: Patch "dm: initialize non-blk-mq queue data before queue is used" has been added to the 4.3-stable tree To: mpatocka@redhat.com, gregkh@linuxfoundation.org, snitzer@redhat.com Cc: , From: Date: Sat, 13 Feb 2016 15:02:58 -0800 Message-ID: <1455404578167166@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled dm: initialize non-blk-mq queue data before queue is used to the 4.3-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: dm-initialize-non-blk-mq-queue-data-before-queue-is-used.patch and it can be found in the queue-4.3 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From ad5f498f610fa3fd8bd265139098bc1405cd2783 Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Tue, 27 Oct 2015 19:06:55 -0400 Subject: dm: initialize non-blk-mq queue data before queue is used From: Mikulas Patocka commit ad5f498f610fa3fd8bd265139098bc1405cd2783 upstream. Commit bfebd1cdb497a57757c83f5fbf1a29931591e2a4 ("dm: add full blk-mq support to request-based DM") moves the initialization of the fields backing_dev_info.congested_fn, backing_dev_info.congested_data and queuedata from the function dm_init_md_queue (that is called when the device is created) to dm_init_old_md_queue (that is called after the device type is determined). There is no locking when accessing these variables, thus it is possible for other parts of the kernel to briefly see this data in a transient state (e.g. queue->backing_dev_info.congested_fn initialized and md->queue->backing_dev_info.congested_data uninitialized, resulting in passing an incorrect parameter to the function dm_any_congested). This queue data is left initialized for blk-mq devices even though they that don't use it. Fixes: bfebd1cdb497 ("dm: add full blk-mq support to request-based DM") Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2198,6 +2198,13 @@ static void dm_init_md_queue(struct mapp * This queue is new, so no concurrency on the queue_flags. */ queue_flag_clear_unlocked(QUEUE_FLAG_STACKABLE, md->queue); + + /* + * Initialize data that will only be used by a non-blk-mq DM queue + * - must do so here (in alloc_dev callchain) before queue is used + */ + md->queue->queuedata = md; + md->queue->backing_dev_info.congested_data = md; } static void dm_init_old_md_queue(struct mapped_device *md) @@ -2208,10 +2215,7 @@ static void dm_init_old_md_queue(struct /* * Initialize aspects of queue that aren't relevant for blk-mq */ - md->queue->queuedata = md; md->queue->backing_dev_info.congested_fn = dm_any_congested; - md->queue->backing_dev_info.congested_data = md; - blk_queue_bounce_limit(md->queue, BLK_BOUNCE_ANY); } Patches currently in stable-queue which might be from mpatocka@redhat.com are queue-4.3/dm-btree-fix-leak-of-bufio-backed-block-in-btree_split_sibling-error-path.patch queue-4.3/dm-initialize-non-blk-mq-queue-data-before-queue-is-used.patch