提交 ce3da1a6 编写于 作者: G George Spelvin 提交者: Greg Kroah-Hartman

pps: Don't crash the machine when exiting will do

PPS is not really the must-have subsystem that warrants crashing
the machine if the ldisc interface is broken.
Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: NGeorge Spelvin <linux@horizon.com>
Acked-by: NRodolfo Giometti <giometti@enneenne.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 d953e0e8
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/pps_kernel.h> #include <linux/pps_kernel.h>
#include <linux/bug.h>
#define PPS_TTY_MAGIC 0x0001 #define PPS_TTY_MAGIC 0x0001
...@@ -33,7 +34,12 @@ static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status, ...@@ -33,7 +34,12 @@ static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status,
{ {
struct pps_device *pps = pps_lookup_dev(tty); struct pps_device *pps = pps_lookup_dev(tty);
BUG_ON(pps == NULL); /*
* This should never fail, but the ldisc locking is very
* convoluted, so don't crash just in case.
*/
if (WARN_ON_ONCE(pps == NULL))
return;
/* Now do the PPS event report */ /* Now do the PPS event report */
pps_event(pps, ts, status ? PPS_CAPTUREASSERT : pps_event(pps, ts, status ? PPS_CAPTUREASSERT :
...@@ -93,6 +99,9 @@ static void pps_tty_close(struct tty_struct *tty) ...@@ -93,6 +99,9 @@ static void pps_tty_close(struct tty_struct *tty)
alias_n_tty_close(tty); alias_n_tty_close(tty);
if (WARN_ON(!pps))
return;
dev_info(pps->dev, "removed\n"); dev_info(pps->dev, "removed\n");
pps_unregister_source(pps); pps_unregister_source(pps);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册