Re: BUG: cat /proc/partitions endless loop

From: Christoph Hellwig (hch@ns.caldera.de)
Date: Fri Sep 28 2001 - 08:39:01 EST


In article <200109281315.f8SDFpA01669@bmdipc2c.germany.agilent.com> you wrote:
> I traced the problem down to drivers/block/genhd.c,
> where the function get_partition_list() outer loop does not
> terminate due to the last element in the structured list starting
> with gendisk_head is not initialized to NULL, by whatever reason.
> My fix does not cure the pointered endless loop, but prevents
> from looping when stepping thru the pointered list.

I think the fix could be simpler. What about:

--- ../master/linux-2.4.10/drivers/block/genhd.c Sun Sep 23 21:20:52 2001
+++ linux-2.4.10/drivers/block/genhd.c Fri Sep 28 15:34:14 2001
@@ -115,7 +115,7 @@
 
         len = sprintf(page, "major minor #blocks name\n\n");
         read_lock(&gendisk_lock);
- for (gp = gendisk_head; gp; gp = gp->next) {
+ for (gp = gendisk_head; gp != gendisk_head; gp = gp->next) {
                 for (n = 0; n < (gp->nr_real << gp->minor_shift); n++) {
                         if (gp->part[n].nr_sects == 0)
                                 continue;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Sep 30 2001 - 21:01:01 EST