Skip to content

Commit 1177dcc

Browse files
committed
Merge tag 'modules-6.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux
Pull module fix from Luis Chamberlain: "Only one fix has trickled through. Harshit Mogalapalli found a use-after-free bug through static analysis with smatch" * tag 'modules-6.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux: module: Fix use-after-free bug in read_file_mod_stats()
2 parents 421ca22 + d36f6ef commit 1177dcc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

kernel/module/stats.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ static ssize_t read_file_mod_stats(struct file *file, char __user *user_buf,
276276
struct mod_fail_load *mod_fail;
277277
unsigned int len, size, count_failed = 0;
278278
char *buf;
279+
int ret;
279280
u32 live_mod_count, fkreads, fdecompress, fbecoming, floads;
280281
unsigned long total_size, text_size, ikread_bytes, ibecoming_bytes,
281282
idecompress_bytes, imod_bytes, total_virtual_lost;
@@ -390,8 +391,9 @@ static ssize_t read_file_mod_stats(struct file *file, char __user *user_buf,
390391
out_unlock:
391392
mutex_unlock(&module_mutex);
392393
out:
394+
ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
393395
kfree(buf);
394-
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
396+
return ret;
395397
}
396398
#undef MAX_PREAMBLE
397399
#undef MAX_FAILED_MOD_PRINT

0 commit comments

Comments
 (0)