Received: by 10.192.165.148 with SMTP id m20csp2488128imm; Sun, 22 Apr 2018 08:04:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx48hlJor2y0tX0IQbZfi4bWw6rdbMB7miNDgXeCNI9DWetQglAJNewZGS14E7F/5biM7wT5p X-Received: by 2002:a17:902:3a5:: with SMTP id d34-v6mr16698315pld.103.1524409456587; Sun, 22 Apr 2018 08:04:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524409456; cv=none; d=google.com; s=arc-20160816; b=TtIdoNimMkmfOChldixWJvF/JEPUeGpWgw9gGmG7/57EcECagdjbhYUoxo3sY9SnYy gy7IBSUvttYV50P9oHjseb2lZ5Kyc2dvpoESAMvsB5Kh5YijV8C3xXK9qOVBEr0vC0u/ k2kBxoO1ZdCI+vD7JVHIJSlnEnXOMM5r43v4uaHvUg5nmyuN2I0lnL9aWrEEYShnZRpe VQOb5n9VppOhKKJmdamw0RnO+CZU7l4fXZJtTcdyYAbVG869WbbID8dXlRxQoAU8ZgX5 37I2RuE2evBjDCVhFMUHJvPAUxGFkwFZgEKXZPk7LI9yURd/SkgZmLgCblHvi2lE74iX TGEQ== 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=qntEC4cb7zfUZJOhA05wuTxwikFDajWdQ22pU6EutaE=; b=SgsCjcctux5gLVE/Wf4x2NueIsBMsBELzaLv9OXL+OO6txmKC4b6MSa1hkIWmRxG/Z c7P++NA84xoRaIN65yarCnikxv7eubeGYd+4+3YYFuCmsGB9gF+yNDSmgg5q/CvG76w1 1vSCVIHUZ3RE63b+ASsSRGbY5RbmGsY+rmqZ78/AS+8wmVNgxjv+MPJLTXvmP1gSwWmW 7vr0I/65XGZdpl3wlX8UBllpGUYVz14k+8JCroc1L9XMBWZZ3v3qUXqca9svveU5F1NN 5jhzZCvXPX/YjZHC3yigSuim1DwqSRutmDRCVFFTFda/Ps8z8UFEZddTKIzvcd20M6Mz hwqg== 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 q1si8504747pgp.370.2018.04.22.08.04.02; Sun, 22 Apr 2018 08:04:16 -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; 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 S1754528AbeDVPC7 (ORCPT + 99 others); Sun, 22 Apr 2018 11:02:59 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55086 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756674AbeDVOM3 (ORCPT ); Sun, 22 Apr 2018 10:12:29 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3BC05C97; Sun, 22 Apr 2018 14:12:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+a67bc93e14682d92fc2f@syzkaller.appspotmail.com, Roland Dreier , Jason Gunthorpe Subject: [PATCH 4.9 39/95] RDMA/ucma: Dont allow setting RDMA_OPTION_IB_PATH without an RDMA device Date: Sun, 22 Apr 2018 15:53:08 +0200 Message-Id: <20180422135212.021833780@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135210.432103639@linuxfoundation.org> References: <20180422135210.432103639@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Roland Dreier commit 8435168d50e66fa5eae01852769d20a36f9e5e83 upstream. Check to make sure that ctx->cm_id->device is set before we use it. Otherwise userspace can trigger a NULL dereference by doing RDMA_USER_CM_CMD_SET_OPTION on an ID that is not bound to a device. Cc: Reported-by: Signed-off-by: Roland Dreier Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/ucma.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -1231,6 +1231,9 @@ static int ucma_set_ib_path(struct ucma_ if (!optlen) return -EINVAL; + if (!ctx->cm_id->device) + return -EINVAL; + memset(&sa_path, 0, sizeof(sa_path)); ib_sa_unpack_path(path_data->path_rec, &sa_path);