Commit 373daacf authored by Kai Makisara's avatar Kai Makisara Committed by James Bottomley

[SCSI] st: Store page order before driver buffer allocation

The order of the pages allocated for the driver buffer must be stored before
allocation because it is used in freeing already allocated pages if
allocation fails.
Signed-off-by: default avatarKai Makisara <kai.makisara@kolumbus.fi>
Reported-by: default avatarLukas Kolbe <lkolbe@techfak.uni-bielefeld.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent a87e3a67
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
*/ */
static const char *verstr = "20100829"; static const char *verstr = "20101219";
#include <linux/module.h> #include <linux/module.h>
...@@ -3732,6 +3732,7 @@ static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dm ...@@ -3732,6 +3732,7 @@ static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dm
order < ST_MAX_ORDER && b_size < new_size; order < ST_MAX_ORDER && b_size < new_size;
order++, b_size *= 2) order++, b_size *= 2)
; /* empty */ ; /* empty */
STbuffer->reserved_page_order = order;
} }
if (max_segs * (PAGE_SIZE << order) < new_size) { if (max_segs * (PAGE_SIZE << order) < new_size) {
if (order == ST_MAX_ORDER) if (order == ST_MAX_ORDER)
...@@ -3758,7 +3759,6 @@ static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dm ...@@ -3758,7 +3759,6 @@ static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dm
segs++; segs++;
} }
STbuffer->b_data = page_address(STbuffer->reserved_pages[0]); STbuffer->b_data = page_address(STbuffer->reserved_pages[0]);
STbuffer->reserved_page_order = order;
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment