[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220829000920.38185-3-isabbasso@riseup.net>
Date: Sun, 28 Aug 2022 21:09:18 -0300
From: Isabella Basso <isabbasso@...eup.net>
To: igt-dev@...ts.freedesktop.org
Cc: magalilemes00@...il.com, maira.canal@....br,
tales.aparecida@...il.com, rodrigo.siqueira@....com,
mwen@...lia.com, andrealmeid@...eup.net, twoerner@...il.com,
leandro.ribeiro@...labora.com, n@...aprado.net,
kunit-dev@...glegroups.com, davidgow@...gle.com,
dlatypov@...gle.com, brendanhiggins@...gle.com, daniel@...ll.ch,
skhan@...uxfoundation.org, linux-kselftest@...r.kernel.org,
dri-devel@...ts.freedesktop.org, daniel@...ishbar.org,
linux-kernel@...r.kernel.org, Isabella Basso <isabbasso@...eup.net>
Subject: [PATCH i-g-t v2 2/4] lib/igt_kmod.c: check if module is builtin before attempting to unload it
This change makes `igt_module_unload_r` safer as it checks whether the
module can be unloaded before attempting it.
Signed-off-by: Isabella Basso <isabbasso@...eup.net>
---
lib/igt_kmod.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index bb6cb7bb..97cac7f5 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -256,6 +256,9 @@ static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags)
struct kmod_list *holders, *pos;
int err = 0;
+ if (kmod_module_get_initstate(kmod) == KMOD_MODULE_BUILTIN)
+ return err;
+
holders = kmod_module_get_holders(kmod);
kmod_list_foreach(pos, holders) {
struct kmod_module *it = kmod_module_get_module(pos);
--
2.37.2
Powered by blists - more mailing lists