]> 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>
Wed, 20 Aug 2025 16:41:30 +0000 (18:41 +0200)
commit9ffc8ba21c0ad65576a11d9d7a07138be1ce4ebb
tree6ced43b4df61324d24fd931ce33ff4024de6d38e
parent0274f1463b0e927a8f2f67cd3a6fafd8fb2f17fc
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