mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 04/11] fs: free inodes we no longer need
Date: Tue, 4 Aug 2020 00:02:37 +0200	[thread overview]
Message-ID: <11fac320-418d-4fc1-249b-59b5008f2839@pengutronix.de> (raw)
In-Reply-To: <20200615060229.7533-5-s.hauer@pengutronix.de>

Hello Sascha,

On 6/15/20 8:02 AM, Sascha Hauer wrote:
> So far we freed the no longer needed inodes only at unmount time.
> Let's trust our reference counting a bit more and free them once
> the reference counter hits zero.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  fs/fs.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/fs.c b/fs/fs.c
> index cecb3d70e0..e04cadfe5d 100644
> --- a/fs/fs.c
> +++ b/fs/fs.c
> @@ -1090,10 +1090,12 @@ void iput(struct inode *inode)
>  	if (!inode)
>  		return;
>  
> -	if (!inode->i_count)
> -		return;
> -
>  	inode->i_count--;
> +
> +	if (!inode->i_count) {
> +		list_del(&inode->i_sb_list);

There is no explicit initialization of i_sb_list anywhere, only
list_add.

Without reverting this patch, I can reproduce null pointer dereference
booting from squashfs as i_sb_list remained uninitialized when this
line is executed.

Can you drop this patch for now?


> +		destroy_inode(inode);
> +	}
>  }
>  
>  struct inode *iget(struct inode *inode)
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-08-03 22:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15  6:02 [PATCH 00/11] ramfs: Use dynamically sized chunks Sascha Hauer
2020-06-15  6:02 ` [PATCH 01/11] update list.h from Linux-5.7 Sascha Hauer
2020-06-15  6:02 ` [PATCH 02/11] fs: Add destroy_inode callbacks to filesystems Sascha Hauer
2020-06-15  6:02 ` [PATCH 03/11] fs: Make iput() accept NULL pointers Sascha Hauer
2020-06-15  6:02 ` [PATCH 04/11] fs: free inodes we no longer need Sascha Hauer
2020-08-03 22:02   ` Ahmad Fatoum [this message]
2020-08-10 11:13     ` Sascha Hauer
2020-06-15  6:02 ` [PATCH 05/11] digest: Drop usage of memmap Sascha Hauer
2020-06-15  6:02 ` [PATCH 06/11] fs: ramfs: Return -ENOSPC Sascha Hauer
2020-06-15  6:02 ` [PATCH 07/11] fs: ramfs: Drop dead code Sascha Hauer
2020-06-15  6:02 ` [PATCH 08/11] fs: ramfs: Use dynamically sized chunks Sascha Hauer
2020-07-02 14:28   ` Ahmad Fatoum
2020-07-05 14:14     ` Sascha Hauer
2020-06-15  6:02 ` [PATCH 09/11] fs: ramfs: Implement memmap Sascha Hauer
2020-06-15  6:02 ` [PATCH 10/11] libfile: copy_file: Fix calling discard_range Sascha Hauer
2020-06-15  6:02 ` [PATCH 11/11] libfile: copy_file: explicitly truncate to final size Sascha Hauer

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=11fac320-418d-4fc1-249b-59b5008f2839@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.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