Skip to content

Commit 14ab3da

Browse files
YunJe Shinrleon
authored andcommitted
RDMA/siw: Fix potential NULL pointer dereference in header processing
If siw_get_hdr() returns -EINVAL before set_rx_fpdu_context(), qp->rx_fpdu can be NULL. The error path in siw_tcp_rx_data() dereferences qp->rx_fpdu->more_ddp_segs without checking, which may lead to a NULL pointer deref. Only check more_ddp_segs when rx_fpdu is present. KASAN splat: [ 101.384271] KASAN: null-ptr-deref in range [0x00000000000000c0-0x00000000000000c7] [ 101.385869] RIP: 0010:siw_tcp_rx_data+0x13ad/0x1e50 Fixes: 8b6a361 ("rdma/siw: receive path") Signed-off-by: YunJe Shin <ioerts@kookmin.ac.kr> Link: https://patch.msgid.link/20260204092546.489842-1-ioerts@kookmin.ac.kr Acked-by: Bernard Metzler <bernard.metzler@linux.dev> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 5551b02 commit 14ab3da

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/infiniband/sw/siw/siw_qp_rx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,8 @@ int siw_tcp_rx_data(read_descriptor_t *rd_desc, struct sk_buff *skb,
14351435
}
14361436
if (unlikely(rv != 0 && rv != -EAGAIN)) {
14371437
if ((srx->state > SIW_GET_HDR ||
1438-
qp->rx_fpdu->more_ddp_segs) && run_completion)
1438+
(qp->rx_fpdu && qp->rx_fpdu->more_ddp_segs)) &&
1439+
run_completion)
14391440
siw_rdmap_complete(qp, rv);
14401441

14411442
siw_dbg_qp(qp, "rx error %d, rx state %d\n", rv,

0 commit comments

Comments
 (0)