Skip to contentSkip to conversation

blktap: fix reference to freed struct request.

PATCH Dominic Curran 3 participants 4 messages Mar 8, 2011 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

blktap: fix reference to freed struct request.

The request will be freed by the call to __blktap_end_rq(), so to rq->q is invalid before spin_unlock_irq().

drivers/xen/blktap2/device.c Tue Mar 08 10:04:28 2011 -0800 renamed from drivers/xen/blktap2/device.c Tue Mar 08 10:02:58 2011 -0800 +0 -0
diff -r d971c4c2e309 drivers/xen/blktap2/device.c
@@ -135,9 +135,11 @@

static inline void
blktap_end_rq(struct request *rq, int err)
{
- spin_lock_irq(rq->q->queue_lock);
+ struct request_queue *q = rq->q;
+

+    spin_lock_irq(q->queue_lock);
    __blktap_end_rq(rq, err);

- spin_unlock_irq(rq->q->queue_lock);
+ spin_unlock_irq(q->queue_lock);
}

void

#1 lore raw
Quoted 6 lines · Dominic Curran

blktap: fix reference to freed struct request.

The request will be freed by the call to __blktap_end_rq(), so to rq->q is invalid before spin_unlock_irq().

... citrix.com>

My fault, I wasn't sure about the uk mx names anymore.

Sorry,
Daniel

Quoted 24 lines

diff -r d971c4c2e309 drivers/xen/blktap2/device.c

drivers/xen/blktap2/device.c Tue Mar 08 10:04:28 2011 -0800 renamed from drivers/xen/blktap2/device.c Tue Mar 08 10:02:58 2011 -0800 +4 -2
@@ -135,9 +135,11 @@
 static inline void
 blktap_end_rq(struct request *rq, int err)
 {
-    spin_lock_irq(rq->q->queue_lock);
+    struct request_queue *q = rq->q;
+
+    spin_lock_irq(q->queue_lock);
     __blktap_end_rq(rq, err);
-    spin_unlock_irq(rq->q->queue_lock);
+    spin_unlock_irq(q->queue_lock);
 }
 
 void

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
In reply to Dominic Curran
Quoted 4 lines · Dominic Curran

blktap: fix reference to freed struct request.

The request will be freed by the call to __blktap_end_rq(), so to rq->q is invalid before spin_unlock_irq().

What tree is this for? Otherwise this could get dropped on the floor. If it's for 2.6.18, the only tree that I'm still responsible for, then it needs 2.6.18 mentioned in the subject line.

-- Keir

Quoted 25 lines

diff -r d971c4c2e309 drivers/xen/blktap2/device.c

drivers/xen/blktap2/device.c Tue Mar 08 10:04:28 2011 -0800 renamed from drivers/xen/blktap2/device.c Tue Mar 08 10:02:58 2011 -0800 +4 -2
@@ -135,9 +135,11 @@
 static inline void
 blktap_end_rq(struct request *rq, int err)
 {
-    spin_lock_irq(rq->q->queue_lock);
+    struct request_queue *q = rq->q;
+
+    spin_lock_irq(q->queue_lock);
     __blktap_end_rq(rq, err);
-    spin_unlock_irq(rq->q->queue_lock);
+    spin_unlock_irq(q->queue_lock);
 }
 
 void

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 10 lines · Keir Fraser
Quoted 4 lines · Dominic Curran

blktap: fix reference to freed struct request.

The request will be freed by the call to __blktap_end_rq(), so to rq->q is invalid before spin_unlock_irq().

What tree is this for? Otherwise this could get dropped on the floor. If it's for 2.6.18, the only tree that I'm still responsible for, then it needs 2.6.18 mentioned in the subject line.

This should go into the pvops tree (but will need some path fixup) and ideally goes into stable branch(es?) straight away. 2.6.18 won't have that particular bug, unless that code was patched in.

Daniel

Quoted 34 lines

-- Keir

Quoted 21 lines

diff -r d971c4c2e309 drivers/xen/blktap2/device.c

drivers/xen/blktap2/device.c Tue Mar 08 10:04:28 2011 -0800 renamed from drivers/xen/blktap2/device.c Tue Mar 08 10:02:58 2011 -0800 +4 -2
@@ -135,9 +135,11 @@
 static inline void
 blktap_end_rq(struct request *rq, int err)
 {
-    spin_lock_irq(rq->q->queue_lock);
+    struct request_queue *q = rq->q;
+
+    spin_lock_irq(q->queue_lock);
     __blktap_end_rq(rq, err);
-    spin_unlock_irq(rq->q->queue_lock);
+    spin_unlock_irq(q->queue_lock);
 }
 
 void
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel