partitions/aix: fix usage of uninitialized lv_info and lvname structures
Mauricio Faria de Oliveira authored
[ Upstream commit 14cb2c8a ]

The if-block that sets a successful return value in aix_partition()
uses 'lvip[].pps_per_lv' and 'n[].name' potentially uninitialized.

For example, if 'numlvs' is zero or alloc_lvn() fails, neither is
initialized, but are used anyway if alloc_pvd() succeeds after it.

So, make the alloc_pvd() call conditional on their initialization.

This has been hit when attaching an apparently corrupted/stressed
AIX LUN, misleading the kernel to pr_warn() invalid data and hang.

    [...] partition (null) (11 pp's found) is not contiguous
    [...] partition (null) (2 pp's found) is not contiguous
    [...] partition (null) (3 pp's found) is not contiguous
    [...] partition (null) (64 pp's found) is not contiguous

Fixes: 6ceea22b

 ("partitions: add aix lvm partition support files")
Signed-off-by: default avatarMauricio Faria de Oliveira <mfo@canonical.com>
Signed-off-by: Jens Axboe <axboe@ker...
c919a682
Name Last commit Last update
..
partitions partitions/aix: fix usage of uninitialized lv_info and lvname structures
Kconfig block: Add T10 Protection Information functions
Kconfig.iosched blkcg: make CONFIG_BLK_CGROUP bool
Makefile block: Add T10 Protection Information functions
bio-integrity.c bio-integrity: Do not allocate integrity context for bio w/o data
bio.c fix unbalanced page refcounting in bio_map_user_iov
blk-cgroup.c blkcg: fix gendisk reference leak in blkg_conf_prep()
blk-cgroup.h blkcg: remove blkcg->id
blk-core.c block: Relax a check in blk_start_queue()
blk-exec.c blk-mq: avoid infinite recursion with the FUA flag
blk-flush.c blk-mq: fix race between timeout and freeing request
blk-integrity.c block: Don't merge requests if integrity flags differ
blk-ioc.c block: Substitute rcu_access_pointer() for rcu_dereference_raw()
blk-iopoll.c Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next
blk-lib.c block/blk-lib.c: make __blkdev_issue_zeroout static
blk-map.c block: remove struct request buffer member
blk-merge.c Fix bug in blk_rq_merge_ok
blk-mq-cpu.c blk-mq: add file comments and update copyright notices
blk-mq-cpumap.c blk-mq: use 'nr_cpu_ids' as highest CPU ID count for hwq <-> cpu map
blk-mq-sysfs.c blk-mq: fix buffer overflow when reading sysfs file of 'pending'
blk-mq-tag.c blk-mq: fix race between timeout and freeing request
blk-mq-tag.h blk-mq: fix race between timeout and freeing request
blk-mq.c blk-mq: fix race between timeout and freeing request
blk-mq.h block: introduce blk_init_flush and its pair
blk-settings.c sd: Fix maximum I/O size for BLOCK_PC requests
blk-softirq.c
blk-sysfs.c
blk-tag.c
blk-throttle.c
blk-timeout.c
blk.h
bounce.c
bsg-lib.c
bsg.c
cfq-iosched.c
cmdline-parser.c
compat_ioctl.c
deadline-iosched.c
elevator.c
genhd.c
ioctl.c
ioprio.c
noop-iosched.c
partition-generic.c
scsi_ioctl.c
t10-pi.c