lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230411102530.qfgmxh33azztpxz5@quack3>
Date:   Tue, 11 Apr 2023 12:25:30 +0200
From:   Jan Kara <jack@...e.cz>
To:     Guoqing Cai <u202112087@...t.edu.cn>
Cc:     Theodore Ts'o <tytso@....edu>, Jan Kara <jack@...e.com>,
        HUST OS Kernel Contribution 
        <hust-os-kernel-patches@...glegroups.com>,
        Dongliang Mu <dzm91@...t.edu.cn>, linux-ext4@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs: jbd2: fix an incorrect warn log

On Tue 11-04-23 01:20:38, Guoqing Cai wrote:
> In jbd2_journal_load(), when journal_reset fails, it prints an incorrect
> warn log.
> 
> Fix this by changing the goto statement to return statement.
> 
> Signed-off-by: Guoqing Cai <u202112087@...t.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@...t.edu.cn>

...

> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index e80c781731f8..555f09ca1d99 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -2082,8 +2082,10 @@ int jbd2_journal_load(journal_t *journal)
>  
>  	/* Let the recovery code check whether it needs to recover any
>  	 * data from the journal. */
> -	if (jbd2_journal_recover(journal))
> -		goto recovery_error;
> +	if (jbd2_journal_recover(journal)) {
> +		printk(KERN_WARNING "JBD2: recovery failed\n");
> +		return -EIO;
> +	}
>  
>  	if (journal->j_failed_commit) {
>  		printk(KERN_ERR "JBD2: journal transaction %u on %s "
> @@ -2101,14 +2103,10 @@ int jbd2_journal_load(journal_t *journal)
>  	 * reinitialise the dynamic contents of the superblock in memory
>  	 * and reset them on disk. */
>  	if (journal_reset(journal))
> -		goto recovery_error;
> +		return -EIO;

So when you touch this code it would make more sense to actually return the
error returned by journal_reset() - that is most definitely not going to be
EIO but most likely ENOMEM.

								Honza
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ