re: RDMA/rxe: Fix skb lifetime in rxe_rcv_mcast_pkt()
From: Colin Ian King
Date: Mon Oct 12 2020 - 11:32:25 EST
Hi,
Static analysis with Coverity has detected a potential issue with the
following commit:
commit e7ec96fc7932f48a6d6cdd05bf82004a1a04285b
Author: Bob Pearson <rpearsonhpe@xxxxxxxxx>
Date: Thu Oct 8 15:36:52 2020 -0500
RDMA/rxe: Fix skb lifetime in rxe_rcv_mcast_pkt()
The analysis is as follows:
16. Condition mce->qp_list.next != &mcg->qp_list, taking true branch.
269 if (mce->qp_list.next != &mcg->qp_list)
17. returned_null: skb_clone returns NULL (checked 153 out of 178 times).
18. var_assigned: Assigning: per_qp_skb = NULL return value from
skb_clone.
19. Falling through to end of if statement.
270 per_qp_skb = skb_clone(skb, GFP_ATOMIC);
271 else
272 per_qp_skb = skb;
273
274 per_qp_pkt = SKB_TO_PKT(per_qp_skb);
275 per_qp_pkt->qp = qp;
276 rxe_add_ref(qp);
Dereference null return value (NULL_RETURNS)
20. dereference: Dereferencing a pointer that might be NULL
per_qp_skb when calling rxe_rcv_pkt.
277 rxe_rcv_pkt(per_qp_pkt, per_qp_skb);
278 }
279
It is possible for skb_clone to return NULL, so dereferencing the NULL
return pointer per_qp_skb is a potential issue.
Colin