Received: by 10.213.65.68 with SMTP id h4csp524399imn; Fri, 16 Mar 2018 10:21:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELumZwINVxE1TccH0UaxQk/FZ9zmMXGuTgwJAepZ4IjPjgIzozUZYMC4GrRIuKYgcxnh8YKR X-Received: by 2002:a17:902:6b02:: with SMTP id o2-v6mr3034086plk.334.1521220893578; Fri, 16 Mar 2018 10:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521220893; cv=none; d=google.com; s=arc-20160816; b=OgaZaPzsaRGWYnhbPDem3+HliaTqasGaQ/G6OWA+V3YG0iz6/hq27COU/+HlKqS7LG XHJttWUQjqdVZ379hbQATUw/X7dfwVRwDhbjrjgU3Oucf4Pdcu/c2i2ZPg833Z1ipOpb +E45aMcR+5K7MjynzJhOLLKmZSJyliWBD9NncbsV4be8TWl+fsYhG/uU5BXo/i3AhU3N 7OZ6dxEjuuvGsxh6Xu6OqBe+8K2CCYl+ndMoj9TEfYCdsakUmQj740XFSjsRvGMiHXwF XpwYCuljicuRZ7acHQaONjbKhBJTzOSn56kJDVtAZ8XZwh3AuvoY0u/LVK5TKtcmZBpC Uteg== 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=aSaJCvzUq4EYO+0gQwRSq157nKm5qimArNfKXsV5bQ0=; b=yhN342GB8TkwkqfdIA5SzwZJPHAesPi2oDBmS9G0OChdgsvAsQp8dbuE+Mr7DJdCa+ k2d2O0tVqhob/0/HUrdLPsmXhQN7yDY3l1rl0jyjHMTXdGIC3r9akkoUiRj4nAhYOgQR O4yT916NV5vsjZQqUC/Y+9klEmOe1lPVIpksq14FP3lb2XERgaODf6PNpJYo0cVqab98 tD+H8ESS5hBdTXh4oFxVlsUr7w7nu9IiJ7QADYao7OiU/vFCZpwlx0NSuaom8v6iPJS7 OzsjHcMxh7zSPiz4lYC+OzrN/rg4PIus6c30pMV2DWkatRUoaGeCPMP89A+9kCuqlg51 NQoA== 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 h128si4516353pfb.152.2018.03.16.10.21.18; Fri, 16 Mar 2018 10:21:33 -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 S933171AbeCPP34 (ORCPT + 99 others); Fri, 16 Mar 2018 11:29:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36282 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933156AbeCPP3y (ORCPT ); Fri, 16 Mar 2018 11:29:54 -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 036891010; Fri, 16 Mar 2018 15:29:53 +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.9 02/86] RDMA/ucma: Check that user doesnt overflow QP state Date: Fri, 16 Mar 2018 16:22:25 +0100 Message-Id: <20180316152317.340375859@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152317.167709497@linuxfoundation.org> References: <20180316152317.167709497@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: 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 @@ -1139,6 +1139,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);