public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	alan@lxorguk.ukuu.org.uk, Daniel Drake <dsd@laptop.org>,
	Yongqiang Yang <xiaoqiangnk@gmail.com>,
	"Theodore Tso" <tytso@mit.edu>
Subject: [ 068/133] ext4: ignore last group w/o enough space when resizing instead of BUGing
Date: Thu, 11 Oct 2012 07:51:34 +0900	[thread overview]
Message-ID: <20121010224906.732243635@linuxfoundation.org> (raw)
In-Reply-To: <20121010224854.313159132@linuxfoundation.org>

3.5-stable review patch.  If anyone has any objections, please let me know.

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

From: Yongqiang Yang <xiaoqiangnk@gmail.com>

commit 03c1c29053f678234dbd51bf3d65f3b7529021de upstream.

If the last group does not have enough space for group tables, ignore
it instead of calling BUG_ON().

Reported-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/resize.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -200,8 +200,11 @@ static void free_flex_gd(struct ext4_new
  * be a partial of a flex group.
  *
  * @sb: super block of fs to which the groups belongs
+ *
+ * Returns 0 on a successful allocation of the metadata blocks in the
+ * block group.
  */
-static void ext4_alloc_group_tables(struct super_block *sb,
+static int ext4_alloc_group_tables(struct super_block *sb,
 				struct ext4_new_flex_group_data *flex_gd,
 				int flexbg_size)
 {
@@ -226,6 +229,8 @@ static void ext4_alloc_group_tables(stru
 	       (last_group & ~(flexbg_size - 1))));
 next_group:
 	group = group_data[0].group;
+	if (src_group >= group_data[0].group + flex_gd->count)
+		return -ENOSPC;
 	start_blk = ext4_group_first_block_no(sb, src_group);
 	last_blk = start_blk + group_data[src_group - group].blocks_count;
 
@@ -235,7 +240,6 @@ next_group:
 
 	start_blk += overhead;
 
-	BUG_ON(src_group >= group_data[0].group + flex_gd->count);
 	/* We collect contiguous blocks as much as possible. */
 	src_group++;
 	for (; src_group <= last_group; src_group++)
@@ -300,6 +304,7 @@ next_group:
 			       group_data[i].free_blocks_count);
 		}
 	}
+	return 0;
 }
 
 static struct buffer_head *bclean(handle_t *handle, struct super_block *sb,
@@ -1729,7 +1734,8 @@ int ext4_resize_fs(struct super_block *s
 	 */
 	while (ext4_setup_next_flex_gd(sb, flex_gd, n_blocks_count,
 					      flexbg_size)) {
-		ext4_alloc_group_tables(sb, flex_gd, flexbg_size);
+		if (ext4_alloc_group_tables(sb, flex_gd, flexbg_size) != 0)
+			break;
 		err = ext4_flex_group_add(sb, resize_inode, flex_gd);
 		if (unlikely(err))
 			break;



  parent reply	other threads:[~2012-10-10 22:56 UTC|newest]

Thread overview: 134+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10 22:50 [ 000/133] 3.5.7-stable review Greg Kroah-Hartman
2012-10-10 22:50 ` [ 001/133] Revert dyndbg: fix for SOH in logging messages Greg Kroah-Hartman
2012-10-10 22:50 ` [ 002/133] mn10300: only add -mmem-funcs to KBUILD_CFLAGS if gcc supports it Greg Kroah-Hartman
2012-10-10 22:50 ` [ 003/133] kbuild: make: fix if_changed when command contains backslashes Greg Kroah-Hartman
2012-10-10 22:50 ` [ 004/133] kbuild: Fix gcc -x syntax Greg Kroah-Hartman
2012-10-10 22:50 ` [ 005/133] slab: fix the DEADLOCK issue on l3 alien lock Greg Kroah-Hartman
2012-10-10 22:50 ` [ 006/133] intel-iommu: Default to non-coherent for domains unattached to iommus Greg Kroah-Hartman
2012-10-10 22:50 ` [ 007/133] ARM: 7548/1: include linux/sched.h in syscall.h Greg Kroah-Hartman
2012-10-10 22:50 ` [ 008/133] em28xx: Make all em28xx extensions to be initialized asynchronously Greg Kroah-Hartman
2012-10-10 22:50 ` [ 009/133] media: rc: ite-cir: Initialise ite_dev::rdev earlier Greg Kroah-Hartman
2012-10-10 22:50 ` [ 010/133] media: gspca_pac7302: add support for device 1ae7:2001 Speedlink Snappy Microphone SL-6825-SBK Greg Kroah-Hartman
2012-10-10 22:50 ` [ 011/133] ACPI: run _OSC after ACPI_FULL_INITIALIZATION Greg Kroah-Hartman
2012-10-10 22:50 ` [ 012/133] PCI: acpiphp: check whether _ADR evaluation succeeded Greg Kroah-Hartman
2012-10-10 22:50 ` [ 014/133] lib/gcd.c: prevent possible div by 0 Greg Kroah-Hartman
2012-10-10 22:50 ` [ 015/133] kernel/sys.c: call disable_nonboot_cpus() in kernel_restart() Greg Kroah-Hartman
2012-10-10 22:50 ` [ 016/133] drivers/scsi/atp870u.c: fix bad use of udelay Greg Kroah-Hartman
2012-10-10 22:50 ` [ 017/133] lguest: fix occasional crash in example launcher Greg Kroah-Hartman
2012-10-10 22:50 ` [ 018/133] powerpc/eeh: Fix crash on converting OF node to edev Greg Kroah-Hartman
2012-10-10 22:50 ` [ 019/133] ixgbe: fix PTP ethtool timestamping function Greg Kroah-Hartman
2012-10-10 22:50 ` [ 020/133] rapidio/rionet: fix multicast packet transmit logic Greg Kroah-Hartman
2012-10-10 22:50 ` [ 021/133] PM / Sleep: use resume event when call dpm_resume_early Greg Kroah-Hartman
2012-10-10 22:50 ` [ 022/133] workqueue: add missing smp_wmb() in process_one_work() Greg Kroah-Hartman
2012-10-10 22:50 ` [ 023/133] jbd2: dont write superblock when if its empty Greg Kroah-Hartman
2012-10-10 22:50 ` [ 024/133] localmodconfig: Fix localyesconfig to set to y not m Greg Kroah-Hartman
2012-10-10 22:50 ` [ 025/133] bnx2x: fix rx checksum validation for IPv6 Greg Kroah-Hartman
2012-10-10 22:50 ` [ 026/133] tcp: fix regression in urgent data handling Greg Kroah-Hartman
2012-10-10 22:50 ` [ 027/133] xfrm: Workaround incompatibility of ESN and async crypto Greg Kroah-Hartman
2012-10-10 22:50 ` [ 028/133] xfrm_user: return error pointer instead of NULL Greg Kroah-Hartman
2012-10-10 22:50 ` [ 029/133] xfrm_user: return error pointer instead of NULL #2 Greg Kroah-Hartman
2012-10-10 22:50 ` [ 030/133] xfrm: fix a read lock imbalance in make_blackhole Greg Kroah-Hartman
2012-10-10 22:50 ` [ 031/133] xfrm_user: fix info leak in copy_to_user_auth() Greg Kroah-Hartman
2012-10-10 22:50 ` [ 032/133] xfrm_user: fix info leak in copy_to_user_state() Greg Kroah-Hartman
2012-10-10 22:50 ` [ 033/133] xfrm_user: fix info leak in copy_to_user_policy() Greg Kroah-Hartman
2012-10-10 22:51 ` [ 034/133] xfrm_user: fix info leak in copy_to_user_tmpl() Greg Kroah-Hartman
2012-10-10 22:51 ` [ 035/133] xfrm_user: dont copy esn replay window twice for new states Greg Kroah-Hartman
2012-10-10 22:51 ` [ 036/133] net: ethernet: davinci_cpdma: decrease the desc count when cleaning up the remaining packets Greg Kroah-Hartman
2012-10-10 22:51 ` [ 037/133] ixp4xx_hss: fix build failure due to missing linux/module.h inclusion Greg Kroah-Hartman
2012-10-10 22:51 ` [ 038/133] netxen: check for root bus in netxen_mask_aer_correctable Greg Kroah-Hartman
2012-10-10 22:51 ` [ 039/133] net-sched: sch_cbq: avoid infinite loop Greg Kroah-Hartman
2012-10-10 22:51 ` [ 040/133] pkt_sched: fix virtual-start-time update in QFQ Greg Kroah-Hartman
2012-10-10 22:51 ` [ 041/133] sierra_net: Endianess bug fix Greg Kroah-Hartman
2012-10-10 22:51 ` [ 042/133] 8021q: fix mac_len recomputation in vlan_untag() Greg Kroah-Hartman
2012-10-10 22:51 ` [ 043/133] batman-adv: make batadv_test_bit() return 0 or 1 only Greg Kroah-Hartman
2012-10-10 22:51 ` [ 044/133] ipv6: release reference of ip6_null_entrys dst entry in __ip6_del_rt Greg Kroah-Hartman
2012-10-10 22:51 ` [ 045/133] ipv6: del unreachable route when an addr is deleted on lo Greg Kroah-Hartman
2012-10-10 22:51 ` [ 046/133] ipv6: fix return value check in fib6_add() Greg Kroah-Hartman
2012-10-10 22:51 ` [ 047/133] tcp: flush DMA queue before sk_wait_data if rcv_wnd is zero Greg Kroah-Hartman
2012-10-10 22:51 ` [ 048/133] sctp: Dont charge for data in sndbuf again when transmitting packet Greg Kroah-Hartman
2012-10-10 22:51 ` [ 049/133] pppoe: drop PPPOX_ZOMBIEs in pppoe_release Greg Kroah-Hartman
2012-10-10 22:51 ` [ 050/133] net: small bug on rxhash calculation Greg Kroah-Hartman
2012-10-10 22:51 ` [ 051/133] net: guard tcp_set_keepalive() to tcp sockets Greg Kroah-Hartman
2012-10-10 22:51 ` [ 052/133] ipv4: raw: fix icmp_filter() Greg Kroah-Hartman
2012-10-10 22:51 ` [ 053/133] ipv6: raw: fix icmpv6_filter() Greg Kroah-Hartman
2012-10-10 22:51 ` [ 054/133] ipv6: mip6: fix mip6_mh_filter() Greg Kroah-Hartman
2012-10-10 22:51 ` [ 055/133] l2tp: fix a typo in l2tp_eth_dev_recv() Greg Kroah-Hartman
2012-10-10 22:51 ` [ 056/133] netrom: copy_datagram_iovec can fail Greg Kroah-Hartman
2012-10-10 22:51 ` [ 057/133] net: do not disable sg for packets requiring no checksum Greg Kroah-Hartman
2012-10-10 22:51 ` [ 058/133] aoe: assert AoE packets marked as " Greg Kroah-Hartman
2012-10-10 22:51 ` [ 059/133] drm/savage: re-add busmaster enable, regression fix Greg Kroah-Hartman
2012-10-10 22:51 ` [ 060/133] SCSI: zfcp: Adapt to new FC_PORTSPEED semantics Greg Kroah-Hartman
2012-10-10 22:51 ` [ 061/133] SCSI: zfcp: Make trace record tags unique Greg Kroah-Hartman
2012-10-10 22:51 ` [ 062/133] SCSI: zfcp: Bounds checking for deferred error trace Greg Kroah-Hartman
2012-10-10 22:51 ` [ 063/133] SCSI: zfcp: Do not wakeup while suspended Greg Kroah-Hartman
2012-10-10 22:51 ` [ 064/133] SCSI: zfcp: remove invalid reference to list iterator variable Greg Kroah-Hartman
2012-10-10 22:51 ` [ 065/133] SCSI: zfcp: restore refcount check on port_remove Greg Kroah-Hartman
2012-10-10 22:51 ` [ 066/133] SCSI: zfcp: only access zfcp_scsi_dev for valid scsi_device Greg Kroah-Hartman
2012-10-10 22:51 ` [ 067/133] PCI: Check P2P bridge for invalid secondary/subordinate range Greg Kroah-Hartman
2012-10-10 22:51 ` Greg Kroah-Hartman [this message]
2012-10-10 22:51 ` [ 069/133] ext4: dont copy non-existent gdt blocks when resizing Greg Kroah-Hartman
2012-10-10 22:51 ` [ 070/133] ext4: avoid duplicate writes of the backup bg descriptor blocks Greg Kroah-Hartman
2012-10-10 22:51 ` [ 071/133] ext4: fix potential deadlock in ext4_nonda_switch() Greg Kroah-Hartman
2012-10-10 22:51 ` [ 072/133] ext4: fix crash when accessing /proc/mounts concurrently Greg Kroah-Hartman
2012-10-10 22:51 ` [ 073/133] ext4: move_extent code cleanup Greg Kroah-Hartman
2012-10-10 22:51 ` [ 074/133] ext4: online defrag is not supported for journaled files Greg Kroah-Hartman
2012-10-10 22:51 ` [ 075/133] ext4: always set i_op in ext4_mknod() Greg Kroah-Hartman
2012-10-10 22:51 ` [ 076/133] ext4: fix fdatasync() for files with only i_size changes Greg Kroah-Hartman
2012-10-10 22:51 ` [ 077/133] xfrm_user: ensure user supplied esn replay window is valid Greg Kroah-Hartman
2012-10-10 22:51 ` [ 078/133] ASoC: wm_hubs: Ensure volume updates are handled during class W startup Greg Kroah-Hartman
2012-10-10 22:51 ` [ 079/133] ASoC: wm9712: Fix name of Capture Switch Greg Kroah-Hartman
2012-10-10 22:51 ` [ 080/133] kpageflags: fix wrong KPF_THP on non-huge compound pages Greg Kroah-Hartman
2012-10-10 22:51 ` [ 081/133] hugetlb: do not use vma_hugecache_offset() for vma_prio_tree_foreach Greg Kroah-Hartman
2012-10-10 22:51 ` [ 082/133] mm: fix invalidate_complete_page2() lock ordering Greg Kroah-Hartman
2012-10-10 22:51 ` [ 083/133] mm: thp: fix pmd_present for split_huge_page and PROT_NONE with THP Greg Kroah-Hartman
2012-10-10 22:51 ` [ 084/133] MIPS: ath79: use correct fractional dividers for {CPU,DDR}_PLL on AR934x Greg Kroah-Hartman
2012-10-10 22:51 ` [ 085/133] drm/i915: prevent possible pin leak on error path Greg Kroah-Hartman
2012-10-10 22:51 ` [ 086/133] ALSA: hda - Add inverted internal mic quirk for Lenovo IdeaPad U310 Greg Kroah-Hartman
2012-10-10 22:51 ` [ 087/133] ALSA: aloop - add locking to timer access Greg Kroah-Hartman
2012-10-10 22:51 ` [ 088/133] ALSA: hda/realtek - Fix detection of ALC271X codec Greg Kroah-Hartman
2012-10-10 22:51 ` [ 089/133] ALSA: hda - limit internal mic boost for Asus X202E Greg Kroah-Hartman
2012-10-10 22:51 ` [ 090/133] ALSA: usb - disable broken hw volume for Tenx TP6911 Greg Kroah-Hartman
2012-10-10 22:51 ` [ 091/133] ALSA: USB: Support for (original) Xbox Communicator Greg Kroah-Hartman
2012-10-10 22:51 ` [ 092/133] drm/nvc0/fence: restore pre-suspend fence buffer context on resume Greg Kroah-Hartman
2012-10-10 22:51 ` [ 093/133] drm: Destroy the planes prior to destroying the associated CRTC Greg Kroah-Hartman
2012-10-10 22:52 ` [ 094/133] drm/radeon: only adjust default clocks on NI GPUs Greg Kroah-Hartman
2012-10-10 22:52 ` [ 095/133] drm/radeon: Add MSI quirk for gateway RS690 Greg Kroah-Hartman
2012-10-10 22:52 ` [ 096/133] drm/radeon: force MSIs on RS690 asics Greg Kroah-Hartman
2012-10-10 22:52 ` [ 097/133] drm/i915: Flush the pending flips on the CRTC before modification Greg Kroah-Hartman
2012-10-10 22:52 ` [ 098/133] drm/i915: call drm_handle_vblank before finish_page_flip Greg Kroah-Hartman
2012-10-10 22:52 ` [ 099/133] drm/i915: Fix GT_MODE default value Greg Kroah-Hartman
2012-10-10 22:52 ` [ 100/133] ia64: Add missing RCU idle APIs on idle loop Greg Kroah-Hartman
2012-10-10 22:52 ` [ 101/133] h8300: " Greg Kroah-Hartman
2012-10-10 22:52 ` [ 102/133] parisc: " Greg Kroah-Hartman
2012-10-10 22:52 ` [ 103/133] xtensa: " Greg Kroah-Hartman
2012-10-11  0:25   ` Chris Zankel
2012-10-10 22:52 ` [ 104/133] frv: " Greg Kroah-Hartman
2012-10-10 22:52 ` [ 105/133] mn10300: " Greg Kroah-Hartman
2012-10-10 22:52 ` [ 106/133] m68k: " Greg Kroah-Hartman
2012-10-10 22:52 ` [ 107/133] alpha: " Greg Kroah-Hartman
2012-10-10 22:52 ` [ 108/133] cris: " Greg Kroah-Hartman
2012-10-10 22:52 ` [ 109/133] m32r: " Greg Kroah-Hartman
2012-10-10 22:52 ` [ 110/133] score: " Greg Kroah-Hartman
2012-10-10 22:52 ` [ 111/133] rcu: Fix day-one dyntick-idle stall-warning bug Greg Kroah-Hartman
2012-10-10 22:52 ` [ 112/133] revert "mm: mempolicy: Let vma_merge and vma_split handle vma->vm_policy linkages" Greg Kroah-Hartman
2012-10-10 22:52 ` [ 113/133] mempolicy: remove mempolicy sharing Greg Kroah-Hartman
2012-10-10 22:52 ` [ 114/133] mempolicy: fix a race in shared_policy_replace() Greg Kroah-Hartman
2012-10-10 22:52 ` [ 115/133] mempolicy: fix refcount leak in mpol_set_shared_policy() Greg Kroah-Hartman
2012-10-10 22:52 ` [ 116/133] mempolicy: fix a memory corruption by refcount imbalance in alloc_pages_vma() Greg Kroah-Hartman
2012-10-10 22:52 ` [ 117/133] Revert "KVM: VMX: Fix KVM_SET_SREGS with big real mode segments" Greg Kroah-Hartman
2012-10-10 22:52 ` [ 118/133] efi: Build EFI stub with EFI-appropriate options Greg Kroah-Hartman
2012-10-10 22:52 ` [ 119/133] efi: initialize efi.runtime_version to make query_variable_info/update_capsule workable Greg Kroah-Hartman
2012-10-10 22:52 ` [ 120/133] CPU hotplug, cpusets, suspend: Dont modify cpusets during suspend/resume Greg Kroah-Hartman
2012-10-10 22:52 ` [ 121/133] Revert "drm/i915: correctly order the ring init sequence" Greg Kroah-Hartman
2012-10-10 22:52 ` [ 122/133] mtd: mtdpart: break it as soon as we parse out the partitions Greg Kroah-Hartman
2012-10-10 22:52 ` [ 123/133] mtd: autcpu12-nvram: Fix compile breakage Greg Kroah-Hartman
2012-10-10 22:52 ` [ 124/133] mtd: nandsim: bugfix: fail if overridesize is too big Greg Kroah-Hartman
2012-10-10 22:52 ` [ 125/133] mtd: nand: Use the mirror BBT descriptor when reading its version Greg Kroah-Hartman
2012-10-10 22:52 ` [ 126/133] mtd: omap2: fix omap_nand_remove segfault Greg Kroah-Hartman
2012-10-10 22:52 ` [ 127/133] mtd: omap2: fix module loading Greg Kroah-Hartman
2012-10-10 22:52 ` [ 128/133] mmc: omap_hsmmc: Pass on the suspend failure to the PM core Greg Kroah-Hartman
2012-10-10 22:52 ` [ 129/133] mmc: sh-mmcif: avoid oops on spurious interrupts Greg Kroah-Hartman
2012-10-10 22:52 ` [ 130/133] JFFS2: fix unmount regression Greg Kroah-Hartman
2012-10-10 22:52 ` [ 131/133] JFFS2: dont fail on bitflips in OOB Greg Kroah-Hartman
2012-10-10 22:52 ` [ 132/133] cifs: reinstate the forcegid option Greg Kroah-Hartman
2012-10-10 22:52 ` [ 133/133] Convert properly UTF-8 to UTF-16 Greg Kroah-Hartman

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=20121010224906.732243635@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dsd@laptop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=xiaoqiangnk@gmail.com \
    /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