From: Stephen Hemminger <shemminger@osdl.org>
To: "David Liontooth" <liontooth@post.com>
Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com
Subject: [PATCH] Fix for ipx interface module_get panic.
Date: Thu, 30 Oct 2003 13:00:23 -0800 [thread overview]
Message-ID: <20031030130023.44bd9b6a.shemminger@osdl.org> (raw)
In-Reply-To: <20031028040421.98826.qmail@mail.com>
This is the fix for the ipx module_get oops; it has been tested by acme.
The problem was that ipx was trying to use module counts to keep from being
unloaded when it had bottom half interfaces. And one of these interfaces
could be created automatically when packet was received and no sockets open
(module ref count was zero).
The fix is to get rid of using module ref counts to control this, and instead
cleanup the table on module exit.
diff -Nru a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
--- a/net/ipx/af_ipx.c Thu Oct 30 12:01:21 2003
+++ b/net/ipx/af_ipx.c Thu Oct 30 12:01:21 2003
@@ -326,7 +326,6 @@
if (intrfc->if_dev)
dev_put(intrfc->if_dev);
kfree(intrfc);
- module_put(THIS_MODULE);
}
void ipxitf_down(struct ipx_interface *intrfc)
@@ -358,6 +357,17 @@
return NOTIFY_DONE;
}
+
+static __exit void ipxitf_cleanup(void)
+{
+ struct ipx_interface *i, *tmp;
+
+ spin_lock_bh(&ipx_interfaces_lock);
+ list_for_each_entry_safe(i, tmp, &ipx_interfaces, node)
+ __ipxitf_put(i);
+ spin_unlock_bh(&ipx_interfaces_lock);
+}
+
static void ipxitf_def_skb_handler(struct sock *sock, struct sk_buff *skb)
{
if (sock_queue_rcv_skb(sock, skb) < 0)
@@ -888,7 +898,6 @@
INIT_HLIST_HEAD(&intrfc->if_sklist);
atomic_set(&intrfc->refcnt, 1);
spin_lock_init(&intrfc->if_sklist_lock);
- __module_get(THIS_MODULE);
}
return intrfc;
@@ -1979,20 +1988,12 @@
static void __exit ipx_proto_finito(void)
{
- /*
- * No need to worry about having anything on the ipx_interfaces list,
- * when a interface is created we increment the module usage count, so
- * the module will only be unloaded when there are no more interfaces
- */
- if (unlikely(!list_empty(&ipx_interfaces)))
- BUG();
- if (unlikely(!list_empty(&ipx_routes)))
- BUG();
-
ipx_proc_exit();
ipx_unregister_sysctl();
unregister_netdevice_notifier(&ipx_dev_notifier);
+
+ ipxitf_cleanup();
unregister_snap_client(pSNAP_datalink);
pSNAP_datalink = NULL;
prev parent reply other threads:[~2003-10-30 21:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-28 4:04 [2.6.0-test-9] natsemi oops David Liontooth
2003-10-28 18:26 ` Manfred Spraul
2003-10-30 21:00 ` Stephen Hemminger [this message]
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=20031030130023.44bd9b6a.shemminger@osdl.org \
--to=shemminger@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liontooth@post.com \
--cc=netdev@oss.sgi.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
all inboxes | Powered by JetHome®