[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] [PVSCSI] Fix sense_len



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1228827740 0
# Node ID 3669e92f24cd82bc4b5a03b199f90465558123f6
# Parent  82ce2e69bb5b513fd6b307de40606e053e0920b0
[PVSCSI] Fix sense_len

Signed-off-by: James Harper <james.harper@xxxxxxxxxxxxxxxx>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>
Signed-off-by: Jun Kamada <kama@xxxxxxxxxxxxxx>
---
 drivers/xen/scsiback/scsiback.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff -r 82ce2e69bb5b -r 3669e92f24cd drivers/xen/scsiback/scsiback.c
--- a/drivers/xen/scsiback/scsiback.c   Tue Dec 09 13:02:02 2008 +0000
+++ b/drivers/xen/scsiback/scsiback.c   Tue Dec 09 13:02:20 2008 +0000
@@ -148,6 +148,7 @@ void scsiback_do_resp_with_sense(char *s
        struct vscsibk_info *info = pending_req->info;
        int notify;
        int more_to_do = 1;
+       struct scsi_sense_hdr sshdr;
        unsigned long flags;
 
        DPRINTK("%s\n",__FUNCTION__);
@@ -161,9 +162,17 @@ void scsiback_do_resp_with_sense(char *s
        ring_res->rqid   = pending_req->rqid;
 
        if (sense_buffer != NULL) {
-               memcpy(ring_res->sense_buffer, sense_buffer,
-                               VSCSIIF_SENSE_BUFFERSIZE);
-               ring_res->sense_len = VSCSIIF_SENSE_BUFFERSIZE;
+               if (scsi_normalize_sense(sense_buffer,
+                       sizeof(sense_buffer), &sshdr)) {
+
+                       int len = 8 + sense_buffer[7];
+
+                       if (len > VSCSIIF_SENSE_BUFFERSIZE)
+                               len = VSCSIIF_SENSE_BUFFERSIZE;
+
+                       memcpy(ring_res->sense_buffer, sense_buffer, len);
+                       ring_res->sense_len = len;
+               }
        } else {
                ring_res->sense_len = 0;
        }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.