Received: by 10.223.185.116 with SMTP id b49csp722485wrg; Wed, 21 Feb 2018 05:59:16 -0800 (PST) X-Google-Smtp-Source: AH8x2244egW2Qq70pCsBZ3Upmp7jw5ZAYcObQthpK9Cgc8ItaUFEFRwIZyB5ktvQEDjGfh202oI7 X-Received: by 10.99.97.9 with SMTP id v9mr2767644pgb.373.1519221555963; Wed, 21 Feb 2018 05:59:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519221555; cv=none; d=google.com; s=arc-20160816; b=aYOGFVdmUjDExpdSNZFAmTKUgaRNM7eN2u/ji1EKvdNoxl7MhYrqeVoyRGI0fU5vMn eKG51oa6A+VpJAw3OoH0XSF/mAVegNrXQ6NKTXddpG8dYNPM7jOJTou5AxlgfBEzF1Vn xOfYhO9slsElpkKtwLl7ExlbLTC/nCpBCpBZSP3vcNOjLDUaNz9JvSNibTA3i+kF4wzi nKGIU76ZrkAs/KuGscvmOX+10b10mqD4wkOVwhxgsymNpcjh/CN9LvqBfil2r+ad7k/M gw9TtLb6CxYzr3X2HOUwdDUnWHmaKtHor5oLPL3tDtgE1oDfugElOCEgVMdCWz2RdKcS fMfQ== 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=PkTcKkMHidUgKY1dXuVy1EiJbPlwQdq4T6Jzpiwm7JI=; b=XyhFSzBZPfu5xKjTwPJzdTfVwybmJs3yNNhv4lSRijhXX6MiimCZcedfwqtLuKyhor 7j4m5CIyRtXv+o5BxgSvvB76Cng9zVGnU5JXRq9sz/mB0403u08LeL1lWA/XE2rnuGCk JfQZFGFeVCIdAPGr73YCRRZ2jAl0BycHnfY76rvx6z4UHMaghDhT2daDNPSbLQxJ/221 NSeulYkg/ufsgtDPlo4d4jo9rRoH9Iv0bcZEs8laFInFwUCx3oLD5tcz4uVe9N6wi+fV XsNhZ/LunY+z4YCcfPnzAn85JTfN41N3XruNHVoLuzI8IvFUNsb7Pg9AJJrDzjeFvXSq bPQA== 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 a8-v6si3936181ple.435.2018.02.21.05.59.01; Wed, 21 Feb 2018 05:59:15 -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 S965847AbeBUNqo (ORCPT + 99 others); Wed, 21 Feb 2018 08:46:44 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40942 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933903AbeBUNGa (ORCPT ); Wed, 21 Feb 2018 08:06:30 -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 438A8CCB; Wed, 21 Feb 2018 13:06:29 +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.15 007/163] IB/core: Avoid a potential OOPs for an unused optional parameter Date: Wed, 21 Feb 2018 13:47:16 +0100 Message-Id: <20180221124530.367145369@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@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.15-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);