Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5256594img; Wed, 27 Mar 2019 05:17:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3q0bdkc0WbWScH/q7DnAyLybFnSMDRNPyoQNLiJNNDZU/8zA7wYSkoKqbFwTW9PMwnZzu X-Received: by 2002:a62:a219:: with SMTP id m25mr35030579pff.197.1553689029309; Wed, 27 Mar 2019 05:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553689029; cv=none; d=google.com; s=arc-20160816; b=vNQM60ySyT6W86hYJGR26rPz8q/rcmrswFprGnP4hip3ruoyoV7nZZDDWHhL1ihZKh ciSB2stU9+URUCXPFgKgx5Ua+yct3Qe/SZlyLKFbS0QWjicFH03J7bkpjBH60iVVJ9Is v0kF3S/ISKfZl1ccTVAQBT7b2vhykpt2MpfH687KlFBHn7KNInA2oDix2WBte6GmJ0we SAmcDYy8zI3VMUfh+hBo7oSrExOS1VBlppE6vQ7l9uo5Ncpbnz3S5DfrNJ7FdXih8RGX L/PBoMa6qbp4vm3WdexSEFiBaIqOUVgCcEHI62EvATMysJSMJzCF0qUSoq3b5LxfTjOh ijIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature; bh=nqhHg2yI7ytylbyKkXn7xHuipGn1S5mNOeIGMzLDDNA=; b=kVbXWIuRLxXNzeJh9IcAmN0gJwSZc2cvFTsT/n9pJzM2mODX9PSlRjSvlA63fTCeB4 VyqS0EjIOQcwJcUHgyQQ/fFXoDIFcMaVTX8dFuX/dbzOTvRdRh+gbQ3clfdKs8cDzEMe cJF4hSVaiH6vAZ00mHHg92y6+w2p7KAWm2ldsrslbdMyj+RTmh79NnmmRGWK41gp6S5y 6rmFfhLUyOoa76eZ4puhoe9oyxdu5FjHpSNGaAO7NJsV8Xq2sbClIOLBLg2oaV3ROpYu QZPMSVr12Li0pvsZTJNx58aL1NnVVKjX5fpP0g/+bBwRraqHa13GRzkHf/f8VCg1xbez TNug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=LhH0ZFeZ; dkim=pass header.i=@codeaurora.org header.s=default header.b=LhH0ZFeZ; 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 w8si19332615ply.303.2019.03.27.05.16.53; Wed, 27 Mar 2019 05:17:09 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=LhH0ZFeZ; dkim=pass header.i=@codeaurora.org header.s=default header.b=LhH0ZFeZ; 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 S1728795AbfC0MPw (ORCPT + 99 others); Wed, 27 Mar 2019 08:15:52 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39364 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728178AbfC0MPw (ORCPT ); Wed, 27 Mar 2019 08:15:52 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 92ADF60DAA; Wed, 27 Mar 2019 12:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553688951; bh=CTmpmGowtosWSNM48hzdAmQ8DGw/nfeuz3/VDxJMKIM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=LhH0ZFeZYCJgIsgvQFNHoF+yFAI01jjiu1PBLDtkCBR8xJYGO7ZtW4X6qa9GbrFAr /pdiWmuHg3nNsR8lkmSPfrt4aajJ4kYFXk4mCvXaXHAwB6XcLQ0lNrp2Y5fnGPe/Bu 1KJFr/2P4H7aCmJucrApS7whj2Ek6TkfU8in1IkQ= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from [10.204.79.83] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mojha@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8DB7460A43; Wed, 27 Mar 2019 12:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553688951; bh=CTmpmGowtosWSNM48hzdAmQ8DGw/nfeuz3/VDxJMKIM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=LhH0ZFeZYCJgIsgvQFNHoF+yFAI01jjiu1PBLDtkCBR8xJYGO7ZtW4X6qa9GbrFAr /pdiWmuHg3nNsR8lkmSPfrt4aajJ4kYFXk4mCvXaXHAwB6XcLQ0lNrp2Y5fnGPe/Bu 1KJFr/2P4H7aCmJucrApS7whj2Ek6TkfU8in1IkQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8DB7460A43 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=mojha@codeaurora.org Subject: Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference To: Kangjie Lu Cc: pakki001@umn.edu, Steve Wise , Doug Ledford , Jason Gunthorpe , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190309051921.15212-1-kjlu@umn.edu> From: Mukesh Ojha Message-ID: Date: Wed, 27 Mar 2019 17:45:46 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 MIME-Version: 1.0 In-Reply-To: <20190309051921.15212-1-kjlu@umn.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/9/2019 10:49 AM, 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 Reviewed-by: Mukesh OJha > --- > 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 > --- a/drivers/infiniband/hw/cxgb4/cm.c > +++ 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; > + > req = __skb_put_zero(skb, sizeof(*req)); > req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR)); > req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));