Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* Possible bug in ipoib_reap_dead_ahs in datagram mode
@ 2022-05-04 19:15 Ryan Stone
  2022-05-24  7:07 ` Leon Romanovsky
  0 siblings, 1 reply; 6+ messages in thread
From: Ryan Stone @ 2022-05-04 19:15 UTC (permalink / raw)
  To: linux-rdma

I was reading through the IPoIB code and I think that I see a bug that
affects ipoib_reap_dead_ahs() when using datagram mode.

When sending a packet, if we aren't using the CM (which I assume means
that we are using datagram mode), we fall into the following case:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/infiniband/ulp/ipoib/ipoib_main.c#n1163

The AH for our neighbour has its last_send field set to the return
value from the RDMA driver's send function

If I look at how this is used in ipoib_reap_dead_ahs(), it compares
last_send to the current tail of the completion(?) queue.  I believe
that this is intended to check that the last outstanding WQ entry that
references the AH has completed.

However, if I look at the actual implementation in mlx5, the send
function always returns NETDEV_TX_OK:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c#n635

If my understanding of all of this is correct, this could lead to a
premature freeing of an AH and a use-after-free bug

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-25  6:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-04 19:15 Possible bug in ipoib_reap_dead_ahs in datagram mode Ryan Stone
2022-05-24  7:07 ` Leon Romanovsky
2022-05-24 13:33   ` Ryan Stone
2022-05-24 19:08     ` Leon Romanovsky
2022-05-24 19:18       ` Ryan Stone
2022-05-25  6:10         ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox