All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/ntfs3: unlock on error in attr_insert_range()
@ 2022-06-30 13:10 Dan Carpenter
  2022-07-05 13:31 ` Konstantin Komarov
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-06-30 13:10 UTC (permalink / raw)
  To: Konstantin Komarov; +Cc: ntfs3, kernel-janitors

This error path needs to call up_write(&ni->file.run_lock) and do some
other clean up before returning.

Fixes: aa30eccb24e5 ("fs/ntfs3: Fallocate (FALLOC_FL_INSERT_RANGE) implementation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This patch is based on static analysis.  I'm pretty sure that unlocking
is the correct thing and, of course, I try to not send patches that
introduce bugs.  But it's untested and needs to be reviewed extra
carefully.

 fs/ntfs3/attrib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
index 86e688b95ad5..3e9aefcb3e6c 100644
--- a/fs/ntfs3/attrib.c
+++ b/fs/ntfs3/attrib.c
@@ -2153,8 +2153,10 @@ int attr_insert_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
 		le_b = NULL;
 		attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL, 0, NULL,
 				      &mi_b);
-		if (!attr_b)
-			return -ENOENT;
+		if (!attr_b) {
+			err = -ENOENT;
+			goto out;
+		}
 		if (!attr_b->non_res) {
 			err = -EINVAL;
 			goto out;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs/ntfs3: unlock on error in attr_insert_range()
  2022-06-30 13:10 [PATCH] fs/ntfs3: unlock on error in attr_insert_range() Dan Carpenter
@ 2022-07-05 13:31 ` Konstantin Komarov
  0 siblings, 0 replies; 2+ messages in thread
From: Konstantin Komarov @ 2022-07-05 13:31 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: ntfs3, kernel-janitors

On 6/30/22 16:10, Dan Carpenter wrote:
> This error path needs to call up_write(&ni->file.run_lock) and do some
> other clean up before returning.
> 
> Fixes: aa30eccb24e5 ("fs/ntfs3: Fallocate (FALLOC_FL_INSERT_RANGE) implementation")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This patch is based on static analysis.  I'm pretty sure that unlocking
> is the correct thing and, of course, I try to not send patches that
> introduce bugs.  But it's untested and needs to be reviewed extra
> carefully.
> 
>   fs/ntfs3/attrib.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
> index 86e688b95ad5..3e9aefcb3e6c 100644
> --- a/fs/ntfs3/attrib.c
> +++ b/fs/ntfs3/attrib.c
> @@ -2153,8 +2153,10 @@ int attr_insert_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
>   		le_b = NULL;
>   		attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL, 0, NULL,
>   				      &mi_b);
> -		if (!attr_b)
> -			return -ENOENT;
> +		if (!attr_b) {
> +			err = -ENOENT;
> +			goto out;
> +		}
>   		if (!attr_b->non_res) {
>   			err = -EINVAL;
>   			goto out;

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-05 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30 13:10 [PATCH] fs/ntfs3: unlock on error in attr_insert_range() Dan Carpenter
2022-07-05 13:31 ` Konstantin Komarov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.