]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pcmcia: Add error handling for add_interval() in do_validate_mem()
authorWentao Liang <vulab@iscas.ac.cn>
Mon, 20 Jan 2025 13:10:06 +0000 (21:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 16:56:32 +0000 (18:56 +0200)
commit8699358b6ac99b8ccc97ed9e6e3669ef8958ef7b
treedcacd1be5eb181ae8495c6142faae9b43e741411
parent3ee8f5c8938f5b1e1caa3c94ea624d4a215991c0
pcmcia: Add error handling for add_interval() in do_validate_mem()

[ Upstream commit 4a81f78caa53e0633cf311ca1526377d9bff7479 ]

In the do_validate_mem(), the call to add_interval() does not
handle errors. If kmalloc() fails in add_interval(), it could
result in a null pointer being inserted into the linked list,
leading to illegal memory access when sub_interval() is called
next.

This patch adds an error handling for the add_interval(). If
add_interval() returns an error, the function will return early
with the error code.

Fixes: 7b4884ca8853 ("pcmcia: validate late-added resources")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pcmcia/rsrc_nonstatic.c