Loading
cxl/region: Fix memregion leaks in devm_cxl_add_region()
stable inclusion from stable-v6.6.35 commit d8316838aa0686da63a8be4194b7a17b0103ae4a category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAD05U CVE: CVE-2024-40936 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d8316838aa06 -------------------------------- [ Upstream commit 49ba7b515c4c0719b866d16f068e62d16a8a3dd1 ] Move the mode verification to __create_region() before allocating the memregion to avoid the memregion leaks. Fixes: 6e099264 ("cxl/region: Add volatile region creation support") Signed-off-by:Li Zhijian <lizhijian@fujitsu.com> Reviewed-by:
Dan Williams <dan.j.williams@intel.com> Link: https://lore.kernel.org/r/20240507053421.456439-1-lizhijian@fujitsu.com Signed-off-by:
Dave Jiang <dave.jiang@intel.com> Signed-off-by:
Sasha Levin <sashal@kernel.org> Signed-off-by:
Pu Lehui <pulehui@huawei.com>