]> git.baikalelectronics.ru Git - kernel.git/commit
dm stats: check for and propagate alloc_percpu failure
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Thu, 16 Mar 2023 06:55:06 +0000 (14:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Apr 2023 09:16:41 +0000 (11:16 +0200)
commit12806856417511e8b2e946772b00ce473ad8308d
treeb7d5ba38360b6f459a4c224d728fdbf7c780db1d
parent7164a7adc13d76809dd195b6b246aaf4de181a9a
dm stats: check for and propagate alloc_percpu failure

commit d3aa3e060c4a80827eb801fc448debc9daa7c46b upstream.

Check alloc_precpu()'s return value and return an error from
dm_stats_init() if it fails. Update alloc_dev() to fail if
dm_stats_init() does.

Otherwise, a NULL pointer dereference will occur in dm_stats_cleanup()
even if dm-stats isn't being actively used.

Fixes: 0da43f932b1b ("dm: add statistics support")
Cc: stable@vger.kernel.org
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-stats.c
drivers/md/dm-stats.h
drivers/md/dm.c