Skip to content

Commit

Permalink
lib/test: use after free in register_test_dev_kmod()
Browse files Browse the repository at this point in the history
The "test_dev" pointer is freed but then returned to the caller.

Fixes: d9c6a72 ("kmod: add test driver to stress test the module loader")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Luis Chamberlain <[email protected]>
  • Loading branch information
Dan Carpenter authored and mcgrof committed Mar 29, 2022
1 parent 13776eb commit dc0ce6c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/test_kmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ static struct kmod_test_device *register_test_dev_kmod(void)
if (ret) {
pr_err("could not register misc device: %d\n", ret);
free_test_dev_kmod(test_dev);
test_dev = NULL;
goto out;
}

Expand Down

0 comments on commit dc0ce6c

Please sign in to comment.