From eef5c756ed0bd58c36e52d19b7cd6edf0d7ca7e9 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 9 Jun 2020 08:44:16 +0900 Subject: [PATCH] exfat: Fix pontential use after free in exfat_load_upcase_table() 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 Signed-off-by: Namjae Jeon --- nls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nls.c b/nls.c index c1ec05695497..57b5a7a4d1f7 100644 --- a/nls.c +++ b/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)