From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Wed, 21 Jul 2021 09:52:55 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1m672F-0003DA-0u for lore@lore.pengutronix.de; Wed, 21 Jul 2021 09:52:55 +0200 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m672E-0002QS-32 for lore@pengutronix.de; Wed, 21 Jul 2021 09:52:54 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=mMKP/XDO4zN2BHJAHYYQjx+P8beNnXL7xneBLkyCIuQ=; b=dOcxsVxRXDg98p NuTEhspoLVLQ3oFEtQbVueYh7U9KyB9uLaRwFdKw+BjN43Jsbi7Pj++j0A/d3E9MTZKeazVKWosLs rGZmhFaN1ecZZG9TexcDaht6o88TjQXYo4IZJqWuo0GxjWTgq7iou7gKdQK+rq8PtFRojYfn2y8uX ou9BEJDb/Bl+SrWKxRblq0Ov9lGO+5werpDyUuyz+JT+tUbQ3wpYhZhkDH4IHElYF3MPz1/TqP9Hc k0kLTAJLltM6yggcUwraOmn06ujdNlMo1c2sU622paHoDC0czR+80l/NmXCguoly+ZhydPy/9mFWo ewkBawQ3PpZDmLV/IW6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m670Y-00Emh9-Mq; Wed, 21 Jul 2021 07:51:10 +0000 Received: from magratgarlick.emantor.de ([78.46.208.201]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m670Q-00Emdi-DI for barebox@lists.infradead.org; Wed, 21 Jul 2021 07:51:06 +0000 Received: by magratgarlick.emantor.de (Postfix, from userid 114) id 1F2EB88A21; Wed, 21 Jul 2021 09:50:55 +0200 (CEST) Received: from localhost (unknown [IPv6:2001:9e8:2179:3a02:c0d3:dbff:fefe:ff70]) by magratgarlick.emantor.de (Postfix) with ESMTPSA id 6540588A06; Wed, 21 Jul 2021 09:50:53 +0200 (CEST) From: Rouven Czerwinski To: barebox@lists.infradead.org Cc: Rouven Czerwinski Date: Wed, 21 Jul 2021 09:50:51 +0200 Message-Id: <20210721075051.393141-1-r.czerwinski@pengutronix.de> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210721_005102_658623_C6E19B77 X-CRM114-Status: GOOD ( 12.82 ) X-BeenThere: barebox@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" X-SA-Exim-Connect-IP: 2607:7c80:54:e::133 X-SA-Exim-Mail-From: barebox-bounces+lore=pengutronix.de@lists.infradead.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.ext.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-6.2 required=4.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Subject: [PATCH] fastboot: handle error from file_list_parse() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on metis.ext.pengutronix.de) In case an invalid file list is passed to file_list_parse(), it will return an error, i.e. by passing "/dev/mmc1(emmc) /dev/mmc1.1(root)", the error here being that the entries are not comma separated and file_list_parse will try to parse ' ' as a flag. The fastboot code didn't handle this, leading to the following error: ERROR: file_list: Unknown flag ' ' ERROR: file_list: parse error unable to handle paging request at address 0xfffffff2 pc : [<8fe26a20>] lr : [<8fe0f965>] sp : 8ffeff50 ip : 8ffef714 fp : 00079bda r10: 001b9ff8 r9 : 8fea7eec r8 : 00000001 r7 : 00000000 r6 : 00000001 r5 : 00000000 r4 : 8813eab0 r3 : ffffffea r2 : 00020000 r1 : 00000001 r0 : 8813eab0 Flags: nzCv IRQs off FIQs off Mode SVC_32 WARNING: [<8fe26a20>] (usb_multi_count_functions+0xc/0x2a) from [<8fe0f965>] (usbgadget_register+0x79/0xf4) WARNING: [<8fe0f965>] (usbgadget_register+0x79/0xf4) from [<8fe0fa13>] (usbgadget_autostart_set+0x33/0x4c) WARNING: [<8fe0fa13>] (usbgadget_autostart_set+0x33/0x4c) from [<8fe4d437>] (param_int_set+0x4b/0xb0) WARNING: [<8fe4d437>] (param_int_set+0x4b/0xb0) from [<8fe4d899>] (dev_set_param+0x4d/0x64) WARNING: [<8fe4d899>] (dev_set_param+0x4d/0x64) from [<8fe066f1>] (globalvar_add_bool+0x49/0x54) WARNING: [<8fe066f1>] (globalvar_add_bool+0x49/0x54) from [<8fe0f8dd>] (usbgadget_autostart_init+0x15/0x24) WARNING: [<8fe0f8dd>] (usbgadget_autostart_init+0x15/0x24) from [<8fe01081>] (start_barebox+0x35/0x6c) WARNING: [<8fe01081>] (start_barebox+0x35/0x6c) from [<8fe62ed9>] (barebox_non_pbl_start+0x121/0x164) WARNING: [<8fe62ed9>] (barebox_non_pbl_start+0x121/0x164) from [<8fe00005>] (__bare_init_start+0x1/0xc) WARNING: [<8fe64e3d>] (unwind_backtrace+0x1/0x78) from [<8fe01385>] (panic+0x1d/0x34) WARNING: [<8fe01385>] (panic+0x1d/0x34) from [<8fe62723>] (do_exception+0xf/0x14) WARNING: [<8fe62723>] (do_exception+0xf/0x14) from [<8fe62791>] (do_data_abort+0x21/0x34) WARNING: [<8fe62791>] (do_data_abort+0x21/0x34) from [<8fe624d4>] (do_abort_6+0x48/0x54) Add the proper error handling and notify the user with a proper error message. Signed-off-by: Rouven Czerwinski --- common/fastboot.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/fastboot.c b/common/fastboot.c index 75f6691b08..d53a1cd228 100644 --- a/common/fastboot.c +++ b/common/fastboot.c @@ -918,8 +918,14 @@ bool get_fastboot_bbu(void) struct file_list *get_fastboot_partitions(void) { - if (fastboot_partitions && *fastboot_partitions) - return file_list_parse(fastboot_partitions); + struct file_list *list; + if (fastboot_partitions && *fastboot_partitions) { + list = file_list_parse(fastboot_partitions); + if (IS_ERR(list)) { + pr_err("parsing failure: '%s', returning NULL\n", fastboot_partitions); + return NULL; + } + } if (!system_partitions_empty()) return system_partitions_get(); return NULL; -- 2.32.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox