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

Bug#647185: linux-2.6: kernel null pointer dereference while adding SAN path



On Wed, 2011-11-02 at 04:56 +0000, Ben Hutchings wrote:
> On Mon, 2011-10-31 at 14:35 +0100, Bernd Zeimetz wrote:
> > Package: linux-2.6
> > Version: 2.6.32-38
> > 
> > Hi,
> > 
> > removing paths to our SAN and adding them back results in
> [...]
> 
> Does the attached patch help?  Instructions for building a patched
> kernel can be found at:
> 
> http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s-common-official

Sorry, you'll need this patch as well.

Ben.

-- 
Ben Hutchings
Sturgeon's Law: Ninety percent of everything is crap.
From: Mike Anderson <andmike@linux.vnet.ibm.com>
Date: Thu, 10 Dec 2009 23:52:20 +0000
Subject: [PATCH] dm: add dm_deleting_md function

commit 432a212c0dd0f4ca386cf37c5b740ac9dbda4479 upstream.

Add dm_deleting_md to check whether or not a given mapped
device is currently being deleted.

Signed-off-by: Mike Anderson <andmike@linux.vnet.ibm.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
---
 drivers/md/dm.c |    9 +++++++--
 drivers/md/dm.h |    5 +++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 233a2e9..16f759f 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -329,6 +329,11 @@ static void __exit dm_exit(void)
 /*
  * Block device functions
  */
+int dm_deleting_md(struct mapped_device *md)
+{
+	return test_bit(DMF_DELETING, &md->flags);
+}
+
 static int dm_blk_open(struct block_device *bdev, fmode_t mode)
 {
 	struct mapped_device *md;
@@ -340,7 +345,7 @@ static int dm_blk_open(struct block_device *bdev, fmode_t mode)
 		goto out;
 
 	if (test_bit(DMF_FREEING, &md->flags) ||
-	    test_bit(DMF_DELETING, &md->flags)) {
+	    dm_deleting_md(md)) {
 		md = NULL;
 		goto out;
 	}
@@ -2659,7 +2664,7 @@ struct mapped_device *dm_get_from_kobject(struct kobject *kobj)
 		return NULL;
 
 	if (test_bit(DMF_FREEING, &md->flags) ||
-	    test_bit(DMF_DELETING, &md->flags))
+	    dm_deleting_md(md))
 		return NULL;
 
 	dm_get(md);
diff --git a/drivers/md/dm.h b/drivers/md/dm.h
index 4a95e8f..604a5f2 100644
--- a/drivers/md/dm.h
+++ b/drivers/md/dm.h
@@ -89,6 +89,11 @@ int dm_target_iterate(void (*iter_func)(struct target_type *tt,
 int dm_split_args(int *argc, char ***argvp, char *input);
 
 /*
+ * Is this mapped_device being deleted?
+ */
+int dm_deleting_md(struct mapped_device *md);
+
+/*
  * The device-mapper can be driven through one of two interfaces;
  * ioctl or filesystem, depending which patch you have applied.
  */
-- 
1.7.7

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: