OSDN Git Service

ixgbe: do not use adapter->num_vfs when setting VFs via module parameter
authorEmil Tantilov <emil.s.tantilov@intel.com>
Fri, 20 Jan 2017 22:11:56 +0000 (14:11 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 18 Apr 2017 20:25:30 +0000 (13:25 -0700)
commit5c11f00ddac2c030827cdecf9c2d3678cbd3137b
tree880f9437ee2f2c8b8ee7b5f4fd301191d2a192d4
parentda614d042ac236e5db52c56c7d7d8accd325dd40
ixgbe: do not use adapter->num_vfs when setting VFs via module parameter

Avoid setting adapter->num_vfs early in the init code path when
using the max_vfs module parameter by passing it to ixgbe_enable_sriov()
as a function parameter.

This fixes an issue where if we failed to allocate vfinfo in
__ixgbe_enable_sriov() the driver will crash with NULL pointer in
ixgbe_disable_sriov() when attempting to free the vfinfo struct based
on adapter->num_vfs. Also it cleans up the assignment of adapter->num_vfs
since now it will only be set in __ixgbe_enable_sriov() and cleared in
ixgbe_disable_sriov().

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h