iavf: fix dereference of null rx_buffer pointer
authorColin Ian King <colin.king@canonical.com>
Wed, 19 Jun 2019 14:30:44 +0000 (15:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2019 05:28:34 +0000 (07:28 +0200)
commit500add335481750b3e2af3e1c101f5aca3bfb7bc
tree4aaa24269752f4b5a3fd5dd85450d058cb416998
parentfc92046b6822d1497f17cad2c67186f95d03a7d7
iavf: fix dereference of null rx_buffer pointer

[ Upstream commit 9fe06a51287b2d41baef7ece94df34b5abf19b90 ]

A recent commit efa14c3985828d ("iavf: allow null RX descriptors") added
a null pointer sanity check on rx_buffer, however, rx_buffer is being
dereferenced before that check, which implies a null pointer dereference
bug can potentially occur.  Fix this by only dereferencing rx_buffer
until after the null pointer check.

Addresses-Coverity: ("Dereference before null check")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/i40evf/i40e_txrx.c