FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

LinkBack Thread Tools
Old 08-04-2011, 09:34 PM
Mike Snitzer
Default dm table: fix potential NULL pointer in dm_table_set_integrity

Commit a63a5cf (dm: improve block integrity support) introduced a
two-phase initialization of a DM device's integrity profile. The
dm_table_set_integrity() call to blk_integrity_register() may deference
a NULL 'template_disk' due to an integrity profile mismatch.

An integrity profile mismatch can occur if the integrity profile for
devices in a DM table are changed between the call to
dm_table_prealloc_integrity() and dm_table_set_integrity() (possible
via table loads for stacked DM devices with integrity profiles).

Reported-by: Zdenek Kabelac <zkabelac@redhat.com> (coverity run)
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@kernel.org # >= 2.6.39.y
drivers/md/dm-table.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 5e8e2f3..6cd8d95 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1260,14 +1260,15 @@ static void dm_table_set_integrity(struct dm_table *t)

template_disk = dm_table_get_integrity_disk(t, true);
- if (!template_disk &&
- blk_integrity_is_initialized(dm_disk(t->md))) {
+ if (template_disk)
+ blk_integrity_register(dm_disk(t->md),
+ blk_get_integrity(template_disk));
+ else if (blk_integrity_is_initialized(dm_disk(t->md)))
DMWARN("%s: device no longer has a valid integrity profile",
- return;
- }
- blk_integrity_register(dm_disk(t->md),
- blk_get_integrity(template_disk));
+ else
+ DMWARN("%s: unable to establish an integrity profile",
+ dm_device_name(t->md));

void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,

dm-devel mailing list

Thread Tools

All times are GMT. The time now is 10:49 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org