[kernel] r17722 - in dists/sid/linux-2.6/debian: . patches/bugfix/all patches/series

Ben Hutchings benh at alioth.debian.org
Sat Jun 25 05:30:13 UTC 2011


Author: benh
Date: Sat Jun 25 05:30:12 2011
New Revision: 17722

Log:
block: Fix crash (oops) in blkdev_get() on failed exclusive open (Closes: #631574)

Added:
   dists/sid/linux-2.6/debian/patches/bugfix/all/block-blkdev_get-should-access-bd_disk-only-after-su.patch
Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/patches/series/3

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	Tue Jun 21 19:36:48 2011	(r17721)
+++ dists/sid/linux-2.6/debian/changelog	Sat Jun 25 05:30:12 2011	(r17722)
@@ -3,6 +3,8 @@
   [ Ben Hutchings ]
   * [x86] i915: Revert "drm/i915: Enable GMBUS for post-gen2 chipsets"
     (Closes: #627575)
+  * block: Fix crash (oops) in blkdev_get() on failed exclusive open
+    (Closes: #631574)
 
  -- Ben Hutchings <ben at decadent.org.uk>  Tue, 21 Jun 2011 05:27:43 +0100
 

Added: dists/sid/linux-2.6/debian/patches/bugfix/all/block-blkdev_get-should-access-bd_disk-only-after-su.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/bugfix/all/block-blkdev_get-should-access-bd_disk-only-after-su.patch	Sat Jun 25 05:30:12 2011	(r17722)
@@ -0,0 +1,41 @@
+From: Tejun Heo <tj at kernel.org>
+Date: Wed, 1 Jun 2011 08:27:41 +0200
+Subject: [PATCH] block: blkdev_get() should access ->bd_disk only after
+ success
+
+commit 4c49ff3fe128ca68dabd07537415c419ad7f82f9 upstream.
+
+d4dc210f69 (block: don't block events on excl write for non-optical
+devices) added dereferencing of bdev->bd_disk to test
+GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; however, bdev->bd_disk can be
+%NULL if open failed which can lead to an oops.
+
+Test the flag after testing open was successful, not before.
+
+Signed-off-by: Tejun Heo <tj at kernel.org>
+Reported-by: David Miller <davem at davemloft.net>
+Tested-by: David Miller <davem at davemloft.net>
+Cc: stable at kernel.org
+Signed-off-by: Jens Axboe <jaxboe at fusionio.com>
+---
+ fs/block_dev.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fs/block_dev.c b/fs/block_dev.c
+index 1f2b199..1a2421f 100644
+--- a/fs/block_dev.c
++++ b/fs/block_dev.c
+@@ -1272,8 +1272,8 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)
+ 		 * individual writeable reference is too fragile given the
+ 		 * way @mode is used in blkdev_get/put().
+ 		 */
+-		if ((disk->flags & GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE) &&
+-		    !res && (mode & FMODE_WRITE) && !bdev->bd_write_holder) {
++		if (!res && (mode & FMODE_WRITE) && !bdev->bd_write_holder &&
++		    (disk->flags & GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE)) {
+ 			bdev->bd_write_holder = true;
+ 			disk_block_events(disk);
+ 		}
+-- 
+1.7.5.4
+

Modified: dists/sid/linux-2.6/debian/patches/series/3
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/3	Tue Jun 21 19:36:48 2011	(r17721)
+++ dists/sid/linux-2.6/debian/patches/series/3	Sat Jun 25 05:30:12 2011	(r17722)
@@ -1 +1,2 @@
 + bugfix/x86/Revert-drm-i915-Enable-GMBUS-for-post-gen2-chipsets.patch
++ bugfix/all/block-blkdev_get-should-access-bd_disk-only-after-su.patch



More information about the Kernel-svn-changes mailing list