Messages in this thread | | | Date | Wed, 7 Nov 2007 09:20:33 +0800 | From | "Dave Young" <> | Subject | Re: [PATCH]bluetooth rfcomm_dev refcount bug fix |
| |
On Nov 6, 2007 9:33 PM, Marcel Holtmann <marcel@holtmann.org> wrote: > Hi Dave, > > > I'm afraid to be considered as spam ;) > > > > (Due to timezone offset, I have to mail again and cann't wait for your > > reply, sorry for the annoying) > > I am in a different timezone every other week. So nevermind ;) > > > I think the rfcomm_dev_put could be seperated from the rfcomm_dev_put, > > it will be more straitforward then. > > > > please consider below patch, tested on my side. thanks. > > That one looks totally wrong to me. Without even testing it, it will > have side effects that you haven't run into yet. Unless the TTY core > changed so much, this comments are there for a really good reason and > the code is tested a lot. What side effects?
Anyway, the refcnt is wrong in rfcomm_release_dev. We could either remove the rfcomm_dev_del in rfcomm_tty_hangup or remove the rfcomm_dev_put in the end of rfcomm_release_dev, or the rfcomm_dev will be destructed, and the later callback of rfcomm_tty_close could cause oops.
> > Also if you have to do two rfcomm_dev_put() in a row, then we are doing > something really wrong and this tries to hide a real bug somewhere. One is for device deletion (1->0), one is for the get/put pairs, actually same as before.
Main reason of doing so in this patch is that if I remove the last rfcomm_dev_put in rfcomm_release_dev, then it looks like get device <--> del device, so relace it with set deletion flag and then put the device like "get device <--> put device" which is straitforward.
> > Regards > > Marcel > > > - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |