Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp233285pxx; Wed, 28 Oct 2020 03:36:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAnv5ghhZP5IdzfhT/ON/uN3RWdpa76h3rrawo+fErMeMt/NX7PUyU9Wblvbq3IHwcmwv5 X-Received: by 2002:a05:6402:1bc9:: with SMTP id ch9mr7171963edb.386.1603881393552; Wed, 28 Oct 2020 03:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603881393; cv=none; d=google.com; s=arc-20160816; b=iOjzjGzxG9+wqawgEJuSBUTj6DyffUAC5uy512SiQANWPV4m5tfcubR34lNCvLkXNj H0V+78gfjiJ7Kbjv2VO3qj0FmKDeZWBfwMYbwyZAvQzkHWYqRrsLeRi9UEiKPL4a+cUW 93dmR4Tm9xmtEeCizpJg1V9qU9qG2R3d+RNyxrZMbzKztYcXR99ZonVerDh3oogrUAwI RajJmrIrMDSpZwY8cYYn6PwVxhfp1daFHXUcxfnyaA1MSOUnTdW7stMWpDwchUriQeG8 W163NlM+aIB9qWBF+SlfiuZZljPtc2WJNuEfL/09ZF9HsXzWcfaXfDVm5e5WWfAPJOiR 9xaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fvv6j9epriKnMyOJn0xvXokRbS8oNG7sGn1v71EQtMI=; b=LtiMP4wxxs2i/Q+ch6t8tQ2irP5hNqJ3/uikmotnPYWPiN89wJUB2yp2yUeFzLRiVo rFvcy9gyGLxRIGXZPdVHFNV2JqZyb0v4qjyDhWVW3w6TWXbG3FVG/4pP+A6vErbvNSRO jBpIFjA9lQEmokoH6pVty8sjZ2EVtCHNj/Y2bjBWcAL2yWxtFdSxDezeAr8xe8BBhrQA qCTlpl8/e6fRJTyN9axTBIioUoU9pRSTV7G9x8+hH0guaib+6b7qs8gCEhGUMib6aaIi vtNJ43+knQpTmFDw9g5YF9QJJNDfwrG+5L2GOc4Lxb7Q1QYS7Bk8JpzXjlhBtrb37Erc +pRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=npjGJsxH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt10si1135660edb.503.2020.10.28.03.36.10; Wed, 28 Oct 2020 03:36:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=npjGJsxH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762601AbgJ0Onh (ORCPT + 99 others); Tue, 27 Oct 2020 10:43:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:40840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2899181AbgJ0Ol2 (ORCPT ); Tue, 27 Oct 2020 10:41:28 -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 D5195206B2; Tue, 27 Oct 2020 14:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809688; bh=6iNgf1jOVE5Jgq3YA/ekXFTlsyVoU1AiArcDjjJpnNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=npjGJsxHg06ON55uLns2bk3lSeIZ9dBga1Qbv2bv6xmhKSmN1OW/lnlJ3tVNN5hzJ 3PPkut1WZ9mE5FvU5Z83fYIKJheD7tZLe8ZcrfEHssfLblFEJufuENZBOTaT6VLDZr PP51xzNKi8jLEhI0kFU4FCw2RrRWxtefQCGptfgA= 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.4 253/408] RDMA/rxe: Handle skb_clone() failure in rxe_recv.c Date: Tue, 27 Oct 2020 14:53:11 +0100 Message-Id: <20201027135506.775858094@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 be6416a982c70..9bfb98056fc2a 100644 --- a/drivers/infiniband/sw/rxe/rxe_recv.c +++ b/drivers/infiniband/sw/rxe/rxe_recv.c @@ -319,6 +319,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); -- 2.25.1