[dpdk-dev,08/13] PMD/af_packet: guard against buffer overruns in RX path
Checks
Commit Message
Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
---
drivers/net/af_packet/rte_eth_af_packet.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Comments
On 12/13/2016 1:08 AM, Michał Mirosław wrote:
> Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
Form main address (<mirq-linux@rere.qmqm.pl>) which sets git author
field, and Signed-off mail address are different.
As author, any objection to use signed-off mail:
"Michał Mirosław <michal.miroslaw@atendesoftware.pl>"
This is valid for a few other patches.
On Wed, Jan 18, 2017 at 11:48:52AM +0000, Ferruh Yigit wrote:
> On 12/13/2016 1:08 AM, Michał Mirosław wrote:
> > Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
> Form main address (<mirq-linux@rere.qmqm.pl>) which sets git author
> field, and Signed-off mail address are different.
>
> As author, any objection to use signed-off mail:
> "Michał Mirosław <michal.miroslaw@atendesoftware.pl>"
>
> This is valid for a few other patches.
Please use the Signed-off address, thanks.
Best Regards,
Michał Mirosław
@@ -370,18 +370,18 @@ eth_rx_queue_setup(struct rte_eth_dev *dev,
{
struct pmd_internals *internals = dev->data->dev_private;
struct pkt_rx_queue *pkt_q = &internals->rx_queue[rx_queue_id];
- uint16_t buf_size;
+ unsigned buf_size, data_size;
pkt_q->mb_pool = mb_pool;
/* Now get the space available for data in the mbuf */
- buf_size = (uint16_t)(rte_pktmbuf_data_room_size(pkt_q->mb_pool) -
- RTE_PKTMBUF_HEADROOM);
+ buf_size = rte_pktmbuf_data_room_size(pkt_q->mb_pool) - RTE_PKTMBUF_HEADROOM;
+ data_size = internals->req.tp_frame_size - TPACKET2_HDRLEN + sizeof(struct sockaddr_ll);
- if (ETH_FRAME_LEN > buf_size) {
+ if (data_size > buf_size) {
RTE_LOG(ERR, PMD,
"%s: %d bytes will not fit in mbuf (%d bytes)\n",
- dev->data->name, ETH_FRAME_LEN, buf_size);
+ dev->data->name, data_size, buf_size);
return -ENOMEM;
}