Commit b2155d04 authored by Douglas Gilbert's avatar Douglas Gilbert Committed by James Bottomley

[SCSI] sg: fix incorrect page problem

There's a problem where sg is executing a ->nopage operation on a
compound page, it actually calls get_page() on the first page in the
compound rather than the page which is being mapped.  The fix is to
select the correct page by indexing into the compound.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 48e2691f
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
* *
*/ */
static int sg_version_num = 30533; /* 2 digits for each component */ static int sg_version_num = 30534; /* 2 digits for each component */
#define SG_VERSION_STR "3.5.33" #define SG_VERSION_STR "3.5.34"
/* /*
* D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes: * D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes:
...@@ -60,7 +60,7 @@ static int sg_version_num = 30533; /* 2 digits for each component */ ...@@ -60,7 +60,7 @@ static int sg_version_num = 30533; /* 2 digits for each component */
#ifdef CONFIG_SCSI_PROC_FS #ifdef CONFIG_SCSI_PROC_FS
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
static char *sg_version_date = "20050908"; static char *sg_version_date = "20060818";
static int sg_proc_init(void); static int sg_proc_init(void);
static void sg_proc_cleanup(void); static void sg_proc_cleanup(void);
...@@ -1164,7 +1164,7 @@ sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type) ...@@ -1164,7 +1164,7 @@ sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type)
len = vma->vm_end - sa; len = vma->vm_end - sa;
len = (len < sg->length) ? len : sg->length; len = (len < sg->length) ? len : sg->length;
if (offset < len) { if (offset < len) {
page = sg->page; page = virt_to_page(page_address(sg->page) + offset);
get_page(page); /* increment page count */ get_page(page); /* increment page count */
break; break;
} }
......
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