Received: by 10.192.165.148 with SMTP id m20csp2546674imm; Sun, 22 Apr 2018 09:17:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx48U/ZDobAoTWI/pOJ0+4ETwtrIYXY0enjDSE5TaJuo6GmPBevz9qzgGUqL0uPtvwdWBsOjL X-Received: by 10.101.80.204 with SMTP id s12mr14431996pgp.191.1524413845863; Sun, 22 Apr 2018 09:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524413845; cv=none; d=google.com; s=arc-20160816; b=OUF4MHtq+HpMeNz1M1SonnxT0BbuLdnI9O93mAX/m42zGEiOWJGFjrWD0vMHCuQkqw sZoxRPXjLJd6zabmVRfoZsrIZxbQH8D6DhZoetdcolVRh94R67aLv90lYVPVcew1uxML 7rOLMGsdLMQmveqXsqtiRlOugk966DzzocpAH55bGABKgND/8iQl801QH3MR7PRfR6Rk Na2DoQM5zL0+eOSkDi9BWb9JKzGYBnFgVq+D5zL+yY5XTF573RpJT6DLlKEoCIvw3gHl uSBXm3D6w7OAkuwVFakpKmcE0a2d08CQ12myyftEqMSRJGZrJooXSPaZtZj+ykp+SbfI xzow== 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=S5+S7F3OufoO9zCUUkwfuI4fZOf219xHfRY4hfBahEw=; b=eZR8voJhMStNIimlZRObYYgclfI8Go7bV7SoavKDMtg0mKJAs6/KywX744z+yBsJLN KwHvd/a9quKW5Wu6uQUyf7j7xqzH3E3BuQWI0rnckUglvBWDUNd+WIKIwWcapx0bRKUl OYvPO6SMMqXaaTxotQodFsa8gI8BeKqrhK1++dSdcplKwE9dSTc7XJ/iDrABvbeaspwF ts2GfjY8OV7znav+6rd+qIteS0PkFLYO/YT1glNzjaR1dQEKdxSjxToEmhW2S6tioeZm i3LpottXwO7qltu96wBOGhPfLmLToLQgBJQuN+ee3m/XcxUuRVIrv2LJxEMuCRFLOhEX p5VA== 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 r6si8127669pgp.21.2018.04.22.09.17.11; Sun, 22 Apr 2018 09:17:25 -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 S1753737AbeDVQP4 (ORCPT + 99 others); Sun, 22 Apr 2018 12:15:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44330 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753346AbeDVNyx (ORCPT ); Sun, 22 Apr 2018 09:54:53 -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 0C3F387A; Sun, 22 Apr 2018 13:54:52 +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.16 006/196] ubi: Fix error for write access Date: Sun, 22 Apr 2018 15:50:26 +0200 Message-Id: <20180422135104.557782509@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@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.16-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; }