net/bnxt: fix possible stack smashing
authorLinsi Yuan <yuanlinsi01@baidu.com>
Thu, 30 Apr 2020 13:37:52 +0000 (21:37 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 11 May 2020 20:27:39 +0000 (22:27 +0200)
commit6ebabb76a57c02681a01e07bf8016e4308c14c7c
treeb35e6e06dc37a6c2b5d4cffe164cda46342bdd5c
parent34ce8415020f4ac3f7d33b54ad231aaf8023c005
net/bnxt: fix possible stack smashing

We see a stack smashing as a result of defensive code missing. Once the
nb_pkts is less than RTE_BNXT_DESCS_PER_LOOP, it will be modified to
zero after doing a floor align, and we can not exit the following
receiving packets loop. And the buffers will be overwrite, then the
stack frame was ruined.

Fix the problem by adding defensive code, once the nb_pkts is zero, just
directly return with no packets.

Fixes: bc4a000f2f53 ("net/bnxt: implement SSE vector mode")
Cc: stable@dpdk.org
Signed-off-by: Linsi Yuan <yuanlinsi01@baidu.com>
Signed-off-by: Dongsheng Rong <rongdongsheng@baidu.com>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_rxtx_vec_sse.c