diff mbox

[U-Boot] For bug in UBIFS function ubifs_finddir

Message ID 4DFC750F.7050605@teamboyce.co.uk
State Changes Requested
Delegated to: Stefan Roese
Headers show

Commit Message

Rod Boyce June 18, 2011, 9:51 a.m. UTC
Free private_data member element before freeing file structure.  This
was causing malloc to crash.  Also remove unnecessary variable
assigments after file structure was free'd.

Signed-off-by: Rod Boyce <uboot@teamboyce.co.uk>
------------------------------- fs/ubifs/ubifs.c 
------------------------------

Comments

Stefan Roese June 29, 2011, 8:34 a.m. UTC | #1
Hi Rod,

On Saturday 18 June 2011 11:51:11 Rod Boyce wrote:
> Free private_data member element before freeing file structure.  This
> was causing malloc to crash.  Also remove unnecessary variable
> assigments after file structure was free'd.
> 
> Signed-off-by: Rod Boyce <uboot@teamboyce.co.uk>
> ------------------------------- fs/ubifs/ubifs.c
> ------------------------------
> diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
> index 5a5c739..61f70b2 100644
> --- a/fs/ubifs/ubifs.c
> +++ b/fs/ubifs/ubifs.c
> @@ -360,6 +360,8 @@
>           return err;
>       }
> 
> +    if (file->private_data)
> +        kfree(file->private_data);
>       if (file)
>           free(file);
>       if (dentry)
> @@ -367,10 +369,6 @@
>       if (dir)
>           free(dir);
> 
> -    if (file->private_data)
> -        kfree(file->private_data);
> -    file->private_data = NULL;
> -    file->f_pos = 2;
>       return 0;

This patch does not apply:

Applying: For bug in UBIFS function ubifs_finddir
Using index info to reconstruct a base tree...
error: patch failed: fs/ubifs/ubifs.c:360
error: fs/ubifs/ubifs.c: patch does not apply
Did you hand edit your patch?

How did you create this patch? I recommend to use "git format-patch". And send 
it via "git send-email".

Also, please change the patch subject and add "ubifs:":

- For  bug in UBIFS function ubifs_finddir
+ ubifs: Fix bug in function ubifs_finddir

Please also take a look at this page for patch submission:

http://www.denx.de/wiki/view/U-Boot/Patches

Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de
Detlev Zundel June 29, 2011, 11:35 a.m. UTC | #2
Hi Rod,

> Free private_data member element before freeing file structure.  This
> was causing malloc to crash.  Also remove unnecessary variable
> assigments after file structure was free'd.
>
> Signed-off-by: Rod Boyce <uboot@teamboyce.co.uk>
> ------------------------------- fs/ubifs/ubifs.c 
> ------------------------------
> diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
> index 5a5c739..61f70b2 100644
> --- a/fs/ubifs/ubifs.c
> +++ b/fs/ubifs/ubifs.c
> @@ -360,6 +360,8 @@
>           return err;
>       }
>
> +    if (file->private_data)
> +        kfree(file->private_data);
>       if (file)
>           free(file);
>       if (dentry)
> @@ -367,10 +369,6 @@
>       if (dir)
>           free(dir);
>
> -    if (file->private_data)
> -        kfree(file->private_data);
> -    file->private_data = NULL;
> -    file->f_pos = 2;
>       return 0;
>   }

Actually the patch looks good - though I cannot apply the patch easily:

[dzu@pollux u-boot-testing (master)]$ git am -3 ~/transfer/p1
Applying: For bug in UBIFS function ubifs_finddir
Using index info to reconstruct a base tree...
error: patch failed: fs/ubifs/ubifs.c:360
error: fs/ubifs/ubifs.c: patch does not apply
Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Cannot fall back to three-way merge.
Patch failed at 0001 For bug in UBIFS function ubifs_finddir
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

Can you please resend the patch in a way that makes it possible to apply
to current master?  And if you do that, please change the subject line
to something more expressive.

Thanks
  Detlev
Detlev Zundel June 29, 2011, 11:42 a.m. UTC | #3
Hi Stefan,

[...]

> This patch does not apply:
>
> Applying: For bug in UBIFS function ubifs_finddir
> Using index info to reconstruct a base tree...
> error: patch failed: fs/ubifs/ubifs.c:360
> error: fs/ubifs/ubifs.c: patch does not apply
> Did you hand edit your patch?
>
> How did you create this patch? I recommend to use "git format-patch". And send 
> it via "git send-email".
>
> Also, please change the patch subject and add "ubifs:":
>
> - For  bug in UBIFS function ubifs_finddir
> + ubifs: Fix bug in function ubifs_finddir
>
> Please also take a look at this page for patch submission:
>
> http://www.denx.de/wiki/view/U-Boot/Patches
>
> Thanks.

Sorry for my duplication, I just saw that you beat me with your answer
;)

Cheers
  Detlev
Wolfgang Denk July 25, 2011, 9:57 p.m. UTC | #4
Dear Rod Boyce,

In message <4DFC750F.7050605@teamboyce.co.uk> you wrote:
> 
> Free private_data member element before freeing file structure.  This
> was causing malloc to crash.  Also remove unnecessary variable
> assigments after file structure was free'd.
> 
> Signed-off-by: Rod Boyce <uboot@teamboyce.co.uk>

Changes have been requested for your patch.

Do you think you will find time to submit a fixed version any time
soon?

Thanks in advance.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index 5a5c739..61f70b2 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -360,6 +360,8 @@ 
          return err;
      }

+    if (file->private_data)
+        kfree(file->private_data);
      if (file)
          free(file);
      if (dentry)
@@ -367,10 +369,6 @@ 
      if (dir)
          free(dir);

-    if (file->private_data)
-        kfree(file->private_data);
-    file->private_data = NULL;
-    file->f_pos = 2;
      return 0;
  }