kmodloader: fix TOCTOU problem with scan_builtin_modules
authorChristian Marangi <ansuelsmth@gmail.com>
Mon, 22 Jan 2024 00:13:11 +0000 (01:13 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Mon, 22 Jan 2024 00:20:57 +0000 (01:20 +0100)
commit6cf7d837ee7e392ee047aee4f45132f4176b7493
tree9d21d106318117243adebf49b03bbad2c3995df3
parent202d7c05029a43f5665cd81355d8abdfdec2bb2d
kmodloader: fix TOCTOU problem with scan_builtin_modules

Fix TOCTOU problem with scan_builtin_modules by opening the file pointer
only once in module_folders scan.

Fix Coverity Report CID 1586645:  Security best practices violations
(TOCTOU).

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
kmodloader.c