2008-04-11 19:48:13

by Josef Bacik

[permalink] [raw]
Subject: [PATCH] check return of ext4_orphan_get properly

Hello,

Hit a panic while running fsfuzzer, seems we are improperly checking the return
of ext4_orphan_get. This patch fixes the problem, thank you

Signed-off-by: Josef Bacik <[email protected]>


Index: linux-2.6/fs/ext4/super.c
===================================================================
--- linux-2.6.orig/fs/ext4/super.c
+++ linux-2.6/fs/ext4/super.c
@@ -1652,8 +1652,8 @@ static void ext4_orphan_cleanup (struct
while (es->s_last_orphan) {
struct inode *inode;

- if (!(inode =
- ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan)))) {
+ inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan));
+ if (IS_ERR(inode)) {
es->s_last_orphan = 0;
break;
}


2008-04-11 20:23:33

by Mingming Cao

[permalink] [raw]
Subject: Re: [PATCH] check return of ext4_orphan_get properly

On Fri, 2008-04-11 at 15:32 -0400, Josef Bacik wrote:
> Hello,
>
> Hit a panic while running fsfuzzer, seems we are improperly checking the return
> of ext4_orphan_get. This patch fixes the problem, thank you
>
> Signed-off-by: Josef Bacik <[email protected]>
>

Thanks, added to the patch queue.
>
> Index: linux-2.6/fs/ext4/super.c
> ===================================================================
> --- linux-2.6.orig/fs/ext4/super.c
> +++ linux-2.6/fs/ext4/super.c
> @@ -1652,8 +1652,8 @@ static void ext4_orphan_cleanup (struct
> while (es->s_last_orphan) {
> struct inode *inode;
>
> - if (!(inode =
> - ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan)))) {
> + inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan));
> + if (IS_ERR(inode)) {
> es->s_last_orphan = 0;
> break;
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html