Received: by 10.213.65.68 with SMTP id h4csp439702imn; Tue, 13 Mar 2018 09:06:09 -0700 (PDT) X-Google-Smtp-Source: AG47ELv4/SbfQNt6EsjBICSg1/ivT0FTj+IudfSbtXJDI854tAAYtQ+l7GyT1DEugjSP+EXzErFG X-Received: by 10.98.150.82 with SMTP id c79mr1135339pfe.88.1520957169134; Tue, 13 Mar 2018 09:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520957169; cv=none; d=google.com; s=arc-20160816; b=uN4MRvSEiUWs3jcIargnWvJlVspZMhxVPvXLj1ylMhybM1UGYqN8K/2Sjq3sYqwsHy XdGiqYenPeWxORtcnDXJg1gC398Q4SpSTRxfaGwzOcuBPWsm8bqpHz3B1FtmJtgIa/+L 2IWbyM/v2pju8+10n3mQLETyVo1HcxF1m55ckQ0S5GpvprxfDUwH/JfxoziVujPtn0al kEiycRjNJyyGQDEOwKZz/G5b9VmkC+WZQuRpMEVxQikzn5RaRgXQxpwhwEfhhH6P68UY HvttqAdwpGdG1v2R5AMm0mdtkI+T+OTaT97W+beLYkmJmRNyQY3Llz9pU+DDaNYbqFl4 nkSg== 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=R8YgsgBaWgbdxX0LKqP8Hitgx2VafnHihGL6NU84JWA=; b=l2my2vCrghuaboLgZzD6bS98hFR92FjkpWXm88x2jk6Pw1/vgBWp6HIfkRPhI3cCG3 NWx3nZyEKvgnIUGAdjohFjla8yInohfRJlO6EhHKEMgZRtqNwd8ZaFk/rt3K6UkTkfCp hTy3JrCAznOhmDWfNz0WjBuireOlvwk9Fjp1gtpVejF0Ukz9S8a0DftOAmyPgWSNZ/om FCfilDKOCUJekBhvmVBpswvI6304Cx/M0oPP1En7NOhiCuY1owHhx1SCvKypkF20vsFZ qvOwum4sgP2aDf2gbezdmyHk5mOU8tNYsrHidPTDW2H0yZb3M28jfi3aJ0H79V6tDxjh /jjg== 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 g1-v6si288564pld.236.2018.03.13.09.05.54; Tue, 13 Mar 2018 09:06:09 -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 S934340AbeCMPhN (ORCPT + 99 others); Tue, 13 Mar 2018 11:37:13 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33832 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933917AbeCMPhK (ORCPT ); Tue, 13 Mar 2018 11:37:10 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 92F5E1238; Tue, 13 Mar 2018 15:37:09 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+0df1ab766f8924b1edba@syzkaller.appspotmail.com, Leon Romanovsky , Doug Ledford Subject: [PATCH 4.14 047/140] RDMA/ucma: Check that user doesnt overflow QP state Date: Tue, 13 Mar 2018 16:24:10 +0100 Message-Id: <20180313152501.477111949@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@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: Leon Romanovsky commit a5880b84430316e3e1c1f5d23aa32ec6000cc717 upstream. The QP state is limited and declared in enum ib_qp_state, but ucma user was able to supply any possible (u32) value. Reported-by: syzbot+0df1ab766f8924b1edba@syzkaller.appspotmail.com Fixes: 75216638572f ("RDMA/cma: Export rdma cm interface to userspace") Signed-off-by: Leon Romanovsky Signed-off-by: Doug Ledford 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 @@ -1148,6 +1148,9 @@ static ssize_t ucma_init_qp_attr(struct if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; + if (cmd.qp_state > IB_QPS_ERR) + return -EINVAL; + ctx = ucma_get_ctx(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx);