lkml.org 
[lkml]   [2014]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv2 2/3] kernel: add support for live patching
On Sun, Nov 16, 2014 at 07:29:23PM -0600, Seth Jennings wrote:
> +static int lpc_module_notify(struct notifier_block *nb, unsigned long action,
> + void *data)
> +{
> + struct module *mod = data;
> + struct lpc_patch *patch;
> + struct lpc_object *obj;
> +
> + mutex_lock(&lpc_mutex);
> +
> + if (action != MODULE_STATE_COMING && action != MODULE_STATE_GOING)
> + goto out;

I think we can get the mutex here instead of above so it doesn't block
other module actions (and then you can also get rid of the "out" label).

> +
> + list_for_each_entry(patch, &lpc_patches, list) {
> + if (patch->state == LPC_DISABLED)
> + continue;
> + list_for_each_entry(obj, &patch->objs, list) {
> + if (strcmp(obj->name, mod->name))
> + continue;
> + if (action == MODULE_STATE_COMING) {
> + obj->mod = mod;
> + lpc_module_notify_coming(patch->mod, obj);
> + } else /* MODULE_STATE_GOING */
> + lpc_module_notify_going(patch->mod, obj);
> + break;
> + }
> + }
> +out:
> + mutex_unlock(&lpc_mutex);
> + return 0;
> +}

--
Josh


\
 
 \ /
  Last update: 2014-11-20 17:01    [W:0.155 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site