Received: by 10.223.185.116 with SMTP id b49csp8738520wrg; Fri, 2 Mar 2018 07:08:49 -0800 (PST) X-Google-Smtp-Source: AG47ELuVMjWi8uSi6FH5h2gcSV5rlAw/Qw6/xK8Sqi76LcmNKvVTr/YSGQqjyO96Gm8px8Kx0n3R X-Received: by 2002:a17:902:8215:: with SMTP id x21-v6mr5616174pln.164.1520003329253; Fri, 02 Mar 2018 07:08:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520003329; cv=none; d=google.com; s=arc-20160816; b=glh+yy2vEJhFOcZNGC4BpxWAuFgb2e8k3G8q7D9Enf27t1ILVv7qoSUPzMncg7RLtj FLrTfcjrGA/2Sgy17LPSXjvQs/vlhIl09pGX6xxXNXSK0CA7oQUwIpLmJ4WHtetfbfCU yotye84gOMezWmUh71EVDoIpox8NWyslEq/DlvIUVllORTzLJbmBWAkAQsynRTRN7WGM OTeJsH+faHKWb30uABFDgGYqU/gyMFcyXbDsR6TvfiZkMCxzP+FMbmPvmctOK3fwxW19 u8ezS039rFB63QoiHWp8uMVW1G26O1e0r0tFk4FeGx632rFKsRzlOnSCh+p0Dt7A4zfu uf6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=oFTGaPzsFbhVhw19m1JzdBzVp+xtt6rLAufJyO9Vwmw=; b=vT9TBwkXDTYed9obIJdFfsL7pincLkuzChg2MSzV6gYgPR6wNBX3Nqp5Yzf4z13evQ kZHMzYQFoDpo4vLwzbGziJZtaVw9ruXCkrbNPZ1MODPww2h1SZOLIMDPIJQMFTN6Lafu xpMrmxrAoNVO7MgP7ta0GPcMd0afrckUWca/ExmjYALdLCdwi3BpMGAYj8dZatWP3ggs LNYEAZeUVeDNVO+jzqP9xEHlRR0cT8CeZaGyrwPaXsge6AaQnXBkiXHxcqK6KdIgItMI NSr/Hp9JKi9f9yBg0jB7k2NL6eQStmDKcjsEuMnbYHTGy6H25mwSkV5DfgbihCqFRYOb I3eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eKkQRFi8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i124si3353510pgd.576.2018.03.02.07.08.34; Fri, 02 Mar 2018 07:08:49 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=eKkQRFi8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1427044AbeCBLQ4 (ORCPT + 99 others); Fri, 2 Mar 2018 06:16:56 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:38932 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423429AbeCBLQu (ORCPT ); Fri, 2 Mar 2018 06:16:50 -0500 Received: by mail-wr0-f194.google.com with SMTP id w77so9708549wrc.6; Fri, 02 Mar 2018 03:16:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=oFTGaPzsFbhVhw19m1JzdBzVp+xtt6rLAufJyO9Vwmw=; b=eKkQRFi8V83Un2bSdoHs2MIc8UD3MYjHSglUGTaw25UD1SBhXXySamvhciJndgReX7 svutzii/445GQPzlsoKWnZbZowN7WLi5iu6YQ2ttkKRW3WWXmkVhcITcKEa57SMfVaWe TjrtdtCtjs6wOzmp+xMTh9iQMMqPCQQZMsJZWC/JxxQ7MPj1OXh3yTkp2dlrp9txfk0X 3VXpGRlyFyxXLTIst5Vb582JkLDSoq3Zksi76ivHJYwK0qRleGpwD4mjY2e8xkYuaczo 0IWfbYOolxGloBDWO08fsff/amC5ck16oJLVtqSbWuESr+LSu54ZKLJw5H3pWu8eu/kp uz0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oFTGaPzsFbhVhw19m1JzdBzVp+xtt6rLAufJyO9Vwmw=; b=dbQmKwcm/NblQVgefID98hKjHNTxUAhCwCWvNTZVvIOixrmXM1AG9MOae7DCKGhZkM Ofr2nOzUrLFCsYo+z5DclsS5cSbqAaYEMfsI5TCPZ1BZy0TlDAVDrlfcTJktwrsibrKB frpp2LUrwwVoERCtCU/RpbCsNQQx4cG/o1VDJoyTpaE56f01X7unBfJlQWf0vp8AGM7q HOHEKzMtLQWn+NRHG8zHOGhSy58gCERaviYXd1IW+LsbbFInLW7BiktaaLc92AfHFkuI Y1XtdPQ6aiTHHNRYnnjvmQ74jmViIocdONeDjWH/OOAUbSsC+ogxKXJqP9x2VI8YuHsR Lt8w== X-Gm-Message-State: APf1xPD0+IwvnPoJk0J6hrqdnRh8FR5cFFalqTxy++BRBPSimr0YZhFm HJ1h58qMb1gi3hvnHS2eJk4= X-Received: by 10.223.179.211 with SMTP id x19mr4581564wrd.175.1519989409151; Fri, 02 Mar 2018 03:16:49 -0800 (PST) Received: from localhost.localdomain (146.187.3.109.rev.sfr.net. [109.3.187.146]) by smtp.gmail.com with ESMTPSA id 59sm5340000wro.57.2018.03.02.03.16.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Mar 2018 03:16:48 -0800 (PST) From: Romain Izard To: Artem Bityutskiy , Richard Weinberger , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Cyrille Pitchen Cc: linux-mtd@lists.infradead.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Romain Izard Subject: [PATCH RESEND] mtd: ubi: block: Fix error for write access Date: Fri, 2 Mar 2018 12:16:18 +0100 Message-Id: <20180302111618.22820-1-romain.izard.pro@gmail.com> X-Mailer: git-send-email 2.14.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Fixes: 9d54c8a33eec (UBI: R/O block driver on top of UBI volumes) Signed-off-by: Romain Izard --- drivers/mtd/ubi/block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c index b210fdb31c98..4533423cf2aa 100644 --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c @@ -242,7 +242,7 @@ static int ubiblock_open(struct block_device *bdev, fmode_t mode) * in any case. */ if (mode & FMODE_WRITE) { - ret = -EPERM; + ret = -EROFS; goto out_unlock; } -- 2.14.1