public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gigaset: fix module reference counting
@ 2008-06-06 22:39 Andreas Herrmann
  2008-06-15 23:09 ` Tilman Schmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Herrmann @ 2008-06-06 22:39 UTC (permalink / raw)
  To: Tilmann Schmidt, Hansjoerg Lipp; +Cc: gigaset307x-common, linux-kernel

bas_gigaset can't be unloaded due to wrong module reference counting.
Ensure that module_put is called whenever a channel is freed.

Signed-off-by: Andreas Herrmann <aherrman@arcor.de>
---
 drivers/isdn/gigaset/common.c  |    5 +----
 drivers/isdn/gigaset/gigaset.h |    1 -
 2 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 827c32c..8498317 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -184,7 +184,6 @@ int gigaset_get_channel(struct bc_state *bcs)
 		return 0;
 	}
 	++bcs->use_count;
-	bcs->busy = 1;
 	gig_dbg(DEBUG_ANY, "allocated channel %d", bcs->channel);
 	spin_unlock_irqrestore(&bcs->cs->lock, flags);
 	return 1;
@@ -195,13 +194,12 @@ void gigaset_free_channel(struct bc_state *bcs)
 	unsigned long flags;
 
 	spin_lock_irqsave(&bcs->cs->lock, flags);
-	if (!bcs->busy) {
+	if (!bcs->use_count) {
 		gig_dbg(DEBUG_ANY, "could not free channel %d", bcs->channel);
 		spin_unlock_irqrestore(&bcs->cs->lock, flags);
 		return;
 	}
 	--bcs->use_count;
-	bcs->busy = 0;
 	module_put(bcs->cs->driver->owner);
 	gig_dbg(DEBUG_ANY, "freed channel %d", bcs->channel);
 	spin_unlock_irqrestore(&bcs->cs->lock, flags);
@@ -589,7 +587,6 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
 
 	bcs->chstate = 0;
 	bcs->use_count = 1;
-	bcs->busy = 0;
 	bcs->ignore = cs->ignoreframes;
 
 	for (i = 0; i < AT_NUM; ++i)
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index f365993..ef1bc17 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -419,7 +419,6 @@ struct bc_state {
 #ifdef CONFIG_GIGASET_DEBUG
 	int emptycount;
 #endif
-	int busy;
 	int use_count;
 
 	/* private data of hardware drivers */
-- 
1.5.3.7



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gigaset: fix module reference counting
  2008-06-06 22:39 [PATCH] gigaset: fix module reference counting Andreas Herrmann
@ 2008-06-15 23:09 ` Tilman Schmidt
  2008-06-23  7:32   ` Andreas Herrmann
  0 siblings, 1 reply; 4+ messages in thread
From: Tilman Schmidt @ 2008-06-15 23:09 UTC (permalink / raw)
  To: Andreas Herrmann
  Cc: Hansjoerg Lipp, gigaset307x-common, linux-kernel, Andrew Morton,
	kkeil

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

Hi Andreas,

On 2008-06-07 00:39, Andreas Herrmann wrote:
> bas_gigaset can't be unloaded due to wrong module reference counting.
> Ensure that module_put is called whenever a channel is freed.

I'm not quite happy with that patch. Specifically, I see a risk of
module_put being called too often.

Could you explain in some more detail what bug you are trying to fix?
Do you have a sequence of events which leads to a situation where the
bas_gigaset module cannot be unloaded but should be?


Thanks,
Tilman


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gigaset: fix module reference counting
  2008-06-15 23:09 ` Tilman Schmidt
@ 2008-06-23  7:32   ` Andreas Herrmann
  2008-06-23  7:38     ` Tilman Schmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Herrmann @ 2008-06-23  7:32 UTC (permalink / raw)
  To: Tilman Schmidt
  Cc: Hansjoerg Lipp, gigaset307x-common, linux-kernel, Andrew Morton,
	kkeil

On Mon, Jun 16, 2008 at 01:09:57AM +0200, Tilman Schmidt wrote:
> On 2008-06-07 00:39, Andreas Herrmann wrote:
> > bas_gigaset can't be unloaded due to wrong module reference counting.
> > Ensure that module_put is called whenever a channel is freed.
> 
> I'm not quite happy with that patch. Specifically, I see a risk of
> module_put being called too often.

> Could you explain in some more detail what bug you are trying to fix?
> Do you have a sequence of events which leads to a situation where the
> bas_gigaset module cannot be unloaded but should be?

I've tried to reproduce the problem doing various tests -- but without
success.

Then i've checked the code and there was already this fix:

commit e468c04894f36045cf93d1384183a461014b6840 (Gigaset: permit module unload)

This was commited after 2.6.24 was released.

And (shit happens!) on the machine where I've previously tested the
stuff I had also an 2.6.24 kernel installed.

So it seems that I have mixed up different kernel versions when I've
tested my patch. Because with current git-tree bas_gigaset can be
unloaded without any problems.

Sorry for the noise.


Regards,

Andreas


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gigaset: fix module reference counting
  2008-06-23  7:32   ` Andreas Herrmann
@ 2008-06-23  7:38     ` Tilman Schmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Tilman Schmidt @ 2008-06-23  7:38 UTC (permalink / raw)
  To: Andreas Herrmann
  Cc: Hansjoerg Lipp, gigaset307x-common, linux-kernel, Andrew Morton,
	kkeil

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

Hi,

am Date: Mon, 23 Jun 2008 09:32:27 +0200 schrieb Andreas Herrmann:
> So it seems that I have mixed up different kernel versions when I've
> tested my patch. Because with current git-tree bas_gigaset can be
> unloaded without any problems.
> 
> Sorry for the noise.

No problem. Thanks for the feedback.

Take care,
Tilman

-- 
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-23  7:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-06 22:39 [PATCH] gigaset: fix module reference counting Andreas Herrmann
2008-06-15 23:09 ` Tilman Schmidt
2008-06-23  7:32   ` Andreas Herrmann
2008-06-23  7:38     ` Tilman Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox