On Thu, 13 Aug 2015 13:00:58 -0000, Margarita Glushkin said:
> I have a linux kernel driver for serial device, which uses line discipline
> and char device. Driver works with all old kernels, starting from 3.8 this
> driver still works, but when I unload it and load again to the memory
> (modprobe -r bpsctl_mod, after modprobe bpsctl_mod), it crashes the kernel.
> It can't unregister line discipline, because this line discipline is busy.

Sounds like a reference counting problem.  When your line discipline is busy,
somebody should have a reference on the module so it can't be unloaded.  I don't
see any such reference taking/freeing in your posted code.

Your crash is almost certainly because you're unloading it out from
under active use, which will probably result in somebody overlaying storage.
Frankly, you're probably lucky the system lives long enough for you to
reload it.....

Oh, and filp_open() is usually the wrong way to solve whatever problem you
were trying to solve by using it.

Attachment: pgpP1KhH98aHY.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to