Re: [bug report] net/mlx5: HWS, added send engine and context handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13-Sep-24 17:37, Dan Carpenter wrote:

Hello Yevgeny Kliteynik,

Commit 2ca62599aa0b ("net/mlx5: HWS, added send engine and context
handling") from Jun 20, 2024 (linux-next), leads to the following
Smatch static checker warning:

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c:739 hws_send_ring_open_sq() warn: 'sq->dep_wqe' double freed
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c:739 hws_send_ring_open_sq() warn: 'sq->wq_ctrl.buf.frags' double freed
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c:739 hws_send_ring_open_sq() warn: 'sq->wr_priv' double freed
...
     725
     726         err = hws_send_ring_alloc_sq(ctx->mdev, numa_node, queue, sq, sqc_data);
     727         if (err)
     728                 goto err_free_sqc;
     729
     730         err = hws_send_ring_create_sq_rdy(ctx->mdev, ctx->pd_num, sqc_data,
     731                                           queue, sq, cq);
     732         if (err)
     733                 goto err_free_sq;

hws_send_ring_create_sq_rdy() calls hws_send_ring_close_sq() on error.

I would say that it's the free in hws_send_ring_create_sq_rdy() which
should be modified.

Exactly - it should call the mlx5_core destroy function, but instead it
calls the HWS function. Will have this fixed shortly.

Thanks Dan!

-- YK

There isn't an official style guideline for error
handling so do whatever works for you.  But I've written a guide to how
people often do it:
https://staticthinking.wordpress.com/2022/04/28/free-the-last-thing-style/

     734
     735         kvfree(sqc_data);
     736
     737         return 0;
     738 err_free_sq:
--> 739         hws_send_ring_free_sq(sq);

It results in a double free.

     740 err_free_sqc:
     741         kvfree(sqc_data);
     742         return err;
     743 }

regards,
dan carpenter





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux