Linux bluetooth development
 help / color / mirror / Atom feed
* [Bluez-devel] Refcounting problem in rfcomm
@ 2006-07-31 14:44 Peter Wippich
  2006-07-31 18:13 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Wippich @ 2006-07-31 14:44 UTC (permalink / raw)
  To: bluez-devel


Hi all, 

while trying to implement a server tty which can be used without a user 
space daemon I came across a reference counting problem.  Function 
rfcomm_accept_connection() 
calls __module_get(nsock->ops->owner) but there is no corresponding
module_put(). I think for user space sockets this won't be a problem. 
However, if the owner of the socket is the rfcomm module itself the 
reference count gets wrong.    

A work around for this may be to decrement the reference count just before 
releasing the socket used for listening. 

Does anybody has some better idea ?? 

Thank you and best regards,

Peter 
 

|       Peter Wippich                   Voice: +49 30 46776411          |
|       G&W Instruments GmbH            fax:   +49 30 46776419          |
|       Gustav-Meyer-Allee 25, Geb. 12  Email: pewi@gw-instruments.de   |
|       D-13355 Berlin  / Germany                                       |


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] Refcounting problem in rfcomm
  2006-07-31 18:13 ` Marcel Holtmann
@ 2006-07-31 16:33   ` Peter Wippich
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Wippich @ 2006-07-31 16:33 UTC (permalink / raw)
  To: BlueZ development



Hi Marcel, 

> the RFCOMM module reference counting is not funny and you can mess it up
> on so many level. So be careful with it. I haven't looked at it, but
> from past experience I know that you can easily break things. So please
> give us some more details or code to show the problem.

You're right, the ref counting is realy something I don't want to change. 
For now I've fixed it by a module_put() right after accept() returns with 
a BT_CONNECTED state. I will do some more testing and code clean up and 
then send in a patch for tty.c. Maybe I will send it in two steps because 
I also don't like some general things in tty.c. E.g. rfcomm_dlc_lock / 
unlock is used there several times but in parts of the codes which realy 
don't deal with dlcs. 
So adding a dev_lock is something which is independend of my other 
changes. 

Best regards, 

Peter 
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] Refcounting problem in rfcomm
  2006-07-31 14:44 [Bluez-devel] Refcounting problem in rfcomm Peter Wippich
@ 2006-07-31 18:13 ` Marcel Holtmann
  2006-07-31 16:33   ` Peter Wippich
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2006-07-31 18:13 UTC (permalink / raw)
  To: BlueZ development

Hi Peter,

> while trying to implement a server tty which can be used without a user 
> space daemon I came across a reference counting problem.  Function 
> rfcomm_accept_connection() 
> calls __module_get(nsock->ops->owner) but there is no corresponding
> module_put(). I think for user space sockets this won't be a problem. 
> However, if the owner of the socket is the rfcomm module itself the 
> reference count gets wrong.    
> 
> A work around for this may be to decrement the reference count just before 
> releasing the socket used for listening. 

the RFCOMM module reference counting is not funny and you can mess it up
on so many level. So be careful with it. I haven't looked at it, but
from past experience I know that you can easily break things. So please
give us some more details or code to show the problem.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

end of thread, other threads:[~2006-07-31 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 14:44 [Bluez-devel] Refcounting problem in rfcomm Peter Wippich
2006-07-31 18:13 ` Marcel Holtmann
2006-07-31 16:33   ` Peter Wippich

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