lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 05 Jun 2007 11:21:24 +0900 (JST)
From:	Masatake YAMATO <jet@...e.org>
To:	Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@...a.pw.edu.pl>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] never called printk statement in
 ide-taskfile.c::wait_drive_not_busy

Hi,

Patches appended to this mail fixes a bug explained below.
There are two ways to fix the bug. PLEASE CHOOSE BETTER ONE.


Look at wait_drive_not_busy in drivers/ide/ide-taskfile.c:

    static u8 wait_drive_not_busy(ide_drive_t *drive)
    {
	    ide_hwif_t *hwif = HWIF(drive);
	    int retries = 100;
	    u8 stat;

	    /*
	     * Last sector was transfered, wait until drive is ready.
	     * This can take up to 10 usec, but we will wait max 1 ms
	     * (drive_cmd_intr() waits that long).
	     */
	    while (((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) && retries--)
		    udelay(10);

	    if (!retries)
		    printk(KERN_ERR "%s: drive still BUSY!\n", drive->name);

	    return stat;
    }

`printk' is never called because `retries' never holds zero at the
outside of `while' loop: when `retries' holds zero at the while's loop
condition, `retries' will hold -1 at the if condition.

I'm not on this mailing list, so add my address to Cc: when you reply to me.


Signed-off-by: Masatake YAMATO <jet@...e.org>


diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 30175c7..a74df05 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -246,7 +246,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
 	 * This can take up to 10 usec, but we will wait max 1 ms
 	 * (drive_cmd_intr() waits that long).
 	 */
-	while (((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) && retries--)
+	while (((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) && --retries)
 		udelay(10);
 
 	if (!retries)


diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 30175c7..5e05311 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -249,7 +249,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
 	while (((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) && retries--)
 		udelay(10);
 
-	if (!retries)
+	if (retries < 0)
 		printk(KERN_ERR "%s: drive still BUSY!\n", drive->name);
 
 	return stat;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ