From: Slava Ovsiienko <viacheslavo@mellanox.com>
To: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v6 1/2] ethdev: fix data room size verification in Rx queue setup
Date: Tue, 7 Jul 2020 13:37:47 +0000 [thread overview]
Message-ID: <AM4PR05MB3265242CACFE7C0ECD0DA4E3D2660@AM4PR05MB3265.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1594019191-54524-2-git-send-email-xavier.huwei@huawei.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Wei Hu (Xavier)
> Sent: Monday, July 6, 2020 10:07
> To: dev@dpdk.org
> Cc: xavier.huwei@huawei.com
> Subject: [dpdk-dev] [PATCH v6 1/2] ethdev: fix data room size verification in
> Rx queue setup
>
> In the rte_eth_rx_queue_setup API function, the local variable named
> mbp_buf_size, which is the data room size of the input parameter mp, is
> checked to guarantee that each memory chunck used for net device in the
> mbuf is bigger than the min_rx_bufsize. But if mbp_buf_size is less than
> RTE_PKTMBUF_HEADROOM, the value of the following statement will be a
> large number since the mbp_buf_size is a unsigned value.
> mbp_buf_size - RTE_PKTMBUF_HEADROOM
> As a result, it will cause a segment fault in this situation.
>
> This patch fixes it by modify the check condition to guarantee that the local
> varibale named mbp_buf_size is bigger than RTE_PKTMBUF_HEADROOM.
>
> Fixes: af75078fece3 ("first public release")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
> Acked-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
> ---
> v2 -> v6: No change.
> v1 -> v2: Simplify the check condition of mbp_buf_size according to
> Andrew Rybchenko's comment.
> ---
> lib/librte_ethdev/rte_ethdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index d06b7f9..50c3f18 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -1820,7 +1820,7 @@ rte_eth_rx_queue_setup(uint16_t port_id,
> uint16_t rx_queue_id,
> }
> mbp_buf_size = rte_pktmbuf_data_room_size(mp);
>
> - if ((mbp_buf_size - RTE_PKTMBUF_HEADROOM) <
> dev_info.min_rx_bufsize) {
> + if (mbp_buf_size < dev_info.min_rx_bufsize +
> RTE_PKTMBUF_HEADROOM) {
> RTE_ETHDEV_LOG(ERR,
> "%s mbuf_data_room_size %d < %d
> (RTE_PKTMBUF_HEADROOM=%d + min_rx_bufsize(dev)=%d)\n",
> mp->name, (int)mbp_buf_size,
> --
> 2.7.4
next prev parent reply other threads:[~2020-07-07 13:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-06 7:06 [dpdk-dev] [PATCH v6 0/2] ethdev: minor bugfixes Wei Hu (Xavier)
2020-07-06 7:06 ` [dpdk-dev] [PATCH v6 1/2] ethdev: fix data room size verification in Rx queue setup Wei Hu (Xavier)
2020-07-07 13:37 ` Slava Ovsiienko [this message]
2020-07-06 7:06 ` [dpdk-dev] [PATCH v6 2/2] ethdev: fix VLAN offloads set if no relative capabilities Wei Hu (Xavier)
2020-07-07 7:35 ` Jeff Guo
2020-07-07 13:38 ` Slava Ovsiienko
2020-07-08 3:53 ` Wei Hu (Xavier)
2020-07-07 14:11 ` Thomas Monjalon
2020-07-08 3:37 ` Wei Hu (Xavier)
2020-07-08 10:14 ` Thomas Monjalon
2020-07-09 7:39 ` Wei Hu (Xavier)
2020-07-09 9:04 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AM4PR05MB3265242CACFE7C0ECD0DA4E3D2660@AM4PR05MB3265.eurprd05.prod.outlook.com \
--to=viacheslavo@mellanox.com \
--cc=dev@dpdk.org \
--cc=xavier.huwei@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).