netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gao feng <gaofeng@cn.fujitsu.com>
To: Jan Engelhardt <jengelh@inai.de>
Cc: Stephen Hemminger <stephen.hemminger@vyatta.com>,
	netdev@vger.kernel.org, davem@davemloft.net,
	kuznet@ms2.inr.ac.ru
Subject: Re: [PATCH] inet_diag: make config INET_DIAG bool
Date: Mon, 24 Sep 2012 16:48:44 +0800	[thread overview]
Message-ID: <50601E6C.3070106@cn.fujitsu.com> (raw)
In-Reply-To: <alpine.LNX.2.01.1209231540180.15692@nerf07.vanv.qr>

于 2012年09月23日 21:40, Jan Engelhardt 写道:
> On Sunday 2012-09-23 06:36, Stephen Hemminger wrote:
> 
>>> when inet_diag being compiled as module, inet_diag_handler_dump
>>> set netlink_dump_control.dump to inet_diag_dump,so if module
>>> inet_diag is unloaded,netlink will still try to call this function
>>> in netlink_dump. this will cause kernel panic.
>>
>> Another way to handle this to just get rid of inet_diag_exit
>> so that module can be loaded but not unloaded.
> 
> Why don't we unset netlink_dump_control.dump on exit?


Though I like this idea,but it may cause dead lock.
netlink_dimp [mutex_lock(netlink_sock->cb_mutex) here]
   |->inet_diag_dump
	|->__inet_diag_dump
	    |->inet_diag_lock_handler [may try to load tcp_diag here,
					so we need module_mutex lock]

And on module exit,we already get module_mutex lock,
if we unset netlink_sock->cb,we need to get mutex lock of netlink_sock->cb_mutex.

I think this will cause dead lock.

I don't know if I should change this patch as Stephen said,because I don't know
witch one is better.

Any comments?

  reply	other threads:[~2012-09-24  8:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-23  3:49 [PATCH] inet_diag: make config INET_DIAG bool Gao feng
2012-09-23  4:36 ` Stephen Hemminger
2012-09-23 13:40   ` Jan Engelhardt
2012-09-24  8:48     ` Gao feng [this message]
2012-09-24  9:42       ` Eric Dumazet
2012-09-24 10:17         ` Gao feng
2012-09-24 11:32           ` Eric Dumazet
2012-09-25  2:18             ` Gao feng

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=50601E6C.3070106@cn.fujitsu.com \
    --to=gaofeng@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=jengelh@inai.de \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=stephen.hemminger@vyatta.com \
    /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).