diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-05-22 15:35:53 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-05-22 15:35:53 -0700 |
commit | 1177dcc9637661e05c18aa019a49821bcd6b3dc1 (patch) | |
tree | 4ae1cb87553caebf28617e4e1240ab21650b8956 | |
parent | 421ca22e313871d4104617bab077b275b30950ae (diff) | |
parent | d36f6efbe0cb422fe1e4475717d75f3737088832 (diff) | |
download | linux-1177dcc9637661e05c18aa019a49821bcd6b3dc1.tar.gz |
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()
-rw-r--r-- | kernel/module/stats.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/module/stats.c b/kernel/module/stats.c index ad7b6ada29f2f..6ab2c94d6bc32 100644 --- a/kernel/module/stats.c +++ b/kernel/module/stats.c @@ -276,6 +276,7 @@ static ssize_t read_file_mod_stats(struct file *file, char __user *user_buf, struct mod_fail_load *mod_fail; unsigned int len, size, count_failed = 0; char *buf; + int ret; u32 live_mod_count, fkreads, fdecompress, fbecoming, floads; unsigned long total_size, text_size, ikread_bytes, ibecoming_bytes, 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, out_unlock: mutex_unlock(&module_mutex); out: + ret = simple_read_from_buffer(user_buf, count, ppos, buf, len); kfree(buf); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); + return ret; } #undef MAX_PREAMBLE #undef MAX_FAILED_MOD_PRINT |