Received: by 10.192.165.148 with SMTP id m20csp2531031imm; Sun, 22 Apr 2018 09:00:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx49/eWX35uTNEX7D3AmYEs6fy2QayyNIlGtvpiUhZTwEVFlgQY7EOwk6YDFCKLJaoGGZMEus X-Received: by 2002:a17:902:14cb:: with SMTP id y11-v6mr17753990plg.23.1524412803824; Sun, 22 Apr 2018 09:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524412803; cv=none; d=google.com; s=arc-20160816; b=tmVb2hJrUImIgoMkjb8Bat3kxNg1S02mOzmawQkqsnoR21QTTqFJur7Tc6istjQpRk HxbK9l3UjdxA0sFk9ME9RHdx0+n8yNqDm2OMyYZ3no5RDYFGIbH345xuCSULvwg9xNb3 r4PwMNrpvjD+q52JrObAgi1sfljwa21dWHP4tzBAI4x/OcB/5x6seXgb1HZDiW9xRgQY /bC9eOJ6jpxO1YBJankbstuQqcsCyBerJRMlt+9kf8NFn/lqt34YwlpKxgUF86tIuHBq UjxO7OWp2v9wGQKpIboQTxvf1mAH0EHN4mEClhbPHK5RQxvbQM73DBJWw7NZrdDKkneU E9fg== 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=SQpwGU8mtXe0xjQehYcwfU9mONQDwphfiBfzEkGUFL4=; b=A/IooK+vwKAQX9bqVbjE6M+9SXSk4nue4HUo50FCKWkbNn/tMpYDGwArs9HCxqp35x 8bTBSQpIy3vr7zqvjW0hhOXMTxn7n14Pimc+SZ6LX/w56LqsTGw0TdrZaVlJ+/aFYoSQ bquqDivGO/iGbH1LHnB1ShLZTNww2yncMj7l2cd1mTWxYWaXIpyz9M+oGh/bCyCJgNwR hhMYV9TTVqFUpsZ3H6Rb2ZXt8XZq66Kz5WaFIAbvMELl7r5gt5eR3LTd48CMM1WVs/AC XYiiX+91JrBmlgm+tnxb/DVbzh9Xr/wJ2/kGJKMAAb7PNUGUUeQ6TzWHJqu8tMOQ3J5v z0cA== 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 9-v6si10191631plb.415.2018.04.22.08.59.49; Sun, 22 Apr 2018 09:00:03 -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 S1754240AbeDVN7B (ORCPT + 99 others); Sun, 22 Apr 2018 09:59:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46432 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753529AbeDVN6z (ORCPT ); Sun, 22 Apr 2018 09:58:55 -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 5047ACEE; Sun, 22 Apr 2018 13:58:54 +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.16 102/196] RDMA/ucma: Dont allow setting RDMA_OPTION_IB_PATH without an RDMA device Date: Sun, 22 Apr 2018 15:52:02 +0200 Message-Id: <20180422135109.531229931@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@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.16-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 @@ -1241,6 +1241,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)); sa_path.rec_type = SA_PATH_REC_TYPE_IB;