fm10k: fix possible null pointer deref after kcalloc
authorJacob Keller <jacob.e.keller@intel.com>
Thu, 7 Apr 2016 15:21:20 +0000 (08:21 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 21 Apr 2016 06:07:33 +0000 (23:07 -0700)
commit540a5d859010a239a99aba02a9fed7b255c0033e
tree46ac30ed48a61aa6723be7b5003b43f41adfc272
parent11ec36a974f59c99e8a4ff7040026569a43ab567
fm10k: fix possible null pointer deref after kcalloc

When writing a new default redirection table, we needed to populate
a new RSS table using ethtool_rxfh_indir_default. We populated this
table into a region of memory allocated using kcalloc, but never checked
this for NULL. Fix this by moving the default table generation into
fm10k_write_reta. If this function is passed a table, use it. Otherwise,
generate the default table using ethtool_rxfh_indir_default, 4 at at
time.

Fixes: 0ea7fae44094 ("fm10k: use ethtool_rxfh_indir_default for default redirection table")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
drivers/net/ethernet/intel/fm10k/fm10k_main.c