Aneesh Kumar K.V wrote:Thanks Aneesh, --- Signed-off-by: Roel Kluin <12o3l@tiscali.nl> ext4_mb_init_backend() has a variable i of type ext4_group_t. which is typedefined in include/linux/ext4_fs_i.h:34 to unsigned long. Since unsigned, i >= 0 is always true, so fix hot spins after err_freebuddy and err_freemeta. Also when meta_group_info cannot be allocated prevent a decrement of i when zero. Signed-off-by: Roel Kluin <12o3l@tiscali.nl> --- diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index ef97f19..2c13dca 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -2572,8 +2572,13 @@ static int ext4_mb_init_backend(struct super_block *sb) meta_group_info[j] = kzalloc(len, GFP_KERNEL); if (meta_group_info[j] == NULL) { printk(KERN_ERR "EXT4-fs: can't allocate buddy mem\n"); - i--; - goto err_freebuddy; + if (i != 0) { + i--; + goto err_freebuddy; + } else { + i = num_meta_group_infos - 1; + goto err_freemeta; + } } desc = ext4_get_group_desc(sb, i, NULL); if (desc == NULL) { @@ -2618,14 +2623,14 @@ static int ext4_mb_init_backend(struct super_block *sb) return 0; err_freebuddy: - while (i >= 0) { + do { kfree(ext4_get_group_info(sb, i)); - i--; - } - i = num_meta_group_infos; + } while (i-- != 0); + i = num_meta_group_infos - 1; err_freemeta: - while (--i >= 0) + do { kfree(sbi->s_group_info[i]); + } while (i-- != 0); iput(sbi->s_buddy_cache); err_freesgi: kfree(sbi->s_group_info); --
| David Miller | [GIT]: Networking |
| Andrew Morton | Re: [BUG] New Kernel Bugs |
| Miklos Szeredi | Re: [PATCH] Remove process freezer from suspend to RAM pathway |
| Vladislav Bolkhovitin | Re: Integration of SCST in the mainstream Linux kernel |
git: | |
| David Kastrup | Re: git on MacOSX and files with decomposed utf-8 file names |
| Elijah Newren | Trying to use git-filter-branch to compress history by removing large, obsolete bi... |
| Nguyen Thai Ngoc Duy | [WIP] Get rid of msys in favor of busybox port for windows |
| sean | Adding color to git diff output. |
| Richard Stallman | Real men don't attack straw men |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| carlopmart | About Xen: maybe a reiterative question but .. |
| Douglas A. Tutty | Re: Embedding OpenBSD |
| Pavel Emelyanov | [PATCH net-2.6.25 8/11][IPV6] Use sysctl paths to register ipv6 sysctl tables |
| Jeff Garzik | Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Denys | r8169 crash |
| Jeff Kirsher | [NET-NEXT PATCH 1/3] e1000e: add support for the 82567LM-4 device |
