kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exfat: Fix pontential use after free in exfat_load_upcase_table()
@ 2020-06-08 14:16 ` Dan Carpenter
  2020-06-09  0:37   ` Namjae Jeon
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-06-08 14:16 UTC (permalink / raw)
  To: Namjae Jeon, Tetsuhiro Kohada
  Cc: Sungjong Seo, linux-fsdevel, linux-kernel, kernel-janitors

This code calls brelse(bh) and then dereferences "bh" on the next line
resulting in a possible use after free.  The brelse() should just be
moved down a line.

Fixes: b676fdbcf4c8 ("exfat: standardize checksum calculation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/exfat/nls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/exfat/nls.c b/fs/exfat/nls.c
index c1ec056954974..57b5a7a4d1f7a 100644
--- a/fs/exfat/nls.c
+++ b/fs/exfat/nls.c
@@ -692,8 +692,8 @@ static int exfat_load_upcase_table(struct super_block *sb,
 				index++;
 			}
 		}
-		brelse(bh);
 		chksum = exfat_calc_chksum32(bh->b_data, i, chksum, CS_DEFAULT);
+		brelse(bh);
 	}
 
 	if (index >= 0xFFFF && utbl_checksum = chksum)
-- 
2.26.2

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

* RE: [PATCH] exfat: Fix pontential use after free in exfat_load_upcase_table()
  2020-06-08 14:16 ` [PATCH] exfat: Fix pontential use after free in exfat_load_upcase_table() Dan Carpenter
@ 2020-06-09  0:37   ` Namjae Jeon
  0 siblings, 0 replies; 2+ messages in thread
From: Namjae Jeon @ 2020-06-09  0:37 UTC (permalink / raw)
  To: 'Dan Carpenter'
  Cc: 'Sungjong Seo',
	linux-fsdevel, linux-kernel, kernel-janitors,
	'Tetsuhiro Kohada'

> This code calls brelse(bh) and then dereferences "bh" on the next line resulting in a possible use
> after free.  The brelse() should just be moved down a line.
> 
> Fixes: b676fdbcf4c8 ("exfat: standardize checksum calculation")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied. Thanks!
> ---
>  fs/exfat/nls.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/exfat/nls.c b/fs/exfat/nls.c index c1ec056954974..57b5a7a4d1f7a 100644
> --- a/fs/exfat/nls.c
> +++ b/fs/exfat/nls.c
> @@ -692,8 +692,8 @@ static int exfat_load_upcase_table(struct super_block *sb,
>  				index++;
>  			}
>  		}
> -		brelse(bh);
>  		chksum = exfat_calc_chksum32(bh->b_data, i, chksum, CS_DEFAULT);
> +		brelse(bh);
>  	}
> 
>  	if (index >= 0xFFFF && utbl_checksum = chksum)
> --
> 2.26.2

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

end of thread, other threads:[~2020-06-09  0:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200608141649epcas1p14558f3552afb0fcd3cd32a8c09afb880@epcas1p1.samsung.com>
2020-06-08 14:16 ` [PATCH] exfat: Fix pontential use after free in exfat_load_upcase_table() Dan Carpenter
2020-06-09  0:37   ` Namjae Jeon

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).