Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4815411yba; Tue, 30 Apr 2019 04:59:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYl0Tw9tVfA9QeBmRS6EPoofRHmR+RKGw7eWUPp+OQ726RF1h64/6Ay4RK4uhOi9avRbo7 X-Received: by 2002:a17:902:7084:: with SMTP id z4mr70808747plk.305.1556625577049; Tue, 30 Apr 2019 04:59:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556625577; cv=none; d=google.com; s=arc-20160816; b=SN0tVsptvQ3xv0N6aXvRxEpwg0VXR1OLHxbx2iXMZhzeJyNfF4130ofDJGinOGBWJi dSC5eGRSa6LB5qobAGwbkuKzwqibRDoP/ml//WeXPFa1Hn8NduGf0FihHPLsBB4KPIcl r93tbRrxTaQu4nuQzyf2Ppm/Eez052LzUD0pioOlfZxizFsm8W8WIF73TlSwQnkREw8f dH8WbRswieP5Cz6+B/06QdMVg7zdwEiRnOiYg+eUvo8IA6VhvF78ecQtiVpk4suebrRL AU/CRQ3slEx1epYXn/Cvr7Gw6tOPGG7Zfr/E/1EotZBP2fiU5mj4O0T1NqSzEafc1Fin B5Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t7pwkKGsQb4z+H0xt6ZV1sFMOVu6maaxksN5ZtwCvAc=; b=jQREzv+XM698YhYPEFgjACwFL1xzXX2Hs5ZsLa39+qEcd+OE5QzAh8CwJroGtLpFL9 Nyr9BtgSHA7Ss0f7uV9GOXTpWr03SY5hfGcJnqvneqxHsKFXwrlrfna8SaVGG+JpRnUF HLMwH52jyXuLMZw5og7xVZGbUseHK8LYIJ0kYWIRWJzklLY1OmlG9FrTUElS0V+9Ywkk ELmqv18cFItbjovWpdQfnsEI78EKxIYDaDZMO7Ubcu1nG/CjOo6lgMYJ1bqSQ7uuiZVn qcb/cCh/QJuXxC/RmpvVvdm5yRaKmCIv0MK7y8L4cx445YFZGhN1jbT7JUZZyKmrKREa H3Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lQlyzBzs; 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 g19si26002819pgk.532.2019.04.30.04.59.21; Tue, 30 Apr 2019 04:59:37 -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; dkim=pass header.i=@kernel.org header.s=default header.b=lQlyzBzs; 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 S1726758AbfD3L4e (ORCPT + 99 others); Tue, 30 Apr 2019 07:56:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:34900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730866AbfD3Lsl (ORCPT ); Tue, 30 Apr 2019 07:48:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7902B20449; Tue, 30 Apr 2019 11:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556624921; bh=TKqAad3HeCTQ5jzhurH98iRs8WRCsusuiIuMh6eGFjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQlyzBzsWxcBHwvdqU7LxmzNFreBQDY77LN9+DwGjNj22iA+SeNuSEiNMTSoAqEwZ u1PpzVQlTzO1l+8DjVzFfY94M77RJB9eMTkxUqI0hKq3wGX484w19SDExLTmDD+aGq hJftTl77n15B9jkex9uIq+MhanK7wX0vOiIdEK9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gunthorpe , Haggai Eran , Leon Romanovsky Subject: [PATCH 5.0 23/89] RDMA/mlx5: Do not allow the user to write to the clock page Date: Tue, 30 Apr 2019 13:38:14 +0200 Message-Id: <20190430113611.124712220@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113609.741196396@linuxfoundation.org> References: <20190430113609.741196396@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason Gunthorpe commit c660133c339f9ab684fdf568c0d51b9ae5e86002 upstream. The intent of this VMA was to be read-only from user space, but the VM_MAYWRITE masking was missed, so mprotect could make it writable. Cc: stable@vger.kernel.org Fixes: 5c99eaecb1fc ("IB/mlx5: Mmap the HCA's clock info to user-space") Signed-off-by: Jason Gunthorpe Reviewed-by: Haggai Eran Signed-off-by: Leon Romanovsky Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/mlx5/main.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -1982,6 +1982,7 @@ static int mlx5_ib_mmap_clock_info_page( if (vma->vm_flags & VM_WRITE) return -EPERM; + vma->vm_flags &= ~VM_MAYWRITE; if (!dev->mdev->clock_info_page) return -EOPNOTSUPP; @@ -2147,6 +2148,7 @@ static int mlx5_ib_mmap(struct ib_uconte if (vma->vm_flags & VM_WRITE) return -EPERM; + vma->vm_flags &= ~VM_MAYWRITE; /* Don't expose to user-space information it shouldn't have */ if (PAGE_SIZE > 4096)