]> git.proxmox.com Git - mirror_iproute2.git/commit - ip/ipaddress.c
ipaddress: Make sure VF min/max rate API is supported before using it
authorGal Pressman <galp@mellanox.com>
Tue, 16 Jan 2018 13:41:59 +0000 (15:41 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 17 Jan 2018 18:44:42 +0000 (10:44 -0800)
commit39315157ab16205846ed34996cf4c8c0f58113c0
tree4cc72fe158cb05a908ec1749b14ee3312fc678b9
parent04be08e0bd2ed67bbedb787b70d1d73e91322d75
ipaddress: Make sure VF min/max rate API is supported before using it

When using the new minimum rate API and providing only one parameter
(minimum rate/maximum rate), we query the VF min and max rate regardless
of kernel support.
This resulted in segmentation fault in ipaddr_loop_each_vf, which tries
to access NULL pointer.

This patch identifies such cases by testing the VF table for NULL
pointer in IFLA_VF_RATE, and aborts the operation.
Aborting on the first VF is valid since if the kernel does not support
the new API for the first VF, it will not support it for the other VFs
as well.

Fixes: f89a2a05ffa9 ("Add support to configure SR-IOV VF minimum and maximum Tx rate through ip tool")
Cc: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Gal Pressman <galp@mellanox.com>
Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
ip/ipaddress.c