From patchwork Tue Oct 27 13:52:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 307310 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15709C55179 for ; Tue, 27 Oct 2020 16:37:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFE96206D9 for ; Tue, 27 Oct 2020 16:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603816650; bh=kXWvaPpbY0zyttfeQh5mM+kkie+AfaljUhSRsq2Un7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VKv6BnL5EZXZwVEr6c/NfpDX+d2pxH0OT0ahxICbEiAARZFENm4B7WSVbPOm/fDfm YVfuSEfZUcq8ARDuKcRCjJIpJDDCcdlgIWkxl8HhKwRkfjRXo9Uom+xYQeNPePR9uB ddd9oON/+DGym2YlnQ4eGGvuEs/Yln+d53LL1Pic= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1811121AbgJ0QhY (ORCPT ); Tue, 27 Oct 2020 12:37:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:40464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1801840AbgJ0Pob (ORCPT ); Tue, 27 Oct 2020 11:44:31 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 77B5A2242B; Tue, 27 Oct 2020 15:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813426; bh=kXWvaPpbY0zyttfeQh5mM+kkie+AfaljUhSRsq2Un7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c2M5uIKlvZ1tzyavX+k4cWHq4LlhRwhzbpGVFPc/1eGg67v8NN8pOlQa71fdQbbXU 8VUrL1P4N+2a59oaBT2b4EBN8GDoilcNNY8PGOo0E7pPonTJoNXKAoGNZC0rCaAHB4 9Wf0SVEb8vZNhCk8GtgBLOjPkEwnvwDJQyquplYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.9 506/757] RDMA/rxe: Handle skb_clone() failure in rxe_recv.c Date: Tue, 27 Oct 2020 14:52:36 +0100 Message-Id: <20201027135514.191879934@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bob Pearson [ Upstream commit 71abf20b28ff87fee6951ec2218d5ce7969c4e87 ] If skb_clone() is unable to allocate memory for a new sk_buff this is not detected by the current code. Check for a NULL return and continue. This is similar to other errors in this loop over QPs attached to the multicast address and consistent with the unreliable UD transport. Fixes: e7ec96fc7932f ("RDMA/rxe: Fix skb lifetime in rxe_rcv_mcast_pkt()") Addresses-Coverity-ID: 1497804: Null pointer dereferences (NULL_RETURNS) Link: https://lore.kernel.org/r/20201013184236.5231-1-rpearson@hpe.com Signed-off-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_recv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c index 967ee8e1699cd..2da4187db80c9 100644 --- a/drivers/infiniband/sw/rxe/rxe_recv.c +++ b/drivers/infiniband/sw/rxe/rxe_recv.c @@ -298,6 +298,9 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) else per_qp_skb = skb; + if (unlikely(!per_qp_skb)) + continue; + per_qp_pkt = SKB_TO_PKT(per_qp_skb); per_qp_pkt->qp = qp; rxe_add_ref(qp);