From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754520Ab2JDWLJ (ORCPT ); Thu, 4 Oct 2012 18:11:09 -0400 Received: from mail-da0-f46.google.com ([209.85.210.46]:49290 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932911Ab2JDVSr (ORCPT ); Thu, 4 Oct 2012 17:18:47 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , alan@lxorguk.ukuu.org.uk, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Artem Bityutskiy Subject: =?UTF-8?q?=5B=2041/56=5D=20UBI=3A=20fix=20autoresize=20handling=20in=20R/O=20mode?= Date: Thu, 4 Oct 2012 14:16:02 -0700 Message-Id: <20121004211156.800902838@linuxfoundation.org> X-Mailer: git-send-email 1.7.12.2.421.g261b511 In-Reply-To: <20121004211152.101901246@linuxfoundation.org> References: <20121004211152.101901246@linuxfoundation.org> User-Agent: quilt/0.60-2.1.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Artem Bityutskiy commit abb3e01103eb4e2ea5c15e6fedbc74e08bd4cc2b upstream. Currently UBI fails in autoresize when it is in R/O mode (e.g., because the underlying MTD device is R/O). This patch fixes the issue - we just skip autoresize and print a warning. Reported-by: Pali Rohár Signed-off-by: Artem Bityutskiy Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/ubi/build.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -759,6 +759,11 @@ static int autoresize(struct ubi_device struct ubi_volume *vol = ubi->volumes[vol_id]; int err, old_reserved_pebs = vol->reserved_pebs; + if (ubi->ro_mode) { + ubi_warn("skip auto-resize because of R/O mode"); + return 0; + } + /* * Clear the auto-resize flag in the volume in-memory copy of the * volume table, and 'ubi_resize_volume()' will propagate this change