]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dm: initialize non-blk-mq queue data before queue is used
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 27 Oct 2015 23:06:55 +0000 (19:06 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Feb 2016 22:28:25 +0000 (14:28 -0800)
commitac44b98e83b1c6b227e537c44540b91278abab53
treeb83f0588006616211c1cac8475128429682ac70c
parent98216c7c4c771992789308dac9f5ef90eff9ed58
dm: initialize non-blk-mq queue data before queue is used

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 <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm.c