From patchwork Wed Jan 15 12:56:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 3491741 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 87B229F32F for ; Wed, 15 Jan 2014 12:56:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 677A4200E7 for ; Wed, 15 Jan 2014 12:56:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 55316200E6 for ; Wed, 15 Jan 2014 12:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751725AbaAOM4v (ORCPT ); Wed, 15 Jan 2014 07:56:51 -0500 Received: from mail-ea0-f176.google.com ([209.85.215.176]:51719 "EHLO mail-ea0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751632AbaAOM4u (ORCPT ); Wed, 15 Jan 2014 07:56:50 -0500 Received: by mail-ea0-f176.google.com with SMTP id h14so454067eaj.7 for ; Wed, 15 Jan 2014 04:56:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=r887LcqE4cZlFc4ahhQyKeFErxz91EIjzIbPWbjv/qc=; b=S9DJ0p1EOzi0x+MvmbZC7mNeSbEkhig3EkpG417zXYG/1pH+V+LXU2i9LKUNp8T/tq bvaRQix64dJ4VPXkaXrObSjAprTXT+JnLoHbx51cbQv7/tiB0nAV8TeoJYwsd/ZRRS/e eRsYy4JHjLbB9pYRx+6WVhGVvPrEzB7TN4bj0s0ixT9xqxhq9E1Qa9Gkraf82RRElQHX Z5rWkrlHkljCDovLkEjUILDIRMykE2JcjQ9ruKeUA6lNou3CJP2BYDbIW7fXU9ZyJiSk 5jtA/JQvW3n68DcmbWsR+OX8VVZP1F2njRwG2aVpdH+6jyyvSltmuj3s+PY4xW2hMQA1 2Xbw== X-Gm-Message-State: ALoCoQmD6IKCepsydGnDxLzfj9hqBN6AfBwQjy2UhoTc3ogRdv9nW2X5ZJGzbpjKzsxDomib72Tg X-Received: by 10.14.99.66 with SMTP id w42mr3382191eef.63.1389790609384; Wed, 15 Jan 2014 04:56:49 -0800 (PST) Received: from localhost (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPSA id o1sm10099633eea.10.2014.01.15.04.56.48 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 15 Jan 2014 04:56:48 -0800 (PST) Date: Wed, 15 Jan 2014 14:56:44 +0200 From: Eli Cohen To: roland@kernel.org Cc: linux-rdma@vger.kernel.org, ydroneaud@opteya.com Subject: [PATCH] IB/mlx5: Verify reserved fields are cleared Message-ID: <20140115125644.GA31478@mtldesk30> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Verify that reserved fields in struct mlx5_ib_resize_cq are cleared before continuing execution of the verb. This is required to allow making use of this area in futural revisions. Change-Id: I5c9c5da2562ab2b04767d0e5cb1d78e960aa73c2 Signed-off-by: Yann Droneaud Signed-off-by: Eli Cohen --- drivers/infiniband/hw/mlx5/cq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c index 50b03a8..b1705ce 100644 --- a/drivers/infiniband/hw/mlx5/cq.c +++ b/drivers/infiniband/hw/mlx5/cq.c @@ -877,8 +877,12 @@ static int resize_user(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, int npages; struct ib_ucontext *context = cq->buf.umem->context; - if (ib_copy_from_udata(&ucmd, udata, sizeof(ucmd))) - return -EFAULT; + err = ib_copy_from_udata(&ucmd, udata, sizeof(ucmd)); + if (err) + return err; + + if (ucmd.reserved0 || ucmd.reserved1) + return -EINVAL; umem = ib_umem_get(context, ucmd.buf_addr, entries * ucmd.cqe_size, IB_ACCESS_LOCAL_WRITE, 1);