From patchwork Mon Jan 29 10:18:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Izard X-Patchwork-Id: 867052 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kMwCc0At"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bonODVfe"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zVQVn5lN3z9s7M for ; Mon, 29 Jan 2018 21:20:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=yBOQFOeVQesdNPBZ/BdhpvJZrOSy5vaHOB1Yiy3SyQ0=; b=kMw Cc0AtxexNm9SOAGGwtdUXd6r4h+27Mre4voAyoEZdsrhXMkE2xptXsrT+Itp4G9n1rf90+eKbEFlt yyz2CfkKHU7R4YnwzPZitHlvStl3Dwc325/v3rCWQijP6MxrRVaP6/KwX0YGGjvRrCJtSM3BkvmHr K8JxU6vtHjTX03ZC0vHXYEWqMzqiUT60ma36MLq/diPVoIOTbPp4fGLUC6JwQWbhY0rp1+LwFPjRV 88kIKx7hNkQcEYeIiQZV1VwUcAV6ztSGiRDNy+Pbpjp7NzrsAtKHYboLMRxJs0+Y3sq5RD/erplIH z/TQEPlT40MvtRSgGik4aZ5y3Imr0TA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eg6Xb-00035F-OR; Mon, 29 Jan 2018 10:19:55 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eg6XU-000348-Qx for linux-mtd@lists.infradead.org; Mon, 29 Jan 2018 10:19:54 +0000 Received: by mail-wm0-x242.google.com with SMTP id b21so32552465wme.4 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=I+QqiASKZBgi9Qqv3F0UQK/MAiQ1sxk1CzqJPQU4rAJl+DoqCc8iHIiR1p20pekfI8 vLqnXXF3fNS3Aapfzr/ud/rCAcktYoP8rqNzEUnogS31TUuduBHE0V8rJGka90q9TfNQ U6He7aPiDAPXxpn2h1H56+uWCSFQRfeROR96b7Jt+7+8Brr1tosN3vBvRlju4rhYH+lb 4pzsFmY4KHcGEOybFgkhV3s7mMq7mn9Fam2nr5DFY/6NTHA+AuwK83zbKWtjweDgoKnc r6e64xWnz2DSZW7HjMJsP2Q/SEi2+EhbaTMPsRkj5mebNH/gdXXMvdOv+Rp2lxQJmoA+ /lBA== X-Gm-Message-State: AKwxytcAbOhQI56yP88VDl5RkJtTemNC6pXgQPuaXzxSvq08iCaE5nah 0mK0P4bfWjLlCgnhq+UJqLw= X-Google-Smtp-Source: AH8x227/h8xqZ6QMVgSOTfYYQEPiJVqOfqCnet+9Ax2+hvU41OoGXGjg5pNMv/cX9yI1Foo9Iq2TFw== 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 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 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (romain.izard.pro[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:242 listed in] [list.dnswl.org] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Romain Izard , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.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; }