summaryrefslogtreecommitdiff
path: root/drivers/md/dm-stats.h
diff options
context:
space:
mode:
authorJiasheng Jiang <jiasheng@iscas.ac.cn>2023-03-16 09:55:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-05 12:23:42 +0300
commitc68f08cc745675a17894e1b4a5b5b9700ace6da4 (patch)
treeb3157313ab29b0243cc63af2cd8987a8491bf47a /drivers/md/dm-stats.h
parent1eaa2b7ae90c5a5e05586df310d804de250747d3 (diff)
downloadlinux-c68f08cc745675a17894e1b4a5b5b9700ace6da4.tar.xz
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: fd2ed4d25270 ("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>
Diffstat (limited to 'drivers/md/dm-stats.h')
-rw-r--r--drivers/md/dm-stats.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-stats.h b/drivers/md/dm-stats.h
index 2ddfae678f32..dcac11fce03b 100644
--- a/drivers/md/dm-stats.h
+++ b/drivers/md/dm-stats.h
@@ -22,7 +22,7 @@ struct dm_stats_aux {
unsigned long long duration_ns;
};
-void dm_stats_init(struct dm_stats *st);
+int dm_stats_init(struct dm_stats *st);
void dm_stats_cleanup(struct dm_stats *st);
struct mapped_device;