From: Michal Schmidt Date: Thu, 3 Sep 2009 12:27:08 +0000 (+0200) Subject: sg: fix oops in the error path in sg_build_indirect() X-Git-Tag: v2.6.30.8~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9b9f4d868e06a2b98bf760dbd3325c11b03b416;p=thirdparty%2Fkernel%2Fstable.git sg: fix oops in the error path in sg_build_indirect() commit e71044ee2efa4792e21d243b03d49006db66aec9 upstream. 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 Reported-by: Bob Tracy Acked-by: Douglas Gilbert Signed-off-by: James Bottomley Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index ff63279b40ea2..ab968905d89a3 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1811,7 +1811,7 @@ retry: return 0; out: for (i = 0; i < k; i++) - __free_pages(schp->pages[k], order); + __free_pages(schp->pages[i], order); if (--order >= 0) goto retry;