linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, Denis Kirjanov <kda@linux-powerpc.org>,
	"Theodore Ts'o" <tytso@mit.edu>, "Jan Kara" <jack@suse.cz>
Subject: [PATCH 3.16 063/129] ext4: fix crash during online resizing
Date: Sun, 07 Jul 2019 17:54:17 +0100	[thread overview]
Message-ID: <lsq.1562518457.229289167@decadent.org.uk> (raw)
In-Reply-To: <lsq.1562518456.876074874@decadent.org.uk>

3.16.70-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Kara <jack@suse.cz>

commit f96c3ac8dfc24b4e38fc4c2eba5fea2107b929d1 upstream.

When computing maximum size of filesystem possible with given number of
group descriptor blocks, we forget to include s_first_data_block into
the number of blocks. Thus for filesystems with non-zero
s_first_data_block it can happen that computed maximum filesystem size
is actually lower than current filesystem size which confuses the code
and eventually leads to a BUG_ON in ext4_alloc_group_tables() hitting on
flex_gd->count == 0. The problem can be reproduced like:

truncate -s 100g /tmp/image
mkfs.ext4 -b 1024 -E resize=262144 /tmp/image 32768
mount -t ext4 -o loop /tmp/image /mnt
resize2fs /dev/loop0 262145
resize2fs /dev/loop0 300000

Fix the problem by properly including s_first_data_block into the
computed number of filesystem blocks.

Fixes: 1c6bd7173d66 "ext4: convert file system to meta_bg if needed..."
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ext4/resize.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1931,7 +1931,8 @@ retry:
 				le16_to_cpu(es->s_reserved_gdt_blocks);
 			n_group = n_desc_blocks * EXT4_DESC_PER_BLOCK(sb);
 			n_blocks_count = (ext4_fsblk_t)n_group *
-				EXT4_BLOCKS_PER_GROUP(sb);
+				EXT4_BLOCKS_PER_GROUP(sb) +
+				le32_to_cpu(es->s_first_data_block);
 			n_group--; /* set to last group number */
 		}
 


  parent reply	other threads:[~2019-07-07 19:38 UTC|newest]

Thread overview: 138+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-07 16:54 [PATCH 3.16 000/129] 3.16.70-rc1 review Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 009/129] clk: vf610: fix refcount leak in vf610_clocks_init() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 091/129] Btrfs: fix corruption reading shared and compressed extents after hole punching Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 008/129] clk: imx6sx: fix refcount leak in imx6sx_clocks_init() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 033/129] pinctrl: sh-pfc: r8a7778: Fix HSPI pin numbers and names Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 114/129] It's wrong to add len to sector_nr in raid10 reshape twice Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 110/129] route: set the deleted fnhe fnhe_daddr to 0 in ip_del_fnhe to fix a race Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 037/129] mtd: docg3: Don't leak docg3->bbt in error path Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 048/129] USB: serial: cp210x: add ID for Ingenico 3070 Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 074/129] perf header: Fix wrong node write in NUMA_TOPOLOGY feature Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 061/129] pinctrl: sh-pfc: r8a7791: Fix scifb2_data_c pin group Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 077/129] KVM: x86/mmu: Do not cache MMIO accesses while memslots are in flux Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 040/129] tty: ipwireless: Fix potential NULL pointer dereference Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 080/129] powerpc/83xx: Also save/restore SPRG4-7 during suspend Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 095/129] powerpc/32: Clear on-stack exception marker upon exception return Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 128/129] mwifiex: Fix heap overflow in mwifiex_uap_parse_tail_ies() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 106/129] net/hsr: fix possible crash in add_timer() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 035/129] applicom: Fix potential Spectre v1 vulnerabilities Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 081/129] powerpc/wii: properly disable use of BATs when requested Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 026/129] media: s5p-jpeg: Check for fmt_ver_flag when doing fmt enumeration Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 119/129] l2tp: fix infoleak in l2tp_ip6_recvmsg() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 093/129] NFSv4.1: Reinitialise sequence results before retransmitting a request Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 065/129] tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 105/129] scsi: virtio_scsi: don't send sc payload with tmfs Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 075/129] drm/radeon/evergreen_cs: fix missing break in switch statement Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 005/129] clk: socfpga: fix refcount leak Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 078/129] fs/nfs: Fix nfs_parse_devname to not modify it's argument Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 079/129] irqchip/brcmstb-l2: Use _irqsave locking variants in non-interrupt code Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 113/129] kernel/sysctl.c: add missing range check in do_proc_dointvec_minmax_conv Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 003/129] staging: iio: adt7316: allow adt751x to use internal vref for all dacs Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 052/129] rtc: 88pm80x: fix unintended sign extension Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 010/129] clk: armada-370: fix refcount leak in a370_clk_init() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 071/129] ASoC: fsl_esai: fix register setting issue in RIGHT_J mode Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 117/129] net/mlx4_core: Fix locking in SRIOV mode when switching between events and polling Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 017/129] staging: iio: adt7316: fix the dac write calculation Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 094/129] 9p: use inode->i_lock to protect i_size_write() under 32-bit Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 013/129] clk: dove: fix refcount leak in dove_clk_init() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 045/129] splice: don't merge into linked buffers Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 023/129] selinux: avoid silent denials in permissive mode under RCU walk Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 086/129] ALSA: bebob: use more identical mod_alias for Saffire Pro 10 I/O against Liquid Saffire 56 Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 064/129] iscsi_ibft: Fix missing break in switch statement Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 098/129] CIFS: Do not reset lease state to NONE on lease break Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 047/129] rtc: ds1672: fix unintended sign extension Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 076/129] ASoC: fsl: Fix of-node refcount unbalance in fsl_ssi_probe_from_dt() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 025/129] powerpc/irq: drop arch_early_irq_init() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 089/129] regulator: wm831x-dcdc: Fix list of wm831x_dcdc_ilim from mA to uA Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 100/129] CIFS: Fix read after write for files with read caching Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 019/129] ARM: s3c24xx: Fix boolean expressions in osiris_dvs_notify Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 116/129] net: sh_eth: fix a missing check of of_get_phy_mode Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 024/129] crypto: pcbc - remove bogus memcpy()s with src == dest Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 088/129] serial: 8250_of: assume reg-shift of 2 for mrvl,mmp-uart Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 030/129] crypto: tgr192 - fix unaligned memory access Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 004/129] clk: highbank: fix refcount leak in hb_clk_init() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 092/129] tools lib traceevent: Fix buffer overflow in arg_eval Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 027/129] media: s5p-jpeg: Correct step and max values for V4L2_CID_JPEG_RESTART_INTERVAL Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 058/129] ext4: update quota information while swapping boot loader inode Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 044/129] crypto: arm64/aes-ccm - fix logical bug in AAD MAC handling Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 111/129] vxlan: test dev->flags & IFF_UP before calling gro_cells_receive() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 101/129] mm/vmalloc: fix size check for remap_vmalloc_range_partial() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 001/129] staging: iio: adt7316: fix register and bit definitions Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 068/129] serial: 8250_pci: Have ACCES cards that use the four port Pericom PI7C9X7954 chip use the pci_pericom_setup() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 115/129] md: Fix failed allocation of md_register_thread Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 011/129] clk: kirkwood: fix refcount leak in kirkwood_clk_init() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 029/129] crypto: hash - set CRYPTO_TFM_NEED_KEY if ->setkey() fails Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 007/129] clk: imx6q: fix refcount leak in imx6q_clocks_init() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 108/129] lib/div64.c: off by one in shift Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 018/129] drm: Fix error handling in drm_legacy_addctx Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 112/129] gro_cells: make sure device is up in gro_cells_receive() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 002/129] staging: iio: adt7316: invert the logic of the check for an ldac pin Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 038/129] mtd: docg3: Fix kasprintf() usage Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 042/129] devres: always use dev_name() in devm_ioremap_resource() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 039/129] mtd: docg3: Fix passing zero to 'PTR_ERR' warning in doc_probe_device Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 049/129] media: uvcvideo: Avoid NULL pointer dereference at the end of streaming Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 072/129] cdc-wdm: pass return value of recover_from_urb_loss Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 118/129] net/mlx4_core: Fix qp mtt size calculation Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 070/129] USB: serial: ftdi_sio: add ID for Hjelmslund Electronics USB485 Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 129/129] netns: provide pure entropy for net_hash_mix() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 099/129] nfsd: fix memory corruption caused by readdir Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 096/129] net-sysfs: Fix mem leak in netdev_register_kobject Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 082/129] clocksource/drivers/exynos_mct: Fix error path in timer resources initialization Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 103/129] mm, swap: bounds check swap_info array accesses to avoid NULL derefs Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 087/129] staging: android: ashmem: Avoid range_alloc() allocation with ashmem_mutex held Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 066/129] tpm: Fix off-by-one when reading binary_bios_measurements Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 021/129] RDMA/ocrdma: Fix out of bounds index check in query pkey Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 016/129] staging: iio: adt7316: fix the dac read calculation Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 053/129] rtc: pm8xxx: fix unintended sign extension Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 034/129] hpet: Fix missing '=' character in the __setup() code of hpet_mmap_enable Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 104/129] s390/virtio: handle find on invalid queue gracefully Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 107/129] cpufreq: pxa2xx: remove incorrect __init annotation Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 028/129] media: v4l2: i2c: ov7670: Fix PLL bypass register values Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 083/129] mmc: omap: fix the maximum timeout setting Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 043/129] crypto: testmgr - skip crc32c context test for ahash algorithms Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 056/129] jbd2: clear dirty flag when revoking a buffer from an older transaction Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 122/129] fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 015/129] staging: iio: adt7316: fix handling of dac high resolution option Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 123/129] fuse: Add FOPEN_STREAM to use stream_open() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 127/129] mwifiex: Abort at too short BSS descriptor element Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 062/129] pinctrl: sh-pfc: sh73a0: Fix fsic_spdif pin groups Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 090/129] powerpc/powernv: Make opal log only readable by root Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 051/129] rtc: 88pm860x: fix unintended sign extension Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 060/129] parport_pc: fix find_superio io compare code, should use equal test Ben Hutchings
2019-07-07 16:54 ` Ben Hutchings [this message]
2019-07-07 16:54 ` [PATCH 3.16 055/129] bcache: treat stale && dirty keys as bad keys Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 109/129] xen, cpu_hotplug: Prevent an out of bounds access Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 073/129] libertas_tf: don't set URB_ZERO_PACKET on IN USB transfer Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 036/129] rcu: Do RCU GP kthread self-wakeup from softirq and interrupt Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 050/129] crypto: ahash - fix another early termination in hash walk Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 125/129] media: uvcvideo: Fix 'type' check leading to overflow Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 126/129] mwifiex: Fix possible buffer overflows at parsing bss descriptor Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 012/129] clk: armada-xp: fix refcount leak in axp_clk_init() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 014/129] staging: iio: adt7316: fix dac_bits assignment Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 057/129] ext4: fix check of inode in swap_inode_boot_loader Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 069/129] leds: lp55xx: fix null deref on firmware load failure Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 102/129] mm: fix potential data race in SyS_swapon Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 124/129] binder: Replace "%p" with "%pK" for stable Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 121/129] tcp: refine memory limit test in tcp_fragment() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 022/129] security/selinux: pass 'flags' arg to avc_audit() and avc_has_perm_flags() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 120/129] pptp: dst_release sk_dst_cache in pptp_sock_destruct Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 084/129] btrfs: init csum_list before possible free Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 046/129] scsi: target/iscsi: Avoid iscsit_release_commands_from_conn() deadlock Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 085/129] powerpc/mm/hash: Handle mmap_min_addr correctly in get_unmapped_area topdown search Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 020/129] IB/usnic: Fix out of bounds index check in query pkey Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 059/129] ext4: add mask of ext4 flags to swap Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 032/129] m68k: Add -ffreestanding to CFLAGS Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 054/129] bcache: never writeback a discard operation Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 097/129] ip6mr: Do not call __IP6_INC_STATS() from preemptible context Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 067/129] serial: 8250_pci: Fix number of ports for ACCES serial cards Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 031/129] ASoC: imx-sgtl5000: put of nodes if finding codec fails Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 006/129] clk: samsung: exynos4: fix refcount leak in exynos4_get_xom() Ben Hutchings
2019-07-07 16:54 ` [PATCH 3.16 041/129] ext2: Fix underflow in ext2_max_size() Ben Hutchings
2019-07-08 11:05 ` [PATCH 3.16 000/129] 3.16.70-rc1 review Guenter Roeck
2019-07-08 15:21   ` Ben Hutchings
2019-07-08 13:05 ` Luke Nowakowski-Krijger
2019-07-08 15:29   ` Ben Hutchings
2019-07-08 20:21     ` Luke Nowakowski-Krijger
2019-07-08 13:43 ` Amol Surati
2019-07-09 18:07 ` Guenter Roeck
2019-07-09 18:09   ` Ben Hutchings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lsq.1562518457.229289167@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=kda@linux-powerpc.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).