All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3 of 9] md fix null pointer deref
@ 2010-11-18 23:42 Jonathan Brassow
  0 siblings, 0 replies; only message in thread
From: Jonathan Brassow @ 2010-11-18 23:42 UTC (permalink / raw)
  To: dm-devel

Patch name: md-fix-null-pointer-deref.patch

Fix NULL pointer dereference.

When the module parameter 'start_dirty_degraded' is set, the
RAID is not in sync, and a drive needs to be rebuilt, there
will be BUG() called when finished because 'sysfs_notify_dirent'
is called with a NULL argument.  (rdev->sysfs_state is not
always set.)

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>

Index: linux-2.6/drivers/md/md.c
===================================================================
--- linux-2.6.orig/drivers/md/md.c
+++ linux-2.6/drivers/md/md.c
@@ -7227,6 +7227,8 @@ static int __init md_init(void)
 	raid_table_header = register_sysctl_table(raid_root_table);
 
 	md_geninit();
+	if (start_dirty_degraded)
+		printk(KERN_INFO "md: start_dirty_degraded set\n");
 	return 0;
 }
 
Index: linux-2.6/drivers/md/raid5.c
===================================================================
--- linux-2.6.orig/drivers/md/raid5.c
+++ linux-2.6/drivers/md/raid5.c
@@ -5339,7 +5339,7 @@ static int raid5_spare_active(mddev_t *m
 		    && !test_bit(Faulty, &tmp->rdev->flags)
 		    && !test_and_set_bit(In_sync, &tmp->rdev->flags)) {
 			count++;
-			sysfs_notify_dirent(tmp->rdev->sysfs_state);
+			sysfs_notify_dirent_safe(tmp->rdev->sysfs_state);
 		}
 	}
 	spin_lock_irqsave(&conf->device_lock, flags);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-11-18 23:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-18 23:42 [PATCH 3 of 9] md fix null pointer deref Jonathan Brassow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.