From patchwork Fri Mar 2 11:16:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Izard X-Patchwork-Id: 880449 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=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Gehhu4UN"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="eKkQRFi8"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::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 3zt6GF6hlyz9s4w for ; Fri, 2 Mar 2018 22:17:25 +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=Geh hu4UN8woISFfHWzw9NNtMN8Sa0o5IIO0KwYrVvQh95dvjhSfB4h8g9Caa5uVUTM1xLgxi514z8QBY iflMvuvBjlQbkkHjI+iGXhbeKh0cyjkuXeDK/2sUVDsUCrO1EKCuVNYspbClGlP2uRk5Ouam70WVi zzAQEgm1P7ZBP1nYC+2RW2t3NsK4qHD8azc+7EpSgBA9yHG20c5fRuoK5OBhKvooM+lAO6bRo5uvM Q2f+H3tx7OyIUfkVYxHGkMo4d0rcxIwsaLvJ9wkCg+Bry8SWe+cslNpwi7JsF8toweFWGnLYW07lN pjcYIxoOzkVw6k43RFn+2o51gjTwmfQ==; 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 1erigg-0007CX-MQ; Fri, 02 Mar 2018 11:17:18 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1erigP-00079G-FY for linux-mtd@lists.infradead.org; Fri, 02 Mar 2018 11:17:16 +0000 Received: by mail-wr0-x242.google.com with SMTP id v111so9701918wrb.3 for ; Fri, 02 Mar 2018 03:16:50 -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=Q11FGcy25ALIu288RDJ7EOu0Utt+GU0TJmFONTryHpE3ggnBjnmjLK1kwA+rtAP8HA j7fauXA+az3G84azALiy6PEd1OZXOZhl3hqxkz4UXKrlQP6yleCB5Pb2IcYYEPw3gFUL KHs/XuXatEXgmY87M7WuMGt/9DEZKTZXy2GoyRgBvdmY6dbTdsxIqshm23QMfq1lQCFF KlrobfOPySwZ84UrNvJPbBOFmqoxFVC6cHwZ/sFVbCywghqo4v+nPw6SQYiBXztDtksU W+xeVwmVRg5qzRyEOOeLneJZD3+wdFj8DHuqdCiGkZrGMsQB6FKq8nmtOpZcTWav09qk N3aw== X-Gm-Message-State: APf1xPB/Iyq9hC682lG0YXuboSdDL4pI1bNX8D+cRCqqFSiXNWUD2gvh b/QblwUokUl3p/Xp/UMUD4JCDQ== X-Google-Smtp-Source: AG47ELstdCbMY86FXSj4G3WmcjiBD4RjnxMxteJv51UdHFTK7H+EBeEEhGw1UOS5YWYNBkowGHt7Ag== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180302_031701_709309_ECDDBE34 X-CRM114-Status: GOOD ( 13.53 ) 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 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c0c:0:0:0:242 listed in] [list.dnswl.org] -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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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: linux-block@vger.kernel.org, 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; }