Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ac6727e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Revert "once: Fix panic when module unload"



This reverts commit 57bd5b59 which is
commit 1027b96ec9d34f9abab69bc1a4dc5b1ad8ab1349 upstream.

The function __do_once_done() added a new parameter to handle the
problem when unloading modules with that function in it.  Android does
not support module unloading so just revert this as it breaks the kabi.

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
Change-Id: I4d5279c00c64f2f1836837c13c27cea5ed3ea073
parent 2e0ca55e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@

bool __do_once_start(bool *done, unsigned long *flags);
void __do_once_done(bool *done, struct static_key_true *once_key,
		    unsigned long *flags, struct module *mod);
		    unsigned long *flags);

/* Call a function exactly once. The idea of DO_ONCE() is to perform
 * a function call such as initialization of random seeds, etc, only
@@ -46,7 +46,7 @@ void __do_once_done(bool *done, struct static_key_true *once_key,
			if (unlikely(___ret)) {				     \
				func(__VA_ARGS__);			     \
				__do_once_done(&___done, &___once_key,	     \
					       &___flags, THIS_MODULE);	     \
					       &___flags);		     \
			}						     \
		}							     \
		___ret;							     \
+3 −8
Original line number Diff line number Diff line
@@ -3,12 +3,10 @@
#include <linux/spinlock.h>
#include <linux/once.h>
#include <linux/random.h>
#include <linux/module.h>

struct once_work {
	struct work_struct work;
	struct static_key_true *key;
	struct module *module;
};

static void once_deferred(struct work_struct *w)
@@ -18,11 +16,10 @@ static void once_deferred(struct work_struct *w)
	work = container_of(w, struct once_work, work);
	BUG_ON(!static_key_enabled(work->key));
	static_branch_disable(work->key);
	module_put(work->module);
	kfree(work);
}

static void once_disable_jump(struct static_key_true *key, struct module *mod)
static void once_disable_jump(struct static_key_true *key)
{
	struct once_work *w;

@@ -32,8 +29,6 @@ static void once_disable_jump(struct static_key_true *key, struct module *mod)

	INIT_WORK(&w->work, once_deferred);
	w->key = key;
	w->module = mod;
	__module_get(mod);
	schedule_work(&w->work);
}

@@ -58,11 +53,11 @@ bool __do_once_start(bool *done, unsigned long *flags)
EXPORT_SYMBOL(__do_once_start);

void __do_once_done(bool *done, struct static_key_true *once_key,
		    unsigned long *flags, struct module *mod)
		    unsigned long *flags)
	__releases(once_lock)
{
	*done = true;
	spin_unlock_irqrestore(&once_lock, *flags);
	once_disable_jump(once_key, mod);
	once_disable_jump(once_key);
}
EXPORT_SYMBOL(__do_once_done);