X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt-events.c;h=3532dee5a1c8d46e246fa14c8e6c07a1257f26c7;hb=refs%2Ftags%2Fv2.0-pre1;hp=e9e076d802238bc07e1aef14e0bb4f1e2914df6b;hpb=a864fb02d6918ad014596afef779c964e061c127;p=lttng-modules.git diff --git a/ltt-events.c b/ltt-events.c index e9e076d8..3532dee5 100644 --- a/ltt-events.c +++ b/ltt-events.c @@ -196,7 +196,7 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session, unsigned int read_timer_interval) { struct ltt_channel *chan; - struct ltt_transport *transport; + struct ltt_transport *transport = NULL; mutex_lock(&sessions_mutex); if (session->been_active) @@ -207,6 +207,10 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session, transport_name); goto notransport; } + if (!try_module_get(transport->owner)) { + printk(KERN_WARNING "LTT : Can't lock transport module.\n"); + goto notransport; + } chan = kzalloc(sizeof(struct ltt_channel), GFP_KERNEL); if (!chan) goto nomem; @@ -224,6 +228,7 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session, goto create_error; chan->enabled = 1; chan->ops = &transport->ops; + chan->transport = transport; list_add(&chan->list, &session->chan); mutex_unlock(&sessions_mutex); return chan; @@ -231,6 +236,8 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session, create_error: kfree(chan); nomem: + if (transport) + module_put(transport->owner); notransport: active: mutex_unlock(&sessions_mutex); @@ -244,6 +251,7 @@ static void _ltt_channel_destroy(struct ltt_channel *chan) { chan->ops->channel_destroy(chan->chan); + module_put(chan->transport->owner); list_del(&chan->list); lttng_destroy_context(chan->ctx); kfree(chan);