ixgbe: check for vfs outside of sriov_num_vfs before dereference
authorEmil Tantilov <emil.s.tantilov@intel.com>
Thu, 16 Oct 2014 15:49:02 +0000 (15:49 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 16 Oct 2014 09:21:03 +0000 (02:21 -0700)
commit600a507ddcb99096731e1d96a3ebf43e20fc7f80
tree7adb7e47650db14b864e21d7bc31e54ad6914c72
parentf6b03c10a1b3f2c98ed23813997cdebef8aabeba
ixgbe: check for vfs outside of sriov_num_vfs before dereference

The check for vfinfo is not sufficient because it does not protect
against specifying vf that is outside of sriov_num_vfs range.
All of the ndo functions have a check for it except for
ixgbevf_ndo_set_spoofcheck().

The following patch is all we need to protect against this panic:

ip link set p96p1 vf 0 spoofchk off
BUG: unable to handle kernel NULL pointer dereference at 0000000000000052
IP: [<ffffffffa044a1c1>]
ixgbe_ndo_set_vf_spoofchk+0x51/0x150 [ixgbe]

Reported-by: Thierry Herbelot <thierry.herbelot@6wind.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Acked-by: Thierry Herbelot <thierry.herbelot@6wind.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c