summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2021-01-17 14:24:13 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2021-01-17 14:24:13 +0100
commitcf3e310ff85b280eec62a1470465d986be80c204 (patch)
tree0c54b22039687e9ad214d6da7ca1506bcc30b888 /block
parentd29d26d11fc2c6457fc0d7b45b67d01a81575cea (diff)
parent4328b0f47a72b408ff9038a79817b3698281914f (diff)
Merge 4.4.252 into android-4.4-p
Changes in 4.4.252 target: add XCOPY target/segment desc sense codes target: bounds check XCOPY segment descriptor list target: simplify XCOPY wwn->se_dev lookup helper target: use XCOPY segment descriptor CSCD IDs xcopy: loop over devices using idr helper scsi: target: Fix XCOPY NAA identifier lookup powerpc: Fix incorrect stw{, ux, u, x} instructions in __set_pte_at net: ip: always refragment ip defragmented packets net: fix pmtu check in nopmtudisc mode vmlinux.lds.h: Add PGO and AutoFDO input sections ubifs: wbuf: Don't leak kernel memory to flash spi: pxa2xx: Fix use-after-free on unbind cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get() wil6210: select CONFIG_CRC32 block: rsxx: select CONFIG_CRC32 iommu/intel: Fix memleak in intel_irq_remapping_alloc block: fix use-after-free in disk_part_iter_next net: drop bogus skb with CHECKSUM_PARTIAL and offset beyond end of trimmed packet Linux 4.4.252 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I52de3890001cf1dd465a82774f65934443485761
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/block/genhd.c b/block/genhd.c
index a87e77626504..3585b8d60255 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -158,14 +158,17 @@ struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter)
part = rcu_dereference(ptbl->part[piter->idx]);
if (!part)
continue;
+ get_device(part_to_dev(part));
+ piter->part = part;
if (!part_nr_sects_read(part) &&
!(piter->flags & DISK_PITER_INCL_EMPTY) &&
!(piter->flags & DISK_PITER_INCL_EMPTY_PART0 &&
- piter->idx == 0))
+ piter->idx == 0)) {
+ put_device(part_to_dev(part));
+ piter->part = NULL;
continue;
+ }
- get_device(part_to_dev(part));
- piter->part = part;
piter->idx += inc;
break;
}