]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vfio/mlx5: fix possible overflow in tracking max message size
authorArtem Sadovnikov <a.sadovnikov@ispras.ru>
Tue, 1 Jul 2025 14:40:17 +0000 (14:40 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:28:29 +0000 (16:28 +0200)
commit2e07a9fe5117543387d405494c5d58006c027b09
tree8b4ad5172a5a11ced7683116ae92b9394282bae4
parent48d7bdd8759cb2119be81a9e72077ba28ae39c56
vfio/mlx5: fix possible overflow in tracking max message size

[ Upstream commit b3060198483bac43ec113c62ae3837076f61f5de ]

MLX cap pg_track_log_max_msg_size consists of 5 bits, value of which is
used as power of 2 for max_msg_size. This can lead to multiplication
overflow between max_msg_size (u32) and integer constant, and afterwards
incorrect value is being written to rq_size.

Fix this issue by extending integer constant to u64 type.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Suggested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Artem Sadovnikov <a.sadovnikov@ispras.ru>
Reviewed-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://lore.kernel.org/r/20250701144017.2410-2-a.sadovnikov@ispras.ru
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/pci/mlx5/cmd.c