Re: [PATCH] sg: fix oops in the error path in sg_build_indirect()

From: Douglas Gilbert
Date: Thu Sep 03 2009 - 09:54:48 EST

Michal Schmidt wrote:
When the allocation fails in sg_build_indirect(), an oops happens in
the error path. It's caused by an obvious typo.

Signed-off-by: Michal Schmidt <mschmidt@xxxxxxxxxx>
Reported-by: Bob Tracy <rct@xxxxxxxxxxxxxxxx>

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 9230402..4968c4c 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1811,7 +1811,7 @@ retry:
return 0;
for (i = 0; i < k; i++)
- __free_pages(schp->pages[k], order);
+ __free_pages(schp->pages[i], order);
if (--order >= 0)
goto retry;


Signed-off-by: Douglas Gilbert <dgilbert@xxxxxxxxxxxx>
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at