ipq806x: fix boot hang if cmdline contains words with r in the middle
authorJonas Gorski <jonas.gorski@gmail.com>
Thu, 28 Jul 2016 16:08:35 +0000 (18:08 +0200)
committerJonas Gorski <jonas.gorski@gmail.com>
Sun, 31 Jul 2016 22:13:35 +0000 (00:13 +0200)
The ATB DTB mangle code will enter an infinite loop if it encounters a
word in the command line that contains an r in the middle of the word.

Fix this by increasing ptr everytime before invoking strchr, ot avoid
finding the same r again.

This fixes booting at least on Netgear R7500v1, which contains
"ubi.mtd=rootfs" in its commandline, triggering the misbehaviour.

Fixes: 0ddcbee26151 ("ipq806x: activate ATAG DTB mangle and EA8500 rootblock in dts")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
target/linux/ipq806x/patches-4.4/996-ATAG_DTB_COMPAT_CMDLINE_MANGLE.patch

index 8d5cbf9102a7052680232251d1e36445fef1eb91..be15ec4772de919bc7d897a1b37726d537585182 100644 (file)
@@ -64,9 +64,9 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
 +      ptr = str - 1;
 +
 +      do {
-+              ptr++;
 +              //first find an 'r' at the begining or after a space
 +              do {
++                      ptr++;
 +                      ptr = strchr(ptr, 'r');
 +                      if(!ptr) return dest;
 +