Received: by 10.192.165.148 with SMTP id m20csp2475777imm; Sun, 22 Apr 2018 07:50:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Noqu/wWeCrz9F5i2I+hSw1c63eet6akDLWUmI23CEECP+xIrsnq74YPJrcp2gC9ep+zeS X-Received: by 10.98.34.145 with SMTP id p17mr17051932pfj.236.1524408613369; Sun, 22 Apr 2018 07:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408613; cv=none; d=google.com; s=arc-20160816; b=tkp+V8UVVeUrxQgPTBYYmp84iPp7AHtsbtvGuePh2SZVLYtGAkhyGC/d02unXjsFqB IQqG+MWUcW8t8qTqIJVMt9Y+og6pvkFMg+pE6G5Fm7B4yGT84fPxNX4XsbJqVCW4d7hP RtONf5c8KrZufdKRUHmXFgjo+wT7lF0vGQlf7q0nsH0cFngTi9d8+eg/FXxOBOZ2mAz2 Hy3+MWcBBsd2V3OEdIloP/twy73UMeSBdGdoHfMhuGwhZHEC1ZltVZh+Q/XUnJdaqTGQ YGwC1MAoU1/t3f4X5oeY1YeZpcqKMD2PXt2tuyCA3olkPSUXu1LaYwVa5qKeWg8BpZe1 LOMQ== 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=XRdIZNSF4BbMuyqNeiZx2vKwkieNkFXHSRmSuHll2DU=; b=Lu2BVzB+nzHcVJ4JNgRkYEtoLEsOpdu4G1VGwORVIrqZeXXmYJoDzru65sL2ABnQ32 2/0K1cJI1RNH/3fCg1czMtoK/gBnUQJZoctnL84/HQtBpIzTHyCNoMxQDAeVypQMvz9g pgkpblBZjYvRa5gSJFyQZopuHxmcZyhrLs+fozwgvVOkXdY3ixCZnP92mUPF4dnKzdXf 25/WSAj49u3zkUjJgVuPVxKsTWgjYaXaSal5JQ3Qp4rU75atnHOd8UddgsFz5+3mZqxY 7EMeY0zoPZraPO16M9+xU6wAdl+/cKqE9EWBt8LpU9AblSIStKNjKB4nXfgydEAGGTRX yanA== 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 f9-v6si9337935plo.292.2018.04.22.07.49.59; Sun, 22 Apr 2018 07:50:13 -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 S1757293AbeDVOrc (ORCPT + 99 others); Sun, 22 Apr 2018 10:47:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57308 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932085AbeDVOQL (ORCPT ); Sun, 22 Apr 2018 10:16:11 -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 09A2C4A5; Sun, 22 Apr 2018 14:16:10 +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.4 24/97] ubi: Fix error for write access Date: Sun, 22 Apr 2018 15:53:02 +0200 Message-Id: <20180422135306.394815210@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@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.4-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; }