This is a note to let you know that I've just added the patch titled

    target/file: Fix 32-bit highmem breakage for SGL -> iovec mapping

to the 3.7-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     target-file-fix-32-bit-highmem-breakage-for-sgl-iovec-mapping.patch
and it can be found in the queue-3.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 40ff2c3b3da35dd3a00ac6722056a59b4b3f2caf Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <[email protected]>
Date: Wed, 5 Dec 2012 12:08:29 +0100
Subject: target/file: Fix 32-bit highmem breakage for SGL -> iovec mapping

From: Sebastian Andrzej Siewior <[email protected]>

commit 40ff2c3b3da35dd3a00ac6722056a59b4b3f2caf upstream.

This patch changes vectored file I/O to use kmap + kunmap when mapping
incoming SGL memory -> struct iovec in order to properly support 32-bit
highmem configurations.  This is because an extra bounce buffer may be
required when processing scatterlist pages allocated with GFP_KERNEL.

Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/target/target_core_file.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -260,7 +260,7 @@ static int fd_do_readv(struct se_cmd *cm
 
        for_each_sg(sgl, sg, sgl_nents, i) {
                iov[i].iov_len = sg->length;
-               iov[i].iov_base = sg_virt(sg);
+               iov[i].iov_base = kmap(sg_page(sg)) + sg->offset;
        }
 
        old_fs = get_fs();
@@ -268,6 +268,8 @@ static int fd_do_readv(struct se_cmd *cm
        ret = vfs_readv(fd, &iov[0], sgl_nents, &pos);
        set_fs(old_fs);
 
+       for_each_sg(sgl, sg, sgl_nents, i)
+               kunmap(sg_page(sg));
        kfree(iov);
        /*
         * Return zeros and GOOD status even if the READ did not return
@@ -313,7 +315,7 @@ static int fd_do_writev(struct se_cmd *c
 
        for_each_sg(sgl, sg, sgl_nents, i) {
                iov[i].iov_len = sg->length;
-               iov[i].iov_base = sg_virt(sg);
+               iov[i].iov_base = kmap(sg_page(sg)) + sg->offset;
        }
 
        old_fs = get_fs();
@@ -321,6 +323,9 @@ static int fd_do_writev(struct se_cmd *c
        ret = vfs_writev(fd, &iov[0], sgl_nents, &pos);
        set_fs(old_fs);
 
+       for_each_sg(sgl, sg, sgl_nents, i)
+               kunmap(sg_page(sg));
+
        kfree(iov);
 
        if (ret < 0 || ret != cmd->data_length) {


Patches currently in stable-queue which might be from [email protected] are

queue-3.7/target-file-fix-32-bit-highmem-breakage-for-sgl-iovec-mapping.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to