[PATCH] libblkid: fix infinite loop when probe chain bails out early

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The superblocks probe bails out early with no results in some cases.  If
this happens, blkid_do_probe needs to go to the next chain, rather than
entering an infinite loop calling superblocks_probe over and over again.

(Originally reported as https://bugs.launchpad.net/bugs/528073.)

Signed-off-by: Colin Watson <cjwatson@xxxxxxxxxxxxx>
---
 shlibs/blkid/src/probe.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c
index 6d61386..ab1c8d5 100644
--- a/shlibs/blkid/src/probe.c
+++ b/shlibs/blkid/src/probe.c
@@ -721,10 +721,12 @@ int blkid_do_probe(blkid_probe pr)
 		/* we go to the next chain only when the previous probing
 		 * result was nothing (rc == 1) and when the current chain is
 		 * disabled or we are at end of the current chain (chain->idx +
-		 * 1 == sizeof chain)
+		 * 1 == sizeof chain) or the current chain bailed out right at
+		 * the start (chain->idx == -1)
 		 */
 		else if (rc == 1 && (chn->enabled == FALSE ||
-				     chn->idx + 1 == chn->driver->nidinfos)) {
+				     chn->idx + 1 == chn->driver->nidinfos ||
+				     chn->idx == -1)) {
 
 			int idx = chn->driver->id + 1;
 
-- 
1.7.0
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux