Commit 19d28668 authored by Jialin Zhang's avatar Jialin Zhang
Browse files

Revert "modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules"

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I95JOC



--------------------------------

This reverts commit c51cbcde.

Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parent 1ac2d747
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -2289,26 +2289,15 @@ static void free_module(struct module *mod)
void *__symbol_get(const char *symbol)
{
	struct module *owner;
	enum mod_license license;
	const struct kernel_symbol *sym;

	preempt_disable();
	sym = find_symbol(symbol, &owner, NULL, &license, true, true);
	if (!sym)
		goto fail;
	if (license != GPL_ONLY) {
		pr_warn("failing symbol_get of non-GPLONLY symbol %s.\n",
			symbol);
		goto fail;
	}
	if (strong_try_module_get(owner))
	sym = find_symbol(symbol, &owner, NULL, NULL, true, true);
	if (sym && strong_try_module_get(owner))
		sym = NULL;
	preempt_enable();

	return sym ? (void *)kernel_symbol_value(sym) : NULL;
fail:
	preempt_enable();
	return NULL;
}
EXPORT_SYMBOL_GPL(__symbol_get);