Received: by 10.192.165.148 with SMTP id m20csp2470822imm; Sun, 22 Apr 2018 07:43:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/h9Qz2dlS0YDUm1GS5zZrSCyquBYVw/h00b0nRNx5wthS8TObF3EjYTPBrRoo8/UcI5ou/ X-Received: by 10.99.95.76 with SMTP id t73mr14404473pgb.226.1524408224551; Sun, 22 Apr 2018 07:43:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408224; cv=none; d=google.com; s=arc-20160816; b=xh76JoQKaCqy/qWiGNZJV2pLVkEdUz30hZv/Huae7I99lE8LlhfRuPwIKNO20VyS4V aQW0S4vlc2eD/b2TuoB2qcbcMt1HOEFpQYsCXZoOXymmH8veylzUNWD3aosQsg/rblK0 wUuNyfX76OIMQRPT4wZYF/+T+oD9TNdSuwqOpaJhqXRP1H6TW2LJO0Cm0ZO9PuvWsdgT wsM3zdRwWKHRmnGPcNfmKQi7bqjqb6jEiQU1AAp8WF1+Wpc3Jqol46pAuQ3c991yUcVk 49+Sa6aukv5aPPLPjk7NKEo63EsQRM9KOvQYApVLo8FntygiHvjpJVeVH48XuQK3uWL1 N4vA== 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=wp5E47IF98bLYNRCMPVcSvMZpvUFVuoPZWCjufXTzkI=; b=bKnNttj84EiwOT75sHWA/YZnb3pLznKU14CUPgSeKr1q4g5sAdQji2lieaG7yrQib0 Mwg7a1CC9zF000GSv2IGsMFmgnY1VU2OB1pPSSqIeTrU7RxWgvB0av7QCfYK+tvAkg1o ZYtF7mhT6Hez+tfbJ/QBQSYijEeO2nAlXbQ1MpZFtC68g6JB9Sdts58OXUsDGmXml3LF EIW8lcNn4kCCR/c2T/p1XPQeKXOaTSbhtwb/lANY6GLno3aFSfXCExx6xHiTcXHudaZO 8R2H5pNra3r1J08aHUQPCivROKCL9IVROXR0S4ErIBs07fqi8gysmxYDx6AeKxnEnV+n j1PQ== 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 h186si8491594pge.324.2018.04.22.07.43.30; Sun, 22 Apr 2018 07:43:44 -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 S932506AbeDVOma (ORCPT + 99 others); Sun, 22 Apr 2018 10:42:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58298 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932458AbeDVOR3 (ORCPT ); Sun, 22 Apr 2018 10:17: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 7F2D0CCC; Sun, 22 Apr 2018 14:17:27 +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.4 52/97] RDMA/ucma: Dont allow setting RDMA_OPTION_IB_PATH without an RDMA device Date: Sun, 22 Apr 2018 15:53:30 +0200 Message-Id: <20180422135308.188699684@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@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.4-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 @@ -1230,6 +1230,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);