Received: by 10.223.185.116 with SMTP id b49csp1029535wrg; Wed, 21 Feb 2018 10:51:24 -0800 (PST) X-Google-Smtp-Source: AH8x225p2rsB0A7zZxkCNGMKWE2oWUVdIvqOESysCElJD3quuNAJrhS6Dznhj7IbcAog6asbiY+Z X-Received: by 10.101.88.138 with SMTP id d10mr3498948pgu.52.1519239084747; Wed, 21 Feb 2018 10:51:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519239084; cv=none; d=google.com; s=arc-20160816; b=NbYjLwSy41Ci8n/pdELyjgWDYtBwp1Gwe9NIzlzTRv0CfGgGjVZj+hOXj6IO+3G045 T5FxYeDQUqHY81Tc8Kmnk3AbHC/J2t1DvY4QRiFjO7eT9HSsIBIyst9a947I1pPDUhFp ttAnE/yktiItlI2whK/3MFP/tjxN94qbRyTHpgsW6w7LPnZGJvW1WDkBmXrICWgm7y3G oUX/Pp+j6Xgv5Fu0yD4GUo8idjw5cb9m+BcxrxlrII4D1tFg7luItRYlUWMleyVs1S35 vXT5Vwi5qdGVj4GmL7RssnprDt+Q4mQ3GIzPRhmCuIRXlImOIRlOaSAHrMBb3IDNSSdh MPNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=v4uubXf8qAj8fjqGCmEwUUWFbMKz9tiIb++HwH4jocg=; b=0IYOeiw7mPDzUmHBnvt1wzeeaMsJbqbYQeaOQmNipRJFSzGXrzQ8Wj72csF5IdEvZi ef2I8u7TBOvy8P44oYixaa6NUwIR+pc78ybcWmz2nfynnuVRbVZTmETVI5x1Y60JVVWO Hr6d65j2UAhOFq5ZozK7+svtFZIO8BIDE69ttBqrmcyQYBk7R7Cerem9TpCO+uAbamxW LLbqvUkJOEMZuVE0E4VWfnDdWActs6B7pw74vw6wIouQk5qQ1X81cmBqNXkaZYKIpZmA mRCNW59U/WHfbda/JE08ZiAKOEuV06JAJ4XBuTw/vZIbR6FCTluVJXw7bThbuhDMwgRy s7xQ== 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 s36-v6si3261281pld.175.2018.02.21.10.51.10; Wed, 21 Feb 2018 10:51:24 -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; 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 S937525AbeBUOTJ (ORCPT + 99 others); Wed, 21 Feb 2018 09:19:09 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36422 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935047AbeBUM7M (ORCPT ); Wed, 21 Feb 2018 07:59:12 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 64E89FE7; Wed, 21 Feb 2018 12:59:11 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dennis Dalessandro , Ira Weiny , "Michael J. Ruhl" , Jason Gunthorpe Subject: [PATCH 4.14 008/167] IB/core: Avoid a potential OOPs for an unused optional parameter Date: Wed, 21 Feb 2018 13:46:59 +0100 Message-Id: <20180221124525.067909126@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124524.639039577@linuxfoundation.org> References: <20180221124524.639039577@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael J. Ruhl commit 2ff124d597c2df8696169ce0006fc974c49a4569 upstream. The ev_file is an optional parameter for CQ creation. If the parameter is not passed, the ev_file pointer will be NULL. Using that pointer to set the cq_context will result in an OOPs. Verify that ev_file is not NULL before using. Cc: # 4.14.x Fixes: 9ee79fce3642 ("IB/core: Add completion queue (cq) object actions") Reviewed-by: Dennis Dalessandro Reviewed-by: Ira Weiny Signed-off-by: Michael J. Ruhl Signed-off-by: Dennis Dalessandro Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/uverbs_std_types.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/core/uverbs_std_types.c +++ b/drivers/infiniband/core/uverbs_std_types.c @@ -315,7 +315,7 @@ static int uverbs_create_cq_handler(stru cq->uobject = &obj->uobject; cq->comp_handler = ib_uverbs_comp_handler; cq->event_handler = ib_uverbs_cq_event_handler; - cq->cq_context = &ev_file->ev_queue; + cq->cq_context = ev_file ? &ev_file->ev_queue : NULL; obj->uobject.object = cq; obj->uobject.user_handle = user_handle; atomic_set(&cq->usecnt, 0);