aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorPeter Oberparleiter <oberpar@linux.vnet.ibm.com>2014-04-09 07:10:05 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2014-04-11 07:53:38 -0400
commite106e4ea44699cc940a919924f2834b91f426d9f (patch)
tree3eb2b8230a0ef43de5965dc5381d58db1bd4b41c /drivers/s390
parent572c3eb7f841c019f756efc68debbc3187c2a62c (diff)
s390/sclp_vt220: Fix kernel panic due to early terminal input
A kernel panic might occur when there is terminal input available via the SCLP VT220 interface at an early time during the boot process. The processing of terminal input requires prior initialization which is done via an early_initcall function (init_workqueues) while the SCLP VT220 driver registers for terminal input during a console_initcall function (sclp_vt220_con_init). When there is terminal input available via the SCLP interface between console_initcall and early_initcall, a null pointer dereference occurs (system_wq is null). Fix this problem by moving the registration for terminal input to a device_initcall function (sclp_vt220_tty_init). Reported-by: Christian Borntraeger <borntraeger@de.ibm.com> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/char/sclp_vt220.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index 4eed38cd0af6..cd9c91909596 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -97,13 +97,16 @@ static void sclp_vt220_pm_event_fn(struct sclp_register *reg,
97static int __sclp_vt220_emit(struct sclp_vt220_request *request); 97static int __sclp_vt220_emit(struct sclp_vt220_request *request);
98static void sclp_vt220_emit_current(void); 98static void sclp_vt220_emit_current(void);
99 99
100/* Registration structure for our interest in SCLP event buffers */ 100/* Registration structure for SCLP output event buffers */
101static struct sclp_register sclp_vt220_register = { 101static struct sclp_register sclp_vt220_register = {
102 .send_mask = EVTYP_VT220MSG_MASK, 102 .send_mask = EVTYP_VT220MSG_MASK,
103 .pm_event_fn = sclp_vt220_pm_event_fn,
104};
105
106/* Registration structure for SCLP input event buffers */
107static struct sclp_register sclp_vt220_register_input = {
103 .receive_mask = EVTYP_VT220MSG_MASK, 108 .receive_mask = EVTYP_VT220MSG_MASK,
104 .state_change_fn = NULL,
105 .receiver_fn = sclp_vt220_receiver_fn, 109 .receiver_fn = sclp_vt220_receiver_fn,
106 .pm_event_fn = sclp_vt220_pm_event_fn,
107}; 110};
108 111
109 112
@@ -715,9 +718,14 @@ static int __init sclp_vt220_tty_init(void)
715 rc = tty_register_driver(driver); 718 rc = tty_register_driver(driver);
716 if (rc) 719 if (rc)
717 goto out_init; 720 goto out_init;
721 rc = sclp_register(&sclp_vt220_register_input);
722 if (rc)
723 goto out_reg;
718 sclp_vt220_driver = driver; 724 sclp_vt220_driver = driver;
719 return 0; 725 return 0;
720 726
727out_reg:
728 tty_unregister_driver(driver);
721out_init: 729out_init:
722 __sclp_vt220_cleanup(); 730 __sclp_vt220_cleanup();
723out_driver: 731out_driver: