Received: by 10.223.176.5 with SMTP id f5csp2690364wra; Mon, 29 Jan 2018 02:20:50 -0800 (PST) X-Google-Smtp-Source: AH8x225dmXPQfazRjq69x4gvrrTc1tuDmasU5NMOZnSscV9zDrN1f2s3TjHiyUpWrwMd+vR8mu6V X-Received: by 10.99.97.209 with SMTP id v200mr20781534pgb.126.1517221250084; Mon, 29 Jan 2018 02:20:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517221250; cv=none; d=google.com; s=arc-20160816; b=i+AI3Zr6l02dnvJeyUokeGmXPDwQM6bO88wlcHv0sKyDaYDefa0LG0irrCo3o3Y5v9 Dh/rtAgnZdpNE9d4s6jg4kOOYr7BFwK5JRFxoM9n788M6M7NQOpr/mN2jvm9iCkncra2 n1f48qkXf37RAcHffO4zgudWkv+GxoSTOSkvQa5hCKEH67o7F3SRTnCuM3KsIUkHFEwT KXN/iWDqP80KxDPjNY1R4cbq5u+d/9pANBz4F36pECfx9MTbnk1woa3pPzK2l4nNL819 We/WS8vqkPzfT36q+HusxUNbskFicNSqmCW8aEA9smt6c3yP9ZDhcfswoVFS802oFI3i RlWg== 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=E4zMY67kyfHIjd6DFjWcwlOaBOmogGm68ZlmjLzM8tYjBHbGvLDyXQPPFCEO74XUZw IAKl2HfbGCn25d+zQqgvjoe6GrNIDN5dl7XOkHPqEHpcTxtJ1oQj4/9ee7q9GaUSNu6g hgC5R8IO5tqf4trTkXuN06d2NirLCazlyt8rgtAcQbcJAaHsJjjCj2ZOqQ2/xLErzTFM so51jiO1RoB9f5vnCP7nxMntciZ5ruXCd234fY7VLOy+AaNgESj8VL5gNrISfACp41wO eBbertRfDNYRRYmzZKlyjh6Q1lzoNgzb0lY2TBPK/FE+zAyW7q9oCCAcGNafA/wGdjxJ RiGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bonODVfe; 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=NONE 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 u69si7203426pgb.10.2018.01.29.02.20.35; Mon, 29 Jan 2018 02:20:50 -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=bonODVfe; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751657AbeA2KTh (ORCPT + 99 others); Mon, 29 Jan 2018 05:19:37 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36043 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750913AbeA2KTf (ORCPT ); Mon, 29 Jan 2018 05:19:35 -0500 Received: by mail-wm0-f65.google.com with SMTP id f3so32566188wmc.1 for ; Mon, 29 Jan 2018 02:19:35 -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=bonODVfe7e5AglIJuItBwoiCajAegcKFxBpmCSCSqOYmsd1InozLGPaIjKLYzxfZos VrN2zWAnF4RDEpiqtkB/oroE+moWZZY3syzB1AXq0K3mM+Am/bD0vFxomPCZqGQZNcxw RezfMXIatgIdAUylCocBgX7oDZjPXUpnSABIoFrSiJ2upQJOR+8N7gZ50lG0RzV01NFJ liLG+xvyOdO1yhS0cIA8weGsTSWEhSgtl0mlASpEh0ZK2t76qZ/9hzPlG4CTWxFX+yhj bgBRwZwDz9LN7fw14taVKN18dQTzW6XqmCWmWKglJhxleRAz9RS92FLygFKvaKfkIqhj gjPQ== 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=QGJUigwlTr0ZG9VYXQ4AOQeaXs/Qr88Y1GLpIADomhP+1/gEIFHsrtrmWzi+7z0VJX ez7Ro/OUDn2VksrJhhuQ9URBg7Q3WSOjUMFF4gx/mYmE1l8CFwXNBlCPY3AEvXiVt3xb CANYMtXQW5mWoZarGzubur9QD1Up+b3h6L4mgr7779ZSriCxzvAXzWGmdvVvGn586AKm PIEsbxZJk6Eixt0xNfJ+SK1czJtFab8hagvgWPdUIGrGxgGpPv4aWuGT8N+uXxofUrgR yP5ZEYROSKogi6UZGTm3dhzt2ltkmAagaGPS4AyXvIXETRIz36r+s9K602QlmA8U+1I/ WzoQ== X-Gm-Message-State: AKwxytfIBIrBT3OKCAMTj8uc+JcLlsn22QUWhmqHNp83G7VqP6r3Ka/w 2Y9nBLtSajp0mUiaOJPRwgQ= X-Received: by 10.28.188.131 with SMTP id m125mr18947578wmf.39.1517221174612; Mon, 29 Jan 2018 02:19:34 -0800 (PST) Received: from localhost.localdomain (146.187.3.109.rev.sfr.net. [109.3.187.146]) by smtp.gmail.com with ESMTPSA id u79sm9634186wma.10.2018.01.29.02.19.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jan 2018 02:19:34 -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-kernel@vger.kernel.org, Romain Izard Subject: [PATCH v1] mtd: ubi: block: Fix error for write access Date: Mon, 29 Jan 2018 11:18:20 +0100 Message-Id: <20180129101820.1692-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