public inbox for ntfs3@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] fs/ntfs3: delete duplicate condition in ntfs_read_mft()
@ 2022-10-15  8:28 Dan Carpenter
  2022-11-12 18:24 ` Konstantin Komarov
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-10-15  8:28 UTC (permalink / raw)
  To: Konstantin Komarov; +Cc: ntfs3, Edward Lo, Hawkins Jiawei, kernel-janitors

There were two patches which addressed the same bug and added the same
condition:

commit 6db620863f85 ("fs/ntfs3: Validate data run offset")
commit 887bfc546097 ("fs/ntfs3: Fix slab-out-of-bounds read in run_unpack")

Delete one condition.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I deleted this one because it was further away from the "roff = "
assignement.

 fs/ntfs3/inode.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index a31474d697e0..e6143da5b4d6 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -374,12 +374,6 @@ static struct inode *ntfs_read_mft(struct inode *inode,
 
 	t64 = le64_to_cpu(attr->nres.svcn);
 
-	/* offset to packed runs is out-of-bounds */
-	if (roff > asize) {
-		err = -EINVAL;
-		goto out;
-	}
-
 	err = run_unpack_ex(run, sbi, ino, t64, le64_to_cpu(attr->nres.evcn),
 			    t64, Add2Ptr(attr, roff), asize - roff);
 	if (err < 0)
-- 
2.35.1


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

* Re: [PATCH] fs/ntfs3: delete duplicate condition in ntfs_read_mft()
  2022-10-15  8:28 [PATCH] fs/ntfs3: delete duplicate condition in ntfs_read_mft() Dan Carpenter
@ 2022-11-12 18:24 ` Konstantin Komarov
  0 siblings, 0 replies; 2+ messages in thread
From: Konstantin Komarov @ 2022-11-12 18:24 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: ntfs3, Edward Lo, Hawkins Jiawei, kernel-janitors



On 10/15/22 11:28, Dan Carpenter wrote:
> There were two patches which addressed the same bug and added the same
> condition:
> 
> commit 6db620863f85 ("fs/ntfs3: Validate data run offset")
> commit 887bfc546097 ("fs/ntfs3: Fix slab-out-of-bounds read in run_unpack")
> 
> Delete one condition.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I deleted this one because it was further away from the "roff = "
> assignement.
> 
>   fs/ntfs3/inode.c | 6 ------
>   1 file changed, 6 deletions(-)
> 
> diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
> index a31474d697e0..e6143da5b4d6 100644
> --- a/fs/ntfs3/inode.c
> +++ b/fs/ntfs3/inode.c
> @@ -374,12 +374,6 @@ static struct inode *ntfs_read_mft(struct inode *inode,
>   
>   	t64 = le64_to_cpu(attr->nres.svcn);
>   
> -	/* offset to packed runs is out-of-bounds */
> -	if (roff > asize) {
> -		err = -EINVAL;
> -		goto out;
> -	}
> -
>   	err = run_unpack_ex(run, sbi, ino, t64, le64_to_cpu(attr->nres.evcn),
>   			    t64, Add2Ptr(attr, roff), asize - roff);
>   	if (err < 0)

I missed this situation when applying patches.
Thanks for catching this.

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

end of thread, other threads:[~2022-11-12 18:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-15  8:28 [PATCH] fs/ntfs3: delete duplicate condition in ntfs_read_mft() Dan Carpenter
2022-11-12 18:24 ` Konstantin Komarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox