Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5254096img; Wed, 27 Mar 2019 05:14:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfG9rye8tSa9TiWP/EN2GhUAhrIhO2urrf3JslQ1P6H9I1zI7EiLgYyDpRCfaE+/jynqWI X-Received: by 2002:a17:902:8e82:: with SMTP id bg2mr37083301plb.217.1553688877115; Wed, 27 Mar 2019 05:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553688877; cv=none; d=google.com; s=arc-20160816; b=SoRgK3GpyETgwJJ2J93FKgy8C2sO5rrKTtrAqHNeDjMh4i/CH0DtQ/5+IqawsVM6El 0sfcJrxuOVXJT4yuhigTLS7fXNRYsjGwIBYwBooBiDp+w03FApcj1L7p/ax5rf8w1XZn bWBNyP2jgISqEb5cGxNFJF3YXCOJH8A6Nd9BDknrEUyUeJ/WVIZ7HOxjyqyZE1ul5cSJ +I/0R4gZKhh9awXSCCrb6r2IfMUvy6MTxt66oJyOrBVEMwARSzlz+ak4bzAzmAx5dmx8 eda12SQDUpdky8vkX3tyyU8AjbYPPgpYZ7zHMJUrXKKk+KvgAhl0chwglYMDXQvz9psj 3z/Q== 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=UTYQwd+b4fmYqEFrTsrla+XTIEq40etq5oewazEgdhY=; b=gyJBCSQg3tBesRdGfoTU9j4RAcp5w+1s4JWDrU68A/SqSRrJ6UDqxBgAY6+WRQESv/ ipbvmybVPvHs/WZKBdxnzjiDPuhK3wjZaQNlMVvdp9NFC7cH9gEiX+vkIGBMyrgEumRX ccyabwn6PRw3JC8Mp6kl6mn9tKL7CIFsvjzAk9LiHNwtMJasIsxwoA+2afP4+51VISJQ cluGA0cRKyUMq/zV4c+EGoVL2qjSGHkKGW9/QcWr5OUCty2seBKcDZLiUUQLFWVbfURk s3gByshFULsTgflUYhHfs7MyyNIoirGZRLqK/fsOEQZNDxqpak42zy36Q7/sOFFs4OMV 5Ftw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=PuKLOkrF; dkim=pass header.i=@codeaurora.org header.s=default header.b=RL4tMN4U; 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.14.21; Wed, 27 Mar 2019 05:14:37 -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=PuKLOkrF; dkim=pass header.i=@codeaurora.org header.s=default header.b=RL4tMN4U; 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 S1728565AbfC0MNg (ORCPT + 99 others); Wed, 27 Mar 2019 08:13:36 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38260 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726296AbfC0MNg (ORCPT ); Wed, 27 Mar 2019 08:13:36 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2485460E3F; Wed, 27 Mar 2019 12:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553688815; bh=7KP3YDZ/m+akhRhTO0w7B3BXCduUCx2d0p/1Kedy5ss=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=PuKLOkrFahWJ2SKpkzp32W9YFAaG9FgwcEFgYs5cLTv6a4bJ6kmljuxnneWo9zDeg 4frSd/uej9Xz0eSFXRdaS3sipRoghe3qQ9R9xYqmXij0PfFPKI/Zv/UjGmoN6AOtJc eCZW5FS4GhougrACyFsfMLxqkyqyeuhogHskx50E= 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 E757D609D4; Wed, 27 Mar 2019 12:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553688814; bh=7KP3YDZ/m+akhRhTO0w7B3BXCduUCx2d0p/1Kedy5ss=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=RL4tMN4UNgcsuAli3KdaaTniTVyJKIf9CXd8X66pWFAI45w4A5Yk+xesHmvZg7fB+ w0H1/McTKOJ/nSbjIoEmI8KOyzS4ylWqimYyMKXlvDZWuEgvyGFgR2XSYTOT0af+L4 qz+PD+1zIuyrkHj4t7cbgU25ipgmRy/cu/8O8VTA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E757D609D4 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: <7e949cd4-8ef7-a29b-83a0-9c15b68499e5@codeaurora.org> Date: Wed, 27 Mar 2019 17:43:29 +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)));