]> git.itanic.dy.fi Git - linux-stable/commit
net/mlx4_core: Limit count field to 24 bits in qp_alloc_res
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Tue, 25 Nov 2014 09:54:31 +0000 (11:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Dec 2014 17:34:27 +0000 (09:34 -0800)
commit3e4410bb077de97319cb6d2e6a74e39f9d9a9503
tree0ff5d0fee3f0d336858cf4b5dc4ccde9eda0541c
parentdfe35fa73e531c9ce88d2fbdb5bd5716e9c190e6
net/mlx4_core: Limit count field to 24 bits in qp_alloc_res

[ Upstream commit 2d5c57d7fbfaa642fb7f0673df24f32b83d9066c ]

Some VF drivers use the upper byte of "param1" (the qp count field)
in mlx4_qp_reserve_range() to pass flags which are used to optimize
the range allocation.

Under the current code, if any of these flags are set, the 32-bit
count field yields a count greater than 2^24, which is out of range,
and this VF fails.

As these flags represent a "best-effort" allocation hint anyway, they may
safely be ignored. Therefore, the PF driver may simply mask out the bits.

Fixes: c82e9aa0a8 "mlx4_core: resource tracking for HCA resources used by guests"
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c