netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Gerst <brgerst@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: aijazbaig1@gmail.com, netfilter-devel@vger.kernel.org,
	jengelh@medozas.de, linux-kernel@vger.kernel.org
Subject: Re: help needed with EXPORT_SYMBOL
Date: Mon, 23 Aug 2010 09:44:26 -0400	[thread overview]
Message-ID: <AANLkTinq5APN4CXWAGj9sTFiTf4Cn1_mDaJSrAOh=t+N@mail.gmail.com> (raw)
In-Reply-To: <1282569477.2605.1798.camel@laptop>

On Mon, Aug 23, 2010 at 9:17 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Mon, 2010-08-23 at 07:48 -0400, Brian Gerst wrote:
>>
>> Use an exported function pointer in the main kernel as a hook that the
>> module sets when it is loaded.  Note, you must use module_get and
>> module_put around the call to the module to prevent it from unloading
>> while in use.
>
> Please don't do any such thing, its impossible to use correctly.
>
> Suppose there are two modular users, A and B.
>
> Both have something like:
>
> extern void (*fptr)(void);
>
> static void (*old_fptr)(void);
>
> static void func(void)
> {
>        /* foo */
>        if (old_fptr)
>                old_fptr();
> }
>
> module_init()
> {
>        old_fptr = fptr;
>        fptr = A_func;
> }
>
> Then you load A, load B and unload A, then guess what happens?
>

The assumption was that there was a single module using that hook.
For multiple users you'd need to use a register function that adds the
module to a linked list.

--
Brian Gerst
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2010-08-23 13:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-21  6:57 help needed with EXPORT_SYMBOL Aijaz Baig
2010-08-21  9:23 ` Jan Engelhardt
2010-08-23  5:14 ` Aijaz Baig
2010-08-23 11:48   ` Brian Gerst
2010-08-23 13:17     ` Peter Zijlstra
2010-08-23 13:32       ` Jan Engelhardt
2010-08-23 13:43         ` Peter Zijlstra
2010-08-23 13:44       ` Brian Gerst [this message]
2010-08-23 14:05         ` Peter Zijlstra
     [not found]           ` <AANLkTimQDV74kcM_84QySMKmdf-XxFOhqp48cQdQNN4s@mail.gmail.com>
     [not found]             ` <AANLkTinRyoHcSmmHv9tZ36X4wxVVCKGLDwGiZUTPPn+z@mail.gmail.com>
2010-08-24  4:44               ` Aijaz Baig
     [not found]                 ` <AANLkTi=cj+qCFxeT5hq0-x-XqSUCbcqQRAwmQ9h+cOxy@mail.gmail.com>
     [not found]                   ` <AANLkTim9nvJR0K6xJc2kHGCeoMzFLzSxR8Avx59jsEbf@mail.gmail.com>
2010-08-25  9:27                     ` Fwd: " Aijaz Baig
2010-08-25 10:06                       ` Jan Engelhardt
2010-08-25 10:23                       ` Peter Zijlstra
2010-08-25 15:37                       ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTinq5APN4CXWAGj9sTFiTf4Cn1_mDaJSrAOh=t+N@mail.gmail.com' \
    --to=brgerst@gmail.com \
    --cc=aijazbaig1@gmail.com \
    --cc=jengelh@medozas.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).