Commit 23b7b357 authored by 蒋家盛's avatar 蒋家盛 Committed by Li Lingfeng
Browse files

dm stats: check for and propagate alloc_percpu failure

mainline inclusion
from mainline-v6.3-rc4
commit d3aa3e06
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7I2L8

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.4-rc6&id=d3aa3e060c4a80827eb801fc448debc9daa7c46b



--------------------------------

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: fd2ed4d2 ("dm: add statistics support")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>

Conflicts:
  drivers/md/dm-stats.c
  drivers/md/dm.c

Signed-off-by: default avatarLi Lingfeng <lilingfeng3@huawei.com>
parent 82c66282
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment