diff options
author | George Spelvin <linux@horizon.com> | 2013-02-10 04:43:41 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-13 12:43:07 -0500 |
commit | ce3da1a654c83c6c9cb0b33477815e5d1293cc00 (patch) | |
tree | c4d24d98eceadc88d209e47d7957ef3415a456d3 | |
parent | d953e0e837e65ecc1ddaa4f9560f7925878a0de6 (diff) |
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: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: George Spelvin <linux@horizon.com>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/pps/clients/pps-ldisc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/pps/clients/pps-ldisc.c b/drivers/pps/clients/pps-ldisc.c index 60cee9e0ecb3..a94f73e1480d 100644 --- a/drivers/pps/clients/pps-ldisc.c +++ b/drivers/pps/clients/pps-ldisc.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/serial_core.h> | 25 | #include <linux/serial_core.h> |
26 | #include <linux/tty.h> | 26 | #include <linux/tty.h> |
27 | #include <linux/pps_kernel.h> | 27 | #include <linux/pps_kernel.h> |
28 | #include <linux/bug.h> | ||
28 | 29 | ||
29 | #define PPS_TTY_MAGIC 0x0001 | 30 | #define PPS_TTY_MAGIC 0x0001 |
30 | 31 | ||
@@ -33,7 +34,12 @@ static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status, | |||
33 | { | 34 | { |
34 | struct pps_device *pps = pps_lookup_dev(tty); | 35 | struct pps_device *pps = pps_lookup_dev(tty); |
35 | 36 | ||
36 | BUG_ON(pps == NULL); | 37 | /* |
38 | * This should never fail, but the ldisc locking is very | ||
39 | * convoluted, so don't crash just in case. | ||
40 | */ | ||
41 | if (WARN_ON_ONCE(pps == NULL)) | ||
42 | return; | ||
37 | 43 | ||
38 | /* Now do the PPS event report */ | 44 | /* Now do the PPS event report */ |
39 | pps_event(pps, ts, status ? PPS_CAPTUREASSERT : | 45 | pps_event(pps, ts, status ? PPS_CAPTUREASSERT : |
@@ -93,6 +99,9 @@ static void pps_tty_close(struct tty_struct *tty) | |||
93 | 99 | ||
94 | alias_n_tty_close(tty); | 100 | alias_n_tty_close(tty); |
95 | 101 | ||
102 | if (WARN_ON(!pps)) | ||
103 | return; | ||
104 | |||
96 | dev_info(pps->dev, "removed\n"); | 105 | dev_info(pps->dev, "removed\n"); |
97 | pps_unregister_source(pps); | 106 | pps_unregister_source(pps); |
98 | } | 107 | } |