]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/uverbs: Check for null return of kmalloc_array
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Fri, 31 Dec 2021 09:33:15 +0000 (17:33 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 5 Jan 2022 18:16:53 +0000 (14:16 -0400)
commit877a792f622074ccae41761386cf4cee1f5587c0
treec87578d9438dc2b1f653ac90ec6e0927f49f7c9c
parent18d57760cc97bf3ed96f752f9a3a3d6b5560f63d
RDMA/uverbs: Check for null return of kmalloc_array

Because of the possible failure of the allocation, data might be NULL
pointer and will cause the dereference of the NULL pointer later.
Therefore, it might be better to check it and return -ENOMEM.

Fixes: af0167666f4f ("RDMA/verbs: Store the write/write_ex uapi entry points in the uverbs_api")
Link: https://lore.kernel.org/r/20211231093315.1917667-1-jiasheng@iscas.ac.cn
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/uverbs_uapi.c