[dpdk-dev v4 1/2] net/tap: fix buffer overflow for ptypes list through updation of last element.

Ferruh Yigit ferruh.yigit at amd.com
Thu Jan 11 16:11:59 CET 2024


On 1/4/2024 5:51 PM, Sivaramakrishnan Venkat wrote:
> Incorrect ptypes list causes buffer overflow for Address Sanitizer
> run. 
>

I think it cause buffer overflow anyway, but detected with Address
Sanitizer, so perhaps we can say:
"Address Sanitizer detected buffer overflow caused by incorrect ptypes
list."


> The last element in the ptypes lists to be "RTE_PTYPE_UNKNOWN"
> for rte_eth_dev_get_supported_ptypes().
> In rte_eth_dev_get_supported_ptypes(),the loop iterates until it
> finds "RTE_PTYPE_UNKNOWN" to detect last element of the ptypes array.
>

It implies but can be good to put clearly that missing
"RTE_PTYPE_UNKNOWN" causes the buffer overflow in the loop.

> Fix the ptypes list for drivers.
> 
> Fixes: 0849ac3b6122 ("net/tap: add packet type management")
> Fixes: a7bdc3bd4244 ("net/dpaa: support packet type parsing")
> Fixes: 4ccc8d770d3b ("net/mvneta: add PMD skeleton")
> Fixes: f3f0d77db6b0 ("net/mrvl: support packet type parsing")
> Fixes: 78a38edf66de ("ethdev: query supported packet types")
>

Is this fixes line correct, as far as I can see drivers added with this
commit is correct.

nfp driver also seems fixed, maybe intention was add fixes for it?

> Fixes: 659b494d3d88 ("net/pfe: add packet types and basic statistics")
> Fixes: 398a1be14168 ("net/thunderx: remove generic passX references")
> Cc: pascal.mazon at 6wind.com
> Cc: zr at semihalf.com
> Cc: tdu at semihalf.com
> Cc: jianfeng.tan at intel.com
> Cc: g.singh at nxp.com
> Cc: jerin.jacob at caviumnetworks.com
> Cc: stable at dpdk.org
> 
> Signed-off-by: Sivaramakrishnan Venkat <venkatx.sivaramakrishnan at intel.com>
>

Patch is no more tap patch, can you please update the patch title in
next version, it can be something like:
"drivers/net: fix buffer overflow for ptypes list"

> ---
>  drivers/net/dpaa/dpaa_ethdev.c      | 3 ++-
>  drivers/net/mvneta/mvneta_ethdev.c  | 3 ++-
>  drivers/net/mvpp2/mrvl_ethdev.c     | 3 ++-
>  drivers/net/nfp/nfp_net_common.c    | 1 +
>  drivers/net/pfe/pfe_ethdev.c        | 3 ++-
>  drivers/net/tap/rte_eth_tap.c       | 1 +
>  drivers/net/thunderx/nicvf_ethdev.c | 2 ++
>  7 files changed, 12 insertions(+), 4 deletions(-)
> 

Code changes looks good to me.



More information about the dev mailing list