* [PATCH] [v2] ext4: Fix error handling code in add_new_gdb
@ 2020-08-29 2:54 Dinghao Liu
2020-08-29 7:21 ` Andreas Dilger
2020-10-03 4:15 ` Theodore Y. Ts'o
0 siblings, 2 replies; 3+ messages in thread
From: Dinghao Liu @ 2020-08-29 2:54 UTC (permalink / raw)
To: dinghao.liu, kjlu
Cc: Theodore Ts'o, Andreas Dilger, linux-ext4, linux-kernel
When ext4_journal_get_write_access() fails, we should
terminate the execution flow and release n_group_desc,
iloc.bh, dind and gdb_bh.
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
Changelog:
v2: - Remove changes to ext4_handle_dirty_super()'s
error handling path.
---
fs/ext4/resize.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index a50b51270ea9..71bf600e5b42 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -843,8 +843,10 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
BUFFER_TRACE(dind, "get_write_access");
err = ext4_journal_get_write_access(handle, dind);
- if (unlikely(err))
+ if (unlikely(err)) {
ext4_std_error(sb, err);
+ goto errout;
+ }
/* ext4_reserve_inode_write() gets a reference on the iloc */
err = ext4_reserve_inode_write(handle, inode, &iloc);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [v2] ext4: Fix error handling code in add_new_gdb
2020-08-29 2:54 [PATCH] [v2] ext4: Fix error handling code in add_new_gdb Dinghao Liu
@ 2020-08-29 7:21 ` Andreas Dilger
2020-10-03 4:15 ` Theodore Y. Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Dilger @ 2020-08-29 7:21 UTC (permalink / raw)
To: Dinghao Liu
Cc: kjlu, Theodore Ts'o, Ext4 Developers List, Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]
On Aug 28, 2020, at 8:54 PM, Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
>
> When ext4_journal_get_write_access() fails, we should
> terminate the execution flow and release n_group_desc,
> iloc.bh, dind and gdb_bh.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Looks good. I also reviewed the other error conditions in this function
and didn't see any similar problems.
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
> ---
>
> Changelog:
>
> v2: - Remove changes to ext4_handle_dirty_super()'s
> error handling path.
> ---
> fs/ext4/resize.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
> index a50b51270ea9..71bf600e5b42 100644
> --- a/fs/ext4/resize.c
> +++ b/fs/ext4/resize.c
> @@ -843,8 +843,10 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
>
> BUFFER_TRACE(dind, "get_write_access");
> err = ext4_journal_get_write_access(handle, dind);
> - if (unlikely(err))
> + if (unlikely(err)) {
> ext4_std_error(sb, err);
> + goto errout;
> + }
>
> /* ext4_reserve_inode_write() gets a reference on the iloc */
> err = ext4_reserve_inode_write(handle, inode, &iloc);
> --
> 2.17.1
>
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [v2] ext4: Fix error handling code in add_new_gdb
2020-08-29 2:54 [PATCH] [v2] ext4: Fix error handling code in add_new_gdb Dinghao Liu
2020-08-29 7:21 ` Andreas Dilger
@ 2020-10-03 4:15 ` Theodore Y. Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Theodore Y. Ts'o @ 2020-10-03 4:15 UTC (permalink / raw)
To: Dinghao Liu; +Cc: kjlu, Andreas Dilger, linux-ext4, linux-kernel
On Sat, Aug 29, 2020 at 10:54:02AM +0800, Dinghao Liu wrote:
> When ext4_journal_get_write_access() fails, we should
> terminate the execution flow and release n_group_desc,
> iloc.bh, dind and gdb_bh.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-03 4:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-29 2:54 [PATCH] [v2] ext4: Fix error handling code in add_new_gdb Dinghao Liu
2020-08-29 7:21 ` Andreas Dilger
2020-10-03 4:15 ` Theodore Y. Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).