]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
IB/uverbs: Fix an potential error pointer dereference
authorXiang Yang <xiangyang3@huawei.com>
Fri, 4 Aug 2023 02:25:25 +0000 (10:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:22:46 +0000 (12:22 +0200)
commit7a17deca33e1a299eaf139924f3010d1b60d5013
tree67d0e3772ded1700550b7045cd1e670563f194bc
parent42d111304dd747ae190332c799535b2ba0c0469d
IB/uverbs: Fix an potential error pointer dereference

[ Upstream commit 26b7d1a27167e7adf75b150755e05d2bc123ce55 ]

smatch reports the warning below:
drivers/infiniband/core/uverbs_std_types_counters.c:110
ib_uverbs_handler_UVERBS_METHOD_COUNTERS_READ() error: 'uattr'
dereferencing possible ERR_PTR()

The return value of uattr maybe ERR_PTR(-ENOENT), fix this by checking
the value of uattr before using it.

Fixes: ebb6796bd397 ("IB/uverbs: Add read counters support")
Signed-off-by: Xiang Yang <xiangyang3@huawei.com>
Link: https://lore.kernel.org/r/20230804022525.1916766-1-xiangyang3@huawei.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/core/uverbs_std_types_counters.c