dm raid: fix oops on upgrading to extended superblock format
authorHeinz Mauelshagen <heinzm@redhat.com>
Fri, 23 Jun 2017 15:27:01 +0000 (17:27 +0200)
committerMike Snitzer <snitzer@redhat.com>
Fri, 23 Jun 2017 16:16:15 +0000 (12:16 -0400)
commitc4d097d13052d1e6f29b8798264aed6135d99568
treed67e5acc7bbc9657e1814e4d71678d22fe853eda
parentfeb7695fe9fb83084aa29de0094774f4c9d4c9fc
dm raid: fix oops on upgrading to extended superblock format

When a RAID set was created on dm-raid version < 1.9.0 (old RAID
superblock format), all of the new 1.9.0 members of the superblock are
uninitialized (zero) -- including the device sectors member needed to
support shrinking.

All the other accesses to superblock fields new in 1.9.0 were reviewed
and verified to be properly guarded against invalid use.  The 'sectors'
member was the only one used when the superblock version is < 1.9.

Don't access the superblock's >= 1.9.0 'sectors' member unconditionally.
Also add respective comments.

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-raid.c