diff mbox series

[-next] jbd2,ocfs2: fix wrong pointer pass to PTR_ERR()

Message ID 20230822030018.644419-1-yangyingliang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] jbd2,ocfs2: fix wrong pointer pass to PTR_ERR() | expand

Commit Message

Yang Yingliang Aug. 22, 2023, 3 a.m. UTC
Fix wrong pointer pass to PTR_ERR() if jbd2_journal_init_inode() fails.

Fixes: c279913275eb ("jbd2: jbd2_journal_init_{dev,inode} return proper error return value")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 fs/ocfs2/journal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Joseph Qi Aug. 22, 2023, 3:44 a.m. UTC | #1
On 8/22/23 11:00 AM, Yang Yingliang wrote:
> Fix wrong pointer pass to PTR_ERR() if jbd2_journal_init_inode() fails.
> 
> Fixes: c279913275eb ("jbd2: jbd2_journal_init_{dev,inode} return proper error return value")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>  fs/ocfs2/journal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
> index 90af6c47161d..ce215565d061 100644
> --- a/fs/ocfs2/journal.c
> +++ b/fs/ocfs2/journal.c
> @@ -910,7 +910,7 @@ int ocfs2_journal_init(struct ocfs2_super *osb, int *dirty)
>  	j_journal = jbd2_journal_init_inode(inode);
>  	if (IS_ERR(j_journal)) {
>  		mlog(ML_ERROR, "Linux journal layer error\n");
> -		status = PTR_ERR(journal);
> +		status = PTR_ERR(j_journal);
>  		goto done;
>  	}
>
Zhang Yi Aug. 22, 2023, 6:07 a.m. UTC | #2
On 2023/8/22 11:00, Yang Yingliang wrote:
> Fix wrong pointer pass to PTR_ERR() if jbd2_journal_init_inode() fails.
> 
> Fixes: c279913275eb ("jbd2: jbd2_journal_init_{dev,inode} return proper error return value")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Ah, my mistake, thanks for the fix.

Reviewed-by: Zhang Yi <yi.zhang@huawei.com>

> ---
>  fs/ocfs2/journal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
> index 90af6c47161d..ce215565d061 100644
> --- a/fs/ocfs2/journal.c
> +++ b/fs/ocfs2/journal.c
> @@ -910,7 +910,7 @@ int ocfs2_journal_init(struct ocfs2_super *osb, int *dirty)
>  	j_journal = jbd2_journal_init_inode(inode);
>  	if (IS_ERR(j_journal)) {
>  		mlog(ML_ERROR, "Linux journal layer error\n");
> -		status = PTR_ERR(journal);
> +		status = PTR_ERR(j_journal);
>  		goto done;
>  	}
>  
>
Jan Kara Aug. 22, 2023, 9:57 a.m. UTC | #3
On Tue 22-08-23 11:00:18, Yang Yingliang wrote:
> Fix wrong pointer pass to PTR_ERR() if jbd2_journal_init_inode() fails.
> 
> Fixes: c279913275eb ("jbd2: jbd2_journal_init_{dev,inode} return proper error return value")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Oh right, I've missed this during my review. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ocfs2/journal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
> index 90af6c47161d..ce215565d061 100644
> --- a/fs/ocfs2/journal.c
> +++ b/fs/ocfs2/journal.c
> @@ -910,7 +910,7 @@ int ocfs2_journal_init(struct ocfs2_super *osb, int *dirty)
>  	j_journal = jbd2_journal_init_inode(inode);
>  	if (IS_ERR(j_journal)) {
>  		mlog(ML_ERROR, "Linux journal layer error\n");
> -		status = PTR_ERR(journal);
> +		status = PTR_ERR(j_journal);
>  		goto done;
>  	}
>  
> -- 
> 2.25.1
>
Theodore Ts'o Aug. 23, 2023, 4:01 a.m. UTC | #4
Thanks for pointing this out; I've folded your fix into buggy commit
("jbd2: jbd2_journal_init_{dev,inode} return proper error return
value").

						- Ted
diff mbox series

Patch

diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 90af6c47161d..ce215565d061 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -910,7 +910,7 @@  int ocfs2_journal_init(struct ocfs2_super *osb, int *dirty)
 	j_journal = jbd2_journal_init_inode(inode);
 	if (IS_ERR(j_journal)) {
 		mlog(ML_ERROR, "Linux journal layer error\n");
-		status = PTR_ERR(journal);
+		status = PTR_ERR(j_journal);
 		goto done;
 	}