All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jochen Hein <jochen@jochen.org>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: module locking for pcnet_cs
Date: Sat, 28 Dec 2002 16:16:39 +0100	[thread overview]
Message-ID: <8765texjfs.fsf@jupiter.jochen.org> (raw)


I got the "unsafe" module init message von pcnet_cs and decided to
evaluate it.  When I remove the MOD_INC_USE_COUNT and
MOD_DEC_USE_COUNT[1] the message vanishes.  Bad news is that removing the
module with still active eth0 loops rmmod (removing after "ifconfig
eth0 down" works as expected).  

Use count in lsmod is zero, so I think it is not that correct.
Playing[2] with try_module_get() doesn't help me either.

Jochen

[1] This is the probably broken patch:

--- linux-2.5.53/drivers/net/pcmcia/pcnet_cs.c.jh	2002-12-28 10:15:45.000000000 +0100
+++ linux-2.5.53/drivers/net/pcmcia/pcnet_cs.c	2002-12-28 10:16:15.000000000 +0100
@@ -1030,7 +1030,6 @@
 	return -ENODEV;
 
     link->open++;
-    MOD_INC_USE_COUNT;
 
     set_misc_reg(dev);
     request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev);
@@ -1064,8 +1063,6 @@
     if (link->state & DEV_STALE_CONFIG)
 	mod_timer(&link->release, jiffies + HZ/20);
 
-    MOD_DEC_USE_COUNT;
-
     return 0;
 } /* pcnet_close */
 

[2] Yet another broken patch:

--- linux-2.5.53/drivers/net/pcmcia/pcnet_cs.c.jh	2002-12-28 10:15:45.000000000 +0100
+++ linux-2.5.53/drivers/net/pcmcia/pcnet_cs.c	2002-12-28 11:04:08.000000000 +0100
@@ -1029,8 +1029,8 @@
     if (!DEV_OK(link))
 	return -ENODEV;
 
+    try_module_get(dev->owner);
     link->open++;
-    MOD_INC_USE_COUNT;
 
     set_misc_reg(dev);
     request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev);
@@ -1064,7 +1064,7 @@
     if (link->state & DEV_STALE_CONFIG)
 	mod_timer(&link->release, jiffies + HZ/20);
 
-    MOD_DEC_USE_COUNT;
+    module_put(dev->owner);
 
     return 0;
 } /* pcnet_close */

-- 
#include <~/.signature>: permission denied

                 reply	other threads:[~2002-12-28 15:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=8765texjfs.fsf@jupiter.jochen.org \
    --to=jochen@jochen.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.