From: Jean-Christian de Rivaz <jc@eclis.ch>
To: Peter Hurley <peter@hurleysoftware.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>,
Thomas Osterried <thomas@osterried.de>,
David Ranch <dranch@trinnet.net>,
Ralf Baechle DL5RB <ralf@linux-mips.org>,
linux-hams@trinnet.net, linux-hams@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: Force mkiss to reset the line discipline when serial device is removed
Date: Fri, 02 Oct 2015 10:30:25 +0200 [thread overview]
Message-ID: <560E40A1.7050002@eclis.ch> (raw)
In-Reply-To: <560DBA47.3040907@hurleysoftware.com>
Le 02. 10. 15 00:57, Peter Hurley a écrit :
> On 10/01/2015 12:56 PM, Jean-Christian de Rivaz wrote:
>> Hi Greg and Jiri,
>>
>> I try to fix a kernel panic bug related to the AX25 (and probably SLIP) line discipline when the corresponding serial device is removed [1]. I proposed some patches [2] [3] on the linux-hams mailing list but I think there raise more questions about how tty_ldisc_hangup() should work when a serial device is removed [4].
>>
>> I actually see the following options:
>>
>> a) Let the specific line discipline set the TTY_DRIVER_RESET_TERMIOS flag in tty->driver as in [2] but this is suspected bad practice [5].
>>
>> b) Let the specific line discipline set the TTY_OTHER_CLOSED flag in tty and check it in tty_ldisc_hangup() as in [3].
>>
>> c) Let the specific line discipline set the TTY_LDISC_HALTED flag in tty and check it in tty_ldisc_hangup().
>>
>> d) Let the specific line discipline set a new flag for that purpose, for example TTY_LDISC_RESET, and check it in tty_ldisc_hangup().
>>
>> e) Close the tty earlier so that tty_ldisc_reinit() is not even called. Need some advise on how this should be done.
>>
>> f) That's all wrong, something other need to be changed.
>>
>> I would appreciate some comments from tty subsystem experts about this issue.
>>
>> [1] http://www.spinics.net/lists/linux-hams/msg03500.html
Hi Peter, thanks for your time,
> The crash reported here appears to be related to how mkiss handles its netdev;
> maybe prematurely freeing the tx/rx buffers? I'd relook at how slip handles
> netdev teardown.
Yes but this is a consequence of the fact that the ax0 interface was
re-opened uninitialized while the corresponding serial device is no
longer connected to the system. I don't see any rational to create this
bogus interface: the serial device is gone.
> I don't see a problem with the ACM tty/tty core side of this.
>
> At the time the hangup occurs, there is actually still an ACM tty device.
Not physically, sorry. The physical serial device was unplugged front
the system (or in hardware forced reset in the case of my test), causing
a USB disconnect. It's important to understand that the USB disconnect
has already occurred seconds before the crash. The fact that there is
still an ACM tty structure in the kernel corresponding to nothing real
is the cause of the problem.
> The line discipline is reinited as a security precaution to prevent a previous
> session's data from being visible in the new session.
Pragmatically reinited to N_TTY is ok, this is in fact how my proposed
patches work. But reinited to N_AX25 while the serial device is no more
have no sense at all and cause the crash when the new uninitialized
parasitic interface try to send a packet.
> The tty core does not know
> at the time the vhangup() occurs that the ACM driver plans to unregister the
> tty device.
That's the root problem: It must a least known that it must not call
mkiss_open(). That's the bug that must be fixed. Or maybe the option e)
fix must be developed.
> Don't do any of the things you suggest above.
>
Can I ask what did you suggest to solve the problem ? The bug is real,
causing a kernel panic and complete crash of the system, requiring a
hardware reset to reboot.
Best Regards,
Jean-Christian de Rivaz
--
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-10-02 8:30 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 17:21 AX25 mkiss interface not deleted when the serial port is removed Jean-Christian de Rivaz
2015-09-28 20:06 ` Jean-Christian de Rivaz
2015-09-28 23:13 ` Jean-Christian de Rivaz
2015-09-29 2:13 ` David Ranch
2015-09-29 15:31 ` Ralf Baechle DL5RB
2015-09-29 15:46 ` Jean-Christian de Rivaz
2015-09-29 16:49 ` David Ranch
2015-09-29 17:14 ` Ralf Baechle
2015-09-30 0:29 ` Jean-Christian de Rivaz
2015-09-30 20:22 ` Thomas Osterried
2015-09-30 23:04 ` Jean-Christian de Rivaz
2015-10-01 2:56 ` [PATCH 1/1] Force mkiss to reset the line discipline when serial device " jc
2015-10-01 7:31 ` Ralf Baechle
2015-10-01 9:18 ` [PATCH v2 " Jean-Christian de Rivaz
2015-10-01 16:56 ` Jean-Christian de Rivaz
2015-10-01 22:57 ` Peter Hurley
2015-10-02 8:30 ` Jean-Christian de Rivaz [this message]
2015-10-02 10:35 ` Thomas Osterried
2015-10-02 13:48 ` Jean-Christian de Rivaz
2015-10-02 17:25 ` Jean-Christian de Rivaz
2015-10-02 21:46 ` [PATCH 1/1] Add poll method to mkiss let notify hangup to the user process Jean-Christian de Rivaz
2015-10-03 0:29 ` David Ranch
2015-10-03 1:02 ` Jean-Christian de Rivaz
2016-02-11 19:14 ` Thomas Osterried
2015-10-02 21:40 ` [PATCH 1/1] Close the file descriptor and exit when the kernel notice hangup Jean-Christian de Rivaz
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=560E40A1.7050002@eclis.ch \
--to=jc@eclis.ch \
--cc=dranch@trinnet.net \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-hams@trinnet.net \
--cc=linux-hams@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter@hurleysoftware.com \
--cc=ralf@linux-mips.org \
--cc=thomas@osterried.de \
/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).