[PATCH] avoid kernel panic during ATA probe

From: Juan Manuel Sanchez (juanmasf_at_mi.madritel.es)
Date: 10/31/03

  • Next message: Gianmarco: "Re: mldonkey & user ppp : security problem ?"
    Date: Fri, 31 Oct 2003 06:32:29 +0100
    To: freebsd-stable@freebsd.org
    
    

    The ata raid code in STABLE allows 15 seconds for reading the disk
    headers. If during probe the ata channels need several resets to find a
    working configuration that time might be exceeded. When the request
    finally succeds the buffer was already freed by ar_rw(), and kernel
    panics at any access to corrupt pointers.

    Try this simple patch:

    -----------------------------------------------------------------------
    Index: ata-raid.c
    ===================================================================
    RCS file: /usr/home/ncvs/src/sys/dev/ata/ata-raid.c,v
    retrieving revision 1.3.2.19
    diff -w -u -r1.3.2.19 ata-raid.c
    --- ata-raid.c 30 Jan 2003 07:19:59 -0000 1.3.2.19
    +++ ata-raid.c 30 Oct 2003 22:28:30 -0000
    @@ -1427,8 +1427,8 @@
          AR_STRATEGY((struct buf *)bp);

          if (flags & AR_WAIT) {
    - while ((retry++ < (15*hz/10)) && (error = !(bp->b_flags & B_DONE)))
    - error = tsleep(bp, PRIBIO, "arrw", 10);
    + /* AR_STRATEGY success or timeout will wake us up */
    + error = tsleep(bp, PRIBIO, "arrw", 0);
              if (!error && (bp->b_flags & B_ERROR))
                  error = bp->b_error;
              free(bp, M_AR);
    -----------------------------------------------------------------------

    _______________________________________________
    freebsd-stable@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-stable
    To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"


  • Next message: Gianmarco: "Re: mldonkey & user ppp : security problem ?"