diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-12-04 08:29:11 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-12-16 08:37:45 -0500 |
commit | 03439e7d0a7ab3d77a74523b9ba64736c0fc28de (patch) | |
tree | e1787c15affd7f550843bd95022ae0ee1fc16135 | |
parent | c63badebfebacdba827ab1cc1d420fc81bd8d818 (diff) |
s390/3270: fix use after free of tty3270_screen structure
The deactivation and freeing of the tty view of the 3270 device
can race with a tty3270_update invocation via the update timer.
To fix this move the del_timer_sync call for the update timer from
tty3270_free_view to tty3270_free prior to the tty3270_free_screen
call.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | drivers/s390/char/tty3270.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index 3f4ca4e09a4c..07cf182c18f9 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
@@ -125,10 +125,7 @@ static void tty3270_resize_work(struct work_struct *work); | |||
125 | */ | 125 | */ |
126 | static void tty3270_set_timer(struct tty3270 *tp, int expires) | 126 | static void tty3270_set_timer(struct tty3270 *tp, int expires) |
127 | { | 127 | { |
128 | if (expires == 0) | 128 | mod_timer(&tp->timer, jiffies + expires); |
129 | del_timer(&tp->timer); | ||
130 | else | ||
131 | mod_timer(&tp->timer, jiffies + expires); | ||
132 | } | 129 | } |
133 | 130 | ||
134 | /* | 131 | /* |
@@ -744,7 +741,6 @@ tty3270_free_view(struct tty3270 *tp) | |||
744 | { | 741 | { |
745 | int pages; | 742 | int pages; |
746 | 743 | ||
747 | del_timer_sync(&tp->timer); | ||
748 | kbd_free(tp->kbd); | 744 | kbd_free(tp->kbd); |
749 | raw3270_request_free(tp->kreset); | 745 | raw3270_request_free(tp->kreset); |
750 | raw3270_request_free(tp->read); | 746 | raw3270_request_free(tp->read); |
@@ -877,6 +873,7 @@ tty3270_free(struct raw3270_view *view) | |||
877 | { | 873 | { |
878 | struct tty3270 *tp = container_of(view, struct tty3270, view); | 874 | struct tty3270 *tp = container_of(view, struct tty3270, view); |
879 | 875 | ||
876 | del_timer_sync(&tp->timer); | ||
880 | tty3270_free_screen(tp->screen, tp->view.rows); | 877 | tty3270_free_screen(tp->screen, tp->view.rows); |
881 | tty3270_free_view(tp); | 878 | tty3270_free_view(tp); |
882 | } | 879 | } |