From: Alexander Dahl <ada@thorsis.com>
To: Michael Trimarchi <michael@amarulasolutions.com>
Cc: Heiko Schocher <hs@denx.de>,
u-boot@lists.denx.de, Tom Rini <trini@konsulko.com>,
Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>,
Marek Vasut <marek.vasut+renesas@mailbox.org>
Subject: Re: [RFC PATCH] ubifs: Call ubifs_iput when ubifs_iget is used
Date: Wed, 7 Aug 2024 16:55:45 +0200 [thread overview]
Message-ID: <20240807-pancake-estimate-ea370d7f9dc8@thorsis.com> (raw)
In-Reply-To: <20240805173140.84453-1-michael@amarulasolutions.com>
Hello Michael,
Am Mon, Aug 05, 2024 at 07:31:40PM +0200 schrieb Michael Trimarchi:
> The inode should be freed after a reference is get to avoid
> memory leak
>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Tested this on top of my recent ubifs series. No obvious problems
found on U-Boot command line with various combinations of commands,
no crashes, so …
Tested-by: Alexander Dahl <ada@thorsis.com>
Greets
Alex
> ---
> fs/ubifs/ubifs.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
> index 048730db7f..6acd6c3776 100644
> --- a/fs/ubifs/ubifs.c
> +++ b/fs/ubifs/ubifs.c
> @@ -319,9 +319,7 @@ static int filldir(struct ubifs_info *c, const char *name, int namlen,
> }
> ctime_r((time_t *)&inode->i_mtime, filetime);
> printf("%9lld %24.24s ", inode->i_size, filetime);
> -#ifndef __UBOOT__
> ubifs_iput(inode);
> -#endif
>
> printf("%s\n", name);
>
> @@ -557,6 +555,7 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
>
> /* We have some sort of symlink recursion, bail out */
> if (symlink_count++ > 8) {
> + ubifs_iput(inode);
> printf("Symlink recursion, aborting\n");
> return 0;
> }
> @@ -568,6 +567,7 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
> * the leading slash */
> next = name = link_name + 1;
> root_inum = 1;
> + ubifs_iput(inode);
> continue;
> }
> /* Relative to cur dir */
> @@ -575,6 +575,7 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
> link_name, next == NULL ? "" : next);
> memcpy(symlinkpath, buf, sizeof(buf));
> next = name = symlinkpath;
> + ubifs_iput(inode);
> continue;
> }
>
> @@ -583,8 +584,10 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
> */
>
> /* Found the node! */
> - if (!next || *next == '\0')
> + if (!next || *next == '\0') {
> + ubifs_iput(inode);
> return inum;
> + }
>
> root_inum = inum;
> name = next;
> --
> 2.43.0
>
next prev parent reply other threads:[~2024-08-07 14:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 17:31 [RFC PATCH] ubifs: Call ubifs_iput when ubifs_iget is used Michael Trimarchi
2024-08-06 4:28 ` Heiko Schocher
2024-08-06 7:13 ` Michael Nazzareno Trimarchi
2024-08-07 14:55 ` Alexander Dahl [this message]
2024-08-07 14:57 ` Michael Nazzareno Trimarchi
2024-08-07 15:14 ` Heiko Schocher
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=20240807-pancake-estimate-ea370d7f9dc8@thorsis.com \
--to=ada@thorsis.com \
--cc=hs@denx.de \
--cc=marek.vasut+renesas@mailbox.org \
--cc=michael@amarulasolutions.com \
--cc=piotr.wojtaszczyk@timesys.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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