Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 281229
b: refs/heads/master
c: 10c43dd
h: refs/heads/master
i:
  281227: c03361f
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Dec 1, 2011
1 parent c06e430 commit dff0c16
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a768a76d55c2798bbd86b81f50ef740312d69935
refs/heads/master: 10c43dd4c4403d35fc6477d547aa3a38b466b310
24 changes: 22 additions & 2 deletions trunk/drivers/staging/hv/storvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,8 @@ static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl,
/* Assume the original sgl has enough room */
static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl,
struct scatterlist *bounce_sgl,
unsigned int orig_sgl_count)
unsigned int orig_sgl_count,
unsigned int bounce_sgl_count)
{
int i;
int j = 0;
Expand Down Expand Up @@ -921,6 +922,24 @@ static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl,
kunmap_atomic((void *)bounce_addr, KM_IRQ0);
j++;

/*
* It is possible that the number of elements
* in the bounce buffer may not be equal to
* the number of elements in the original
* scatter list. Handle this correctly.
*/

if (j == bounce_sgl_count) {
/*
* We are done; cleanup and return.
*/
kunmap_atomic((void *)(dest_addr -
orig_sgl[i].offset),
KM_IRQ0);
local_irq_restore(flags);
return total_copied;
}

/* if we need to use another bounce buffer */
if (destlen || i != orig_sgl_count - 1)
bounce_addr =
Expand Down Expand Up @@ -1126,7 +1145,8 @@ static void storvsc_command_completion(struct hv_storvsc_request *request)
if (vm_srb->data_in == READ_TYPE)
copy_from_bounce_buffer(scsi_sglist(scmnd),
cmd_request->bounce_sgl,
scsi_sg_count(scmnd));
scsi_sg_count(scmnd),
cmd_request->bounce_sgl_count);
destroy_bounce_buffer(cmd_request->bounce_sgl,
cmd_request->bounce_sgl_count);
}
Expand Down

0 comments on commit dff0c16

Please sign in to comment.