Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp536296ybb; Thu, 28 Mar 2019 07:22:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhhu0yZT1qPvm5/YPOo9HCF+SHudrtc8lR1yKSu4UIdvMSd1f1CKbfxkVfpoC7wLHCLw6w X-Received: by 2002:a17:902:3f83:: with SMTP id a3mr40997460pld.6.1553782966321; Thu, 28 Mar 2019 07:22:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553782966; cv=none; d=google.com; s=arc-20160816; b=ZuSGnk6vnDkGbZa1xpaX9FUtbHWfB3ick0lnSYcQOJ0mlDeGscYa2ZrRgBKglAhM9g MLOHOaJYH0I2IpRK9uuy3pBJu7alVRFsSuRVtWaVEQziuymcVLEZXVpAGRmJlTmR8rnO KeHbfUB68F9JOHGzy4IKgbgHTtUd5TVgfmSyRdEw3YdcLZ5OiFvVC9UnNrYnWpp4caBR kGH5Q2Pi79ZRCn3XiQxFcrakxjlXOG9sMSAwhThSDnfGVus7Y/nHUp35lVHx1O+kg7ZF xii5NxvfvOcJhCwiusWwueenYCow9CLsyuRaSMeQGzTFs9DhMjtQRjOxQziTZyK8nDOv 2+Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7mHgYTQLuxXbHTsYRf3wN/TMxVzCCUpT9ZioQn1dBmY=; b=egD9bI/UrUbepj0x5rvs1USqVDf6SHEHEMCa9gffuaE+aBUu62DeUU1TzZY8VJlzlQ 7TXb6SSy1ExZ4FYhOvRBbq8Mg22H7Jpfs7rAJjB736rOXqc4Ud7EsmZvqSD6wOnmjn0Z GImNWgt9i5N67SqA+5j3RSHma2MfvKuMwhtEZccuSL9wjeeG7bNmyIaEmif0oQCDOoAZ 5do+seIUG9zlXLv91NkfOmgjUmpf3g2YNyjTKFZVnH9QDjyrMJWGyoyaY9hiejJw9Q4t F8FOus8SUjk50gLcMx3EGribDynYHlRu7jzN6HV6rgyURzmSJVqHmK//fJLC2mZ8I9zQ iFqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u37si2851493pga.301.2019.03.28.07.22.30; Thu, 28 Mar 2019 07:22:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726287AbfC1OV0 (ORCPT + 99 others); Thu, 28 Mar 2019 10:21:26 -0400 Received: from stargate.chelsio.com ([12.32.117.8]:37054 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbfC1OV0 (ORCPT ); Thu, 28 Mar 2019 10:21:26 -0400 Received: from localhost (mehrangarh.blr.asicdesigners.com [10.193.185.169]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id x2SEKNuJ001529; Thu, 28 Mar 2019 07:20:25 -0700 Date: Thu, 28 Mar 2019 19:50:23 +0530 From: Potnuri Bharat Teja To: Jason Gunthorpe Cc: Kangjie Lu , "pakki001@umn.edu" , Doug Ledford , "linux-rdma@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference Message-ID: <20190328142022.GA13931@chelsio.com> References: <20190309051921.15212-1-kjlu@umn.edu> <20190327133728.GA26660@chelsio.com> <20190328124037.GJ21008@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190328124037.GJ21008@ziepe.ca> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, March 03/28/19, 2019 at 18:10:37 +0530, Jason Gunthorpe wrote: > On Wed, Mar 27, 2019 at 07:08:54PM +0530, Potnuri Bharat Teja wrote: > > On Saturday, March 03/23/19, 2019 at 08:07:46 +0530, Kangjie Lu wrote: > > > > > > > > > > On Mar 8, 2019, at 11:19 PM, Kangjie Lu wrote: > > > > > > > > get_skb may fail and return NULL. The fix returns "ENOMEM" > > > > when it fails to avoid NULL dereference. > > > > > > > > Signed-off-by: Kangjie Lu > > > > drivers/infiniband/hw/cxgb4/cm.c | 3 +++ > > > > 1 file changed, 3 insertions(+) > > > > > > > > diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c > > > > index 8221813219e5..502a54d57e2c 100644 > > > > +++ b/drivers/infiniband/hw/cxgb4/cm.c > > > > @@ -1919,6 +1919,9 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) > > > > int win; > > > > > > > > skb = get_skb(NULL, sizeof(*req), GFP_KERNEL); > > > > + if (!skb) > > > > + return -ENOMEM; > > > > + > > > > > > Can someone review this patch? Thanks. > > > > Sorry for the late response. > > I recommend an error print before the return. > > if (!skb) { > > pr_err("%s - failed to alloc skb\n", __func__); > > return -ENOMEM; > > } > > no error prints on memory allocation failure, the kernel already > prints enough on this Ok. Acked-by: Potnuri Bharat Teja