Commit 4dc72d8d authored by Jens Axboe's avatar Jens Axboe Committed by Jingtong Meng
Browse files

nvme: fix bogus kzalloc() return check in nvme_init_effects_log()

stable inclusion
from stable-v6.6.76
commit db996ed1990153f8af88fae216dae550a2623044
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBS4SF

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.6.y&id=db996ed1990153f8af88fae216dae550a2623044



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

[ Upstream commit 170e086ad3997f816d1f551f178a03a626a130b7 ]

nvme_init_effects_log() returns failure when kzalloc() is successful,
which is obviously wrong and causes failures to boot. Correct the
check.

Fixes: d4a95adeabc6 ("nvme: Add error path for xa_store in nvme_init_effects")
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJingtong Meng <jingtong.meng@windriver.com>
parent 2b8d2053
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2951,7 +2951,7 @@ static int nvme_init_effects_log(struct nvme_ctrl *ctrl,
	struct nvme_effects_log *effects, *old;

	effects = kzalloc(sizeof(*effects), GFP_KERNEL);
	if (effects)
	if (!effects)
		return -ENOMEM;

	old = xa_store(&ctrl->cels, csi, effects, GFP_KERNEL);