Re: [PATCH rdma-next 01/13] RDMA/rvt: Return NULL after port allocation failure

From: Kalesh Anakkur Purayil

Date: Thu Jul 09 2026 - 05:11:18 EST


On Wed, Jul 8, 2026 at 4:21 PM Leon Romanovsky <leon@xxxxxxxxxx> wrote:
>
> From: Leon Romanovsky <leonro@xxxxxxxxxx>
>
> rvt_alloc_device() deallocates the IB device when its port array cannot
> be allocated but then returns the pointer to the released allocation.
> Callers treat any non-NULL value as valid and dereference it, resulting
> in a use-after-free.
>
> Return NULL immediately after deallocation so callers can propagate the
> allocation failure.
>
> Fixes: ff6acd69518e ("IB/rdmavt: Add device structure allocation")
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@xxxxxxxxxxxx>


--
Regards,
Kalesh AP

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature