diff options
author | Hugh Dickins <hugh@veritas.com> | 2005-12-02 10:58:09 -0500 |
---|---|---|
committer | James Bottomley <jejb@titanic.(none)> | 2005-12-02 11:24:22 -0500 |
commit | 4d5cda069b3f0a3bbc18576bc15903ed665d0295 (patch) | |
tree | e89d75e2db026d7f15a13464a32197d7ecfc8272 /drivers/scsi | |
parent | 032c09d76cdb448484859cc84dac4bba8f5f8f14 (diff) |
[SCSI] sg: fix a bug in st_map_user_pages failure path
sg's st_map_user_pages is modelled on an earlier version of st's
sgl_map_user_pages, and has the same bug: if get_user_pages got some but
not all of the pages, then those got were released, but the positive res
code returned implied that they were still to be freed.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/sg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 6de7ff9faf2d..b55c2a8a547c 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1860,9 +1860,11 @@ st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages, | |||
1860 | unlock_page(pages[j]); */ | 1860 | unlock_page(pages[j]); */ |
1861 | res = 0; | 1861 | res = 0; |
1862 | out_unmap: | 1862 | out_unmap: |
1863 | if (res > 0) | 1863 | if (res > 0) { |
1864 | for (j=0; j < res; j++) | 1864 | for (j=0; j < res; j++) |
1865 | page_cache_release(pages[j]); | 1865 | page_cache_release(pages[j]); |
1866 | res = 0; | ||
1867 | } | ||
1866 | kfree(pages); | 1868 | kfree(pages); |
1867 | return res; | 1869 | return res; |
1868 | } | 1870 | } |