Received: by 10.213.65.68 with SMTP id h4csp461855imn; Fri, 16 Mar 2018 08:28:17 -0700 (PDT) X-Google-Smtp-Source: AG47ELsWa0Mnk92PzduLsdMfGuI0c3NNtUFqG1wHSsW0S9MvBAuiWX1RMpyaNxQjKTiuyO8gnhQh X-Received: by 10.99.94.197 with SMTP id s188mr1737068pgb.363.1521214097097; Fri, 16 Mar 2018 08:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521214097; cv=none; d=google.com; s=arc-20160816; b=l9yia3BQ09Bgastfv3Z9YjaXWYKziH5JZJGkbfmEjpS1+bFxRGlVYYmNKDOKXbBBzb Mkf3DesI5t3Hd1YUaFHQLFo/i4crlCharrVpjCzT3oS6MdvJqaPsAn3rol11bSxmQ8bD vypsdFRQzfKGh5eiXy4ivD/J5XjWLykW+UxwnowWX7gzPdYg1Z7LX68RCRYoggqqlQEl K9fev9bfBN8uCm7wILwKYscanikHceQ0LSF5J8CEm7DU6VfmeZHDPLIPdlIYfQ3pkCSL zMM7FiM9AqC1BAN7kSaiA5whOkgq/V0e82PovHqNexcVl61Es4+0od989w6Hc9xqNzSO zy6A== 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=Qjc4/uF36jNnyGu59Mp5T2399AK+u+jLZdbu8TOLJXw=; b=04xHI1QR/9aad7ATzpSztfs9GgUetoCXcKGLLysUfPfAqb0b2RmKIZ91YURwiImQEQ hJMul+CYXTM9Kxy+hRokFgmgw5CPeS6IbBSrR4bevExlSLvCh2IMaRabrqtdyjlFCNrT 9H8R6mkHHi4ZIHlufwyRYbMuaonDxr4gu/xTwFYOuR17G0fMWUgsZ/XVo/1S5SxT6Fbv ZymUfK4nieF3v4rUpCxLM1Q5BKL5mRjALYso6CeDGrhj34fAIz72RPxq2KjYpg1K6rE5 ZeSqGWYcTsdOnNztsaLYCjZ0ml2xuI+8f5f3A+M1aBogJDZUQeKNkTTi0fRMUPXPNAGy NYww== 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 r7si5225323pgf.433.2018.03.16.08.28.02; Fri, 16 Mar 2018 08:28:17 -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 S1754163AbeCPP0x (ORCPT + 99 others); Fri, 16 Mar 2018 11:26:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33992 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754152AbeCPP0v (ORCPT ); Fri, 16 Mar 2018 11:26:51 -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 4A0821239; Fri, 16 Mar 2018 15:26:50 +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.4 02/63] RDMA/ucma: Check that user doesnt overflow QP state Date: Fri, 16 Mar 2018 16:22:34 +0100 Message-Id: <20180316152300.209728755@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152259.964532775@linuxfoundation.org> References: <20180316152259.964532775@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: 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 @@ -1138,6 +1138,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);