kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: rutigl@gmail.com (Ruth Glushkin)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Problem with line discipline in new kernels
Date: Sun, 23 Aug 2015 10:14:20 +0300	[thread overview]
Message-ID: <CALDRwipGHscXaW8nbEQTY99nozNeF3GmwsAgVvNJ+rsUVNhmnw@mail.gmail.com> (raw)
In-Reply-To: <16405.1440192067@turing-police.cc.vt.edu>

On Thu, 22 Aug 2015 00:21:00 -0000, Valdis Kletnieks said:

> Sounds like a reference counting problem.

As far as I know, reference counter for line discipline sets to 0 in
tty_register_ldisc(),

increases to 1 in get_ldops() and decreases to 1 in put_ldops().

In tty_unregister_ldisc() it checks this value and if the reference
counter > 0, it returns error -EBUSY

And please advice how could I transfer data between kernel and user
space not using filp_open() and filp_close().

2015-08-22 0:21 GMT+03:00  <Valdis.Kletnieks@vt.edu>:
> 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.

  reply	other threads:[~2015-08-23  7:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 13:00 Problem with line discipline in new kernels Margarita Glushkin
2015-08-21 21:21 ` Valdis.Kletnieks at vt.edu
2015-08-23  7:14   ` Ruth Glushkin [this message]
2015-08-23 14:10     ` Valdis.Kletnieks at vt.edu

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=CALDRwipGHscXaW8nbEQTY99nozNeF3GmwsAgVvNJ+rsUVNhmnw@mail.gmail.com \
    --to=rutigl@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).