Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3884401imu; Mon, 24 Dec 2018 10:28:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN6w/tBQmKhjlhkpqVceJz6zCnI6eZGkxYy/qFcJmXZGNpQ8HvHzgkRjy9nFcTc/Gh1x4utO X-Received: by 2002:a63:101:: with SMTP id 1mr13201510pgb.152.1545676123592; Mon, 24 Dec 2018 10:28:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545676123; cv=none; d=google.com; s=arc-20160816; b=D3jPaQNGyUXwLVK+spchCGGAqJ1LXLcLP5NOjt4MlEv+PH0wOiaPW8iyPPCEHKoyiS 00zaaNTTi28srSE/UHjTwpXd0lZ0FlvUa0eEZCts2PyvJLrtQPJi2W9c3M+5kA4KbDml ZmidwlHq58i/EWKYoGPK2A/6paFqIVCUmzlogHAg5yEcl9nVZ0r/BY1pla0+WjyMAVZl qRNUwhpOWOQ/2pOpi+H6HwqkqpEFs6mu+pTgi9atbqYwfglTfZpoqfv9Phgn4psiJCOc 9ACUvA28HME2HkLrS67cPFel0JDzBbJK6yCkU/q6v6eYovIMOpO9rsiwW6WZPKucqaRW PrBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=z8jGH7OSy10Xmp7FOooJUxOZZUuJDengHhk/566HuLA=; b=BiVCRMvWn14eXUBvjsNr4ZIsJ/854hNHg1XBqq3tSf0TOh/Y00y+/7Il9HmAiidF9x TzdcomIeXCA+3gBUOM1/BA7t3jEkR2aaarAGGUuO1ME7Yik6rZYBKdkgRuagxGQeZuHX Fv89DKMUFe+o0lmOyrh6u3isThSt7QZOnyXbX5T5qHDSkgx9x9GRpTyrUMI6VuwEOiGp rBmNM89WUa6vbpEFrh+smnDiReWoGbzT5cDL4NWqNxyB09+0OQzA6NXyiUCbKYc5oU2Y A/z1QbPsD7IWFeamM6Lxd/G/Hd+Btt5s2RyiMeDn4sXXkbOdqq5sMRYAJv1mdMvl2pxD V4Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=qrJXXl52; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3si4206334pga.556.2018.12.24.10.28.13; Mon, 24 Dec 2018 10:28:43 -0800 (PST) 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=@umn.edu header.s=google header.b=qrJXXl52; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725813AbeLXSZA (ORCPT + 99 others); Mon, 24 Dec 2018 13:25:00 -0500 Received: from mta-p7.oit.umn.edu ([134.84.196.207]:53432 "EHLO mta-p7.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbeLXSY7 (ORCPT ); Mon, 24 Dec 2018 13:24:59 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-p7.oit.umn.edu (Postfix) with ESMTP id 132B3A3D for ; Mon, 24 Dec 2018 18:24:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p7.oit.umn.edu ([127.0.0.1]) by localhost (mta-p7.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DsbeK_LQj1f2 for ; Mon, 24 Dec 2018 12:24:57 -0600 (CST) Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p7.oit.umn.edu (Postfix) with ESMTPS id D629D9FD for ; Mon, 24 Dec 2018 12:24:57 -0600 (CST) Received: by mail-io1-f71.google.com with SMTP id t133so13935495iof.20 for ; Mon, 24 Dec 2018 10:24:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=z8jGH7OSy10Xmp7FOooJUxOZZUuJDengHhk/566HuLA=; b=qrJXXl52/cpFpfAOhol/UGOVfoaW7qVYnL6f4GFaDXbnk59nEj+AmG/OEOgYnDC2JA F846oy3gBXcIEFh7Sp0caTAwZjw2mZT5V2Eidt3R3kIfL9Ew6q79/qQzyAiGO9Svhf/8 mvXlUXw1QcnM4D+0mZ9IDBOEB6hw/D24dR8W/lnZkRsmMJXPkBBG9/yy8DHKbzcgrDpz /KRcj8Ib7JntCZoiWuQJJqhwHX6J8zo/khXzEJ4MsPFFt9E0Yci5O1uMIQW0B6BTq4kX 68eTodR2nqNIqoWYEy74ZePlJo3Mr7jIWyagz/OuNeAJjEEFqBve022glA1uR78p0bi8 0bBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=z8jGH7OSy10Xmp7FOooJUxOZZUuJDengHhk/566HuLA=; b=hGsx/H4flRiU1q9xTyq3RORJWMhF29VCayaH7wp8WTkTFrCBXn30TPEcpjj+2iW2vb Xwg7sQO2sIU3yxveNWZ6EnAHvp8OgyqqRAxgbg1W9WQ5rkFOvFzG4WDqcJdzRubYiTdU 1QYpZ2ldxtpeE2AeM7KB+O0VDiSwe6+7XFKQj6VnqfoHRns2CkZ7I0trJGnK9LH8J9Bp S7gjqzcUccaSoK3I3JzNkHwgqQhlXNtZPAY0tRl9O8OXbYNWhG41naZ7dPPeBavrMXQi WXujapCeL5e5p2BhNiDP+e8SiLItEklXv/ejjR3/Z0Rh/eFqPBLqte/X30zuEhFhISo+ +y9Q== X-Gm-Message-State: AJcUukeq8Wd7/abZItXu0AO/ekisJ3q1ffSlkZmCHmffsE/yrb0hMY0l JPa28SzX45EDBumMDbj8gds1di3S+6HJGaZ+lbesFY4AaaGVZa7ReU/ZfVU+7BDhtkikDBlfhum PysYPEvCrxfu+cj43Pc49Og53SXw8 X-Received: by 2002:a6b:3bc8:: with SMTP id i191mr10076693ioa.23.1545675897474; Mon, 24 Dec 2018 10:24:57 -0800 (PST) X-Received: by 2002:a6b:3bc8:: with SMTP id i191mr10076686ioa.23.1545675897246; Mon, 24 Dec 2018 10:24:57 -0800 (PST) Received: from cs-u-syssec1.cs.umn.edu (cs-u-syssec1.cs.umn.edu. [134.84.121.78]) by smtp.gmail.com with ESMTPSA id u25sm13894605iob.23.2018.12.24.10.24.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Dec 2018 10:24:56 -0800 (PST) From: Aditya Pakki To: pakki001@umn.edu Cc: kjlu@umn.edu, Michal Kalderon , Ariel Elior , Doug Ledford , Jason Gunthorpe , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] infiniband/qedr: Potential null ptr dereference of qp Date: Mon, 24 Dec 2018 12:24:45 -0600 Message-Id: <20181224182445.21256-1-pakki001@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org idr_find() may fail and return a NULL pointer. The fix checks the return value of the function and returns an error in case of NULL. Signed-off-by: Aditya Pakki --- drivers/infiniband/hw/qedr/qedr_iw_cm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/hw/qedr/qedr_iw_cm.c b/drivers/infiniband/hw/qedr/qedr_iw_cm.c index 505fa3648762..93b16237b767 100644 --- a/drivers/infiniband/hw/qedr/qedr_iw_cm.c +++ b/drivers/infiniband/hw/qedr/qedr_iw_cm.c @@ -492,6 +492,8 @@ int qedr_iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) int i; qp = idr_find(&dev->qpidr.idr, conn_param->qpn); + if (unlikely(!qp)) + return -EINVAL; laddr = (struct sockaddr_in *)&cm_id->m_local_addr; raddr = (struct sockaddr_in *)&cm_id->m_remote_addr; -- 2.17.1