Received: by 10.192.165.148 with SMTP id m20csp2490413imm; Sun, 22 Apr 2018 08:06:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx48H36HsM+/x/n7yonTraGi1TIXfspASM2Yy9wMESmxD/0FadM27DNQuvhyTP3tiZbX2ANwh X-Received: by 2002:a17:902:64d0:: with SMTP id y16-v6mr17430790pli.349.1524409602677; Sun, 22 Apr 2018 08:06:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524409602; cv=none; d=google.com; s=arc-20160816; b=v+9QR1zrm1PIM2v4voWFlFNhKnsprimKKPk7K0ISKvapeoliBUvwL79xxvKpl0DirW rXQ/BMOigDmE5fDc0khVWQDOhfmXYTLM6IYT+hvPY6Cw/fYGHyXLac9g911Fhc5NbwRC TX6tXdrAeMR0LjK3+xgO8cJ6QImBPYlJQLT4sAyKo57mfm+3WGuafDe08QVH9P76867M zM+8+r/Fzbb4wGH7tCM6Fj3tqsL2bK/iXlfe0C9qwpreA6XNeNvZjZ+sN1fHEfes+Yq4 Dc/z7ZXrFURC+u1OkCl54v5q6vcZoxwbMORpICWXB4IkvKGjQfkdPfsWxB/ChP1b4YME aRKA== 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=UsSYM4DNds6yAXWz3w1bl4uDtMnPPebnAEm16rlz6r0=; b=Kvn3hLR5e3Cl4e6F0hcTvH0Khk67WhkHt1FYQ1s420cSgB26M6cpnlJKB9ZKFeEv+3 pJT69vIOmFJ+LaH/OWcLJqdCRdhFekYpBceXK4Bj1Py1O095i3E4+K5cjpduPorHoUuC QD+fr/bfIV1aXj7Qs4+iIG9QCpOq29zgv+/K6g8zoIvAHL2NPL5Ny2J2iPkd5R0RKMUp +cDDsjycnVi3+YzFznxy5uanX5twiXZjHzNpPqWKEV8fiqPrET7zCNWMFOQoflD3ydyD awOMLyyy/iJBNkrukWJ0oLd8ySPqNzke0EvOwiVxJ/KUh2gJnqAbuVkEqrXlY6dYXZfy cGYg== 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 k25si8309950pgf.581.2018.04.22.08.06.28; Sun, 22 Apr 2018 08:06:42 -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 S1755275AbeDVPF3 (ORCPT + 99 others); Sun, 22 Apr 2018 11:05:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54564 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756564AbeDVOLp (ORCPT ); Sun, 22 Apr 2018 10:11:45 -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 1A9F0C97; Sun, 22 Apr 2018 14:11:44 +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 4.9 04/95] ubi: Fix error for write access Date: Sun, 22 Apr 2018 15:52:33 +0200 Message-Id: <20180422135210.616401298@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135210.432103639@linuxfoundation.org> References: <20180422135210.432103639@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 4.9-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 @@ -244,7 +244,7 @@ static int ubiblock_open(struct block_de * in any case. */ if (mode & FMODE_WRITE) { - ret = -EPERM; + ret = -EROFS; goto out_unlock; }