RE: [Intel-wired-lan] [PATCH][net-next] iavf: fix dereference of null rx_buffer pointer
From: Bowers, AndrewX
Date: Wed Jun 26 2019 - 18:26:15 EST
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@xxxxxxxxxx] On
> Behalf Of Colin King
> Sent: Wednesday, June 19, 2019 7:31 AM
> To: Kirsher, Jeffrey T <jeffrey.t.kirsher@xxxxxxxxx>; David S . Miller
> <davem@xxxxxxxxxxxxx>; intel-wired-lan@xxxxxxxxxxxxxxxx;
> netdev@xxxxxxxxxxxxxxx
> Cc: kernel-janitors@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: [Intel-wired-lan] [PATCH][net-next] iavf: fix dereference of null
> rx_buffer pointer
>
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxx>
> ---
> drivers/net/ethernet/intel/iavf/iavf_txrx.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Tested-by: Andrew Bowers <andrewx.bowers@xxxxxxxxx>