Received: by 10.192.165.148 with SMTP id m20csp2462687imm; Sun, 22 Apr 2018 07:33:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+h4QiXpNCfsIcShgm/gItUR9pD1eYMekIPPiAr1km4+uzW/zzq3folvNNZb18h5vlm4y5n X-Received: by 2002:a17:902:145:: with SMTP id 63-v6mr17562670plb.332.1524407593768; Sun, 22 Apr 2018 07:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524407593; cv=none; d=google.com; s=arc-20160816; b=iiMXtKGWqtjRhNQbmv2YJIUcDxszOFD6jVIAEz/7jiMqu1Xg48iFobi7mpQPZUDWHW Tg8aMY6b3/QmEOhuF00zYI1BqbqK/Z2b7HZYtWzUJrn7bdXhaeqUSM+foAUHShW5JsoI MMfwAc6zd7Z5uOev1Lyp3hlC4C0jVMrFLdTS5XOQ6NHywr39vlmoov1qTAbNPvLaiBpN 7wUHZfm35TyDtwRsByHJDymQV0usavJur1Y6HL+zel1jTJE9+vDnafZ1l7DwTx0s9Ox0 p49izjUHwLnDPoMyNSWQ37+kf9VP2yzLEVIfzH61g60XOYDjnuz56cXz/ZiZ8Hyb0p7w 81rg== 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=swPc03rza7RNiJfAyiaf28WgC79OSTCjOnRvZ34+MCA=; b=usauI8ea2eNUbr/UKw+Daimj/lSrR8ok2X97BJ/B/LkXt5i6WQ1ucypi6hij0RIyp3 eMH1Sh6LCWYpiOty8cQO/tmNGuBX5O+2byN43gqRZScLLYV0jfhSdMv5wQnKDsgZf0wm yHTiJ5ynpIl2r4q8MW1J9wKp6AwFIs1BBL5LGbEA0t4x5q9vW3LqbU5VWqlVlg99hzFd SPk9mfZvb0BPuEF3tQ3X1dB825beCyDzdVQSkqEW9nryUStju245u42j39jLvKiKH6BL 6AbwNkaI1L1N+uUYFOu6p8k5IEPw2mdJoLh1MmQNF4L0XMbkkEFvYGQ5QnJ3UfkoZEIo whiw== 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 k1-v6si9585125pld.267.2018.04.22.07.32.59; Sun, 22 Apr 2018 07:33:13 -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 S1756891AbeDVOaI (ORCPT + 99 others); Sun, 22 Apr 2018 10:30:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60590 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757377AbeDVOUm (ORCPT ); Sun, 22 Apr 2018 10:20:42 -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 1F04798C; Sun, 22 Apr 2018 14:20:41 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Romain Izard , Richard Weinberger Subject: [PATCH 3.18 08/52] ubi: Fix error for write access Date: Sun, 22 Apr 2018 15:53:41 +0200 Message-Id: <20180422135315.627466410@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135315.254787616@linuxfoundation.org> References: <20180422135315.254787616@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 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Romain Izard commit 78a8dfbabbece22bee58ac4cb26cab10e7a19c5d upstream. When opening a device with write access, ubiblock_open returns an error code. Currently, this error code is -EPERM, but this is not the right value. The open function for other block devices returns -EROFS when opening read-only devices with FMODE_WRITE set. When used with dm-verity, the veritysetup userspace tool is expecting EROFS, and refuses to use the ubiblock device. Use -EROFS for ubiblock as well. As a result, veritysetup accepts the ubiblock device as valid. Cc: stable@vger.kernel.org Fixes: 9d54c8a33eec (UBI: R/O block driver on top of UBI volumes) Signed-off-by: Romain Izard Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/ubi/block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c @@ -322,7 +322,7 @@ static int ubiblock_open(struct block_de * in any case. */ if (mode & FMODE_WRITE) { - ret = -EPERM; + ret = -EROFS; goto out_unlock; }