packages: kernel/kernel-small_fixes.patch - fix Oppses related to USB/SAS h...

baggins baggins at pld-linux.org
Sat Jul 23 12:16:50 CEST 2011


Author: baggins                      Date: Sat Jul 23 10:16:50 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- fix Oppses related to USB/SAS hot unplugs
- fix netdev oopses

---- Files affected:
packages/kernel:
   kernel-small_fixes.patch (1.30 -> 1.31) 

---- Diffs:

================================================================
Index: packages/kernel/kernel-small_fixes.patch
diff -u packages/kernel/kernel-small_fixes.patch:1.30 packages/kernel/kernel-small_fixes.patch:1.31
--- packages/kernel/kernel-small_fixes.patch:1.30	Mon Jul 11 21:49:46 2011
+++ packages/kernel/kernel-small_fixes.patch	Sat Jul 23 12:16:45 2011
@@ -157,4 +157,115 @@
  
  	/*
  	 * Blow away any referenced inode in the filestreams cache.
+On Sat, 2 Jul 2011, Andi Kleen wrote:
 
+> > The problem is that blk_peek_request() calls scsi_prep_fn(), which 
+> > does this:
+> > 
+> > 	struct scsi_device *sdev = q->queuedata;
+> > 	int ret = BLKPREP_KILL;
+> > 
+> > 	if (req->cmd_type == REQ_TYPE_BLOCK_PC)
+> > 		ret = scsi_setup_blk_pc_cmnd(sdev, req);
+> > 	return scsi_prep_return(q, req, ret);
+> > 
+> > It doesn't check to see if sdev is NULL, nor does 
+> > scsi_setup_blk_pc_cmnd().  That accounts for this error:
+> 
+> I actually added a NULL check in scsi_setup_blk_pc_cmnd early on,
+> but that just caused RCU CPU stalls afterwards and then eventually
+> a hung system.
+
+The RCU problem is likely to be a separate issue.  It might even be a 
+result of the use-after-free problem with the elevator.
+
+At any rate, it's clear that the crash in the refcounting log you
+posted occurred because scsi_setup_blk_pc_cmnd() called
+scsi_prep_state_check(), which tried to dereference the NULL pointer.
+
+Would you like to try this patch to see if it fixes the problem?  As I 
+said before, I'm not certain it's the best thing to do, but it worked 
+on my system.
+
+Alan Stern
+
+
+
+
+Index: usb-3.0/drivers/scsi/scsi_lib.c
+===================================================================
+--- usb-3.0.orig/drivers/scsi/scsi_lib.c
++++ usb-3.0/drivers/scsi/scsi_lib.c
+@@ -1247,6 +1247,8 @@ int scsi_prep_fn(struct request_queue *q
+ 	struct scsi_device *sdev = q->queuedata;
+ 	int ret = BLKPREP_KILL;
+ 
++	if (!sdev)
++		return ret;
+ 	if (req->cmd_type == REQ_TYPE_BLOCK_PC)
+ 		ret = scsi_setup_blk_pc_cmnd(sdev, req);
+ 	return scsi_prep_return(q, req, ret);
+Index: usb-3.0/drivers/scsi/scsi_sysfs.c
+===================================================================
+--- usb-3.0.orig/drivers/scsi/scsi_sysfs.c
++++ usb-3.0/drivers/scsi/scsi_sysfs.c
+@@ -322,6 +322,8 @@ static void scsi_device_dev_release_user
+ 		kfree(evt);
+ 	}
+ 
++	/* Freeing the queue signals to block that we're done */
++	scsi_free_queue(sdev->request_queue);
+ 	blk_put_queue(sdev->request_queue);
+ 	/* NULL queue means the device can't be used */
+ 	sdev->request_queue = NULL;
+@@ -936,8 +938,6 @@ void __scsi_remove_device(struct scsi_de
+ 	/* cause the request function to reject all I/O requests */
+ 	sdev->request_queue->queuedata = NULL;
+ 
+-	/* Freeing the queue signals to block that we're done */
+-	scsi_free_queue(sdev->request_queue);
+ 	put_device(dev);
+ }
+ 
+
+
+--
+To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
+the body of a message to majordomo at vger.kernel.org
+More majordomo info at  http://vger.kernel.org/majordomo-info.html
+Please read the FAQ at  http://www.tux.org/lkml/
+As reported by Ben Greer and Froncois Romieu. The code path in 
+the netif_carrier code leads it to try and disable
+a late workqueue to reenable it immediately
+netif_carrier_on
+-> linkwatch_fire_event
+   -> linkwatch_schedule_work
+      -> cancel_delayed_work
+         -> del_timer_sync  
+
+If __cancel_delayed_work is used instead then there is no
+problem of waiting for running linkwatch_event.
+
+There is a race between linkwatch_event running re-scheduling
+but it is harmless to schedule an extra scan of the linkwatch queue.
+
+Signed-off-by: Stephen Hemminger <shemminger at vyatta.com>
+
+
+--- a/net/core/link_watch.c	2011-07-22 15:25:31.027533604 -0700
++++ b/net/core/link_watch.c	2011-07-22 15:31:27.531520028 -0700
+@@ -126,7 +126,7 @@ static void linkwatch_schedule_work(int
+ 		return;
+ 
+ 	/* It's already running which is good enough. */
+-	if (!cancel_delayed_work(&linkwatch_work))
++	if (!__cancel_delayed_work(&linkwatch_work))
+ 		return;
+ 
+ 	/* Otherwise we reschedule it again for immediate execution. */
+
+--
+To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
+the body of a message to majordomo at vger.kernel.org
+More majordomo info at  http://vger.kernel.org/majordomo-info.html
+Please read the FAQ at  http://www.tux.org/lkml/
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel-small_fixes.patch?r1=1.30&r2=1.31&f=u



More information about the pld-cvs-commit mailing list