aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-08-07 15:47:57 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-13 19:50:20 -0400
commit3ec0a17ef5f4ea922b10ebfdb99473c4d8d6120d (patch)
tree63b9700b604ddfa0983bbaf8a4b49f5c8c03b03b /drivers/s390
parent5920c2c9b9a16e86eb154fbb55d6034fbaad1b2b (diff)
TTY: con3215, unset raw3215[line]
raw3215[line] is set in probe, but not unset in remove. This will lead to random crashes if the device is removed and the corresponding tty opened later. open would dereference freed memory. So set raw3215[line] to NULL in remove to fix that. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: linux390@de.ibm.com Cc: linux-s390@vger.kernel.org Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/char/con3215.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 6c0116d48c74..16554982671c 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -716,10 +716,17 @@ static int raw3215_probe (struct ccw_device *cdev)
716static void raw3215_remove (struct ccw_device *cdev) 716static void raw3215_remove (struct ccw_device *cdev)
717{ 717{
718 struct raw3215_info *raw; 718 struct raw3215_info *raw;
719 unsigned int line;
719 720
720 ccw_device_set_offline(cdev); 721 ccw_device_set_offline(cdev);
721 raw = dev_get_drvdata(&cdev->dev); 722 raw = dev_get_drvdata(&cdev->dev);
722 if (raw) { 723 if (raw) {
724 spin_lock(&raw3215_device_lock);
725 for (line = 0; line < NR_3215; line++)
726 if (raw3215[line] == raw)
727 break;
728 raw3215[line] = NULL;
729 spin_unlock(&raw3215_device_lock);
723 dev_set_drvdata(&cdev->dev, NULL); 730 dev_set_drvdata(&cdev->dev, NULL);
724 raw3215_free_info(raw); 731 raw3215_free_info(raw);
725 } 732 }