Skip to content

Commit

Permalink
[SCSI] st: Store page order before driver buffer allocation
Browse files Browse the repository at this point in the history
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: Kai Makisara <kai.makisara@kolumbus.fi>
Reported-by: Lukas Kolbe <lkolbe@techfak.uni-bielefeld.de>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Kai Makisara authored and James Bottomley committed Dec 23, 2010
1 parent a87e3a6 commit 373daac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/scsi/st.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
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>

Expand Down Expand Up @@ -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++, b_size *= 2)
; /* empty */
STbuffer->reserved_page_order = order;
}
if (max_segs * (PAGE_SIZE << order) < new_size) {
if (order == ST_MAX_ORDER)
Expand All @@ -3758,7 +3759,6 @@ static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dm
segs++;
}
STbuffer->b_data = page_address(STbuffer->reserved_pages[0]);
STbuffer->reserved_page_order = order;

return 1;
}
Expand Down

0 comments on commit 373daac

Please sign in to comment.