]> err.no Git - util-linux/commitdiff
partx: fix infinite loop
authorKarel Zak <kzak@redhat.com>
Wed, 31 Mar 2010 14:38:51 +0000 (16:38 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 31 Mar 2010 14:38:51 +0000 (16:38 +0200)
On Wed, Mar 24, 2010 at 04:39:35PM -0400, Phillip Susi wrote:
> I noticed that running partx -d /dev/sda hangs so I looked into it
> and it seems that it keeps trying to delete partitions forever.

Reported-By: Phillip Susi <psusi@cfl.rr.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
partx/partx.c

index 3d60bf6977f03b775d52c26485a57f769b915448..14d2609f0b0f0509d3b156bc142b11d8bbde86be 100644 (file)
@@ -178,6 +178,8 @@ main(int argc, char **argv){
                while (upper == 0 || lower <= upper) {
                        int err;
 
+                       if (lower > MAXSLICES)
+                               break;
                        pt.pno = lower;
                        pt.start = 0;
                        pt.length = 0;