* [PATCH] ext4: Fix check for block being out of directory size
@ 2022-08-22 11:48 Jan Kara
2022-08-23 10:00 ` Lukas Czerner
2022-09-29 14:58 ` Theodore Ts'o
0 siblings, 2 replies; 4+ messages in thread
From: Jan Kara @ 2022-08-22 11:48 UTC (permalink / raw)
To: Ted Tso; +Cc: linux-ext4, Lukas Czerner, Salvatore Bonaccorso, Jan Kara, stable
The check in __ext4_read_dirblock() for block being outside of directory
size was wrong because it compared block number against directory size
in bytes. Fix it.
Fixes: 65f8ea4cd57d ("ext4: check if directory block is within i_size")
CVE: CVE-2022-1184
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 3a31b662f661..bc2e0612ec32 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -126,7 +126,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
struct ext4_dir_entry *dirent;
int is_dx_block = 0;
- if (block >= inode->i_size) {
+ if (block >= inode->i_size >> inode->i_blkbits) {
ext4_error_inode(inode, func, line, block,
"Attempting to read directory block (%u) that is past i_size (%llu)",
block, inode->i_size);
--
2.35.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Fix check for block being out of directory size
2022-08-22 11:48 [PATCH] ext4: Fix check for block being out of directory size Jan Kara
@ 2022-08-23 10:00 ` Lukas Czerner
2022-08-31 19:31 ` Salvatore Bonaccorso
2022-09-29 14:58 ` Theodore Ts'o
1 sibling, 1 reply; 4+ messages in thread
From: Lukas Czerner @ 2022-08-23 10:00 UTC (permalink / raw)
To: Jan Kara; +Cc: Ted Tso, linux-ext4, Salvatore Bonaccorso, stable
On Mon, Aug 22, 2022 at 01:48:32PM +0200, Jan Kara wrote:
> The check in __ext4_read_dirblock() for block being outside of directory
> size was wrong because it compared block number against directory size
> in bytes. Fix it.
Good catch, thanks!
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
>
> Fixes: 65f8ea4cd57d ("ext4: check if directory block is within i_size")
> CVE: CVE-2022-1184
> CC: stable@vger.kernel.org
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> fs/ext4/namei.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 3a31b662f661..bc2e0612ec32 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -126,7 +126,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
> struct ext4_dir_entry *dirent;
> int is_dx_block = 0;
>
> - if (block >= inode->i_size) {
> + if (block >= inode->i_size >> inode->i_blkbits) {
> ext4_error_inode(inode, func, line, block,
> "Attempting to read directory block (%u) that is past i_size (%llu)",
> block, inode->i_size);
> --
> 2.35.3
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Fix check for block being out of directory size
2022-08-23 10:00 ` Lukas Czerner
@ 2022-08-31 19:31 ` Salvatore Bonaccorso
0 siblings, 0 replies; 4+ messages in thread
From: Salvatore Bonaccorso @ 2022-08-31 19:31 UTC (permalink / raw)
To: Lukas Czerner; +Cc: Jan Kara, Ted Tso, linux-ext4, stable
Hi,
On Tue, Aug 23, 2022 at 12:00:19PM +0200, Lukas Czerner wrote:
> On Mon, Aug 22, 2022 at 01:48:32PM +0200, Jan Kara wrote:
> > The check in __ext4_read_dirblock() for block being outside of directory
> > size was wrong because it compared block number against directory size
> > in bytes. Fix it.
>
> Good catch, thanks!
>
> Reviewed-by: Lukas Czerner <lczerner@redhat.com>
>
> >
> > Fixes: 65f8ea4cd57d ("ext4: check if directory block is within i_size")
> > CVE: CVE-2022-1184
> > CC: stable@vger.kernel.org
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> > fs/ext4/namei.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> > index 3a31b662f661..bc2e0612ec32 100644
> > --- a/fs/ext4/namei.c
> > +++ b/fs/ext4/namei.c
> > @@ -126,7 +126,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
> > struct ext4_dir_entry *dirent;
> > int is_dx_block = 0;
> >
> > - if (block >= inode->i_size) {
> > + if (block >= inode->i_size >> inode->i_blkbits) {
> > ext4_error_inode(inode, func, line, block,
> > "Attempting to read directory block (%u) that is past i_size (%llu)",
> > block, inode->i_size);
Ted, is this on your radar to get applied for mainline and to the
stable trees?
Regards,
Salvatore
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Fix check for block being out of directory size
2022-08-22 11:48 [PATCH] ext4: Fix check for block being out of directory size Jan Kara
2022-08-23 10:00 ` Lukas Czerner
@ 2022-09-29 14:58 ` Theodore Ts'o
1 sibling, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2022-09-29 14:58 UTC (permalink / raw)
To: jack; +Cc: Theodore Ts'o, carnil, linux-ext4, lczerner, stable
On Mon, 22 Aug 2022 13:48:32 +0200, Jan Kara wrote:
> The check in __ext4_read_dirblock() for block being outside of directory
> size was wrong because it compared block number against directory size
> in bytes. Fix it.
>
>
Applied, thanks!
[1/1] ext4: Fix check for block being out of directory size
commit: 013c07e4705fb994e5e56530af0bc6272884b5c1
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-29 14:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-22 11:48 [PATCH] ext4: Fix check for block being out of directory size Jan Kara
2022-08-23 10:00 ` Lukas Czerner
2022-08-31 19:31 ` Salvatore Bonaccorso
2022-09-29 14:58 ` Theodore Ts'o
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.