vt.c in 2.5.65-ac1
Quoted 3 lines · Osamu Tomita
I have a aquestion about patch in patch-2.5.65-ac1 for
vt.c. Here is a extracted patch from patch-2.5.65-ac1.
I think it's no need for 2.5.65.
There should be none of these two resize_screen calls. If you'll resize non-foreground VT, they'll trigger fbcon_resize with con != visible_con, resizing your display even if they should not.
Only the "if (IS_VISIBLE) err = resize_screen(...);" resize should be there (AFAIK), if con_resize follows other con_* APIs: call it only if con is visible, like it is done with putcs and others.
Petr Vandrovec [email protected]
Quoted 28 lines
drivers/char/vt.c 2003-03-18 16:58:38.000000000 +0000 renamed from drivers/char/vt.c 2003-03-18 16:46:47.000000000 +0000 +6
-6@@ -732,6 +732,12 @@ if (new_cols == video_num_columns && new_rows == video_num_lines) return 0; + err = resize_screen(currcons, new_cols, new_rows); + if (err) { + kfree(newscreen); + return err; + } + newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER); if (!newscreen) return -ENOMEM;@@ -746,12 +752,6 @@ video_size_row = new_row_size; screenbuf_size = new_screen_size; - err = resize_screen(currcons, new_cols, new_rows); - if (err) { - kfree(newscreen); - return err; - } - rlth = min(old_row_size, new_row_size); rrem = new_row_size - rlth; old_origin = origin;
Quoted 35 lines · Petr Vandrovec
Quoted 3 lines · Osamu Tomita
I have a aquestion about patch in patch-2.5.65-ac1 for
vt.c. Here is a extracted patch from patch-2.5.65-ac1.
I think it's no need for 2.5.65.There should be none of these two
resize_screencalls. If you'll resize non-foreground VT, they'll triggerfbcon_resizewith con !=visible_con, resizing your display even if they should not.Only the "if (
IS_VISIBLE) err =resize_screen(...);" resize should be there (AFAIK), ifcon_resizefollows other con_* APIs: call it only if con is visible, like it is done with putcs and others.
Petr Vandrovec [email protected]Quoted 19 lines
drivers/char/vt.c 2003-03-18 16:58:38.000000000 +0000 renamed from drivers/char/vt.c 2003-03-18 16:46:47.000000000 +0000 +6
-0@@ -732,6 +732,12 @@ if (new_cols == video_num_columns && new_rows == video_num_lines) return 0; + err = resize_screen(currcons, new_cols, new_rows); + if (err) { + kfree(newscreen); + return err; + } + newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER); if (!newscreen) return -ENOMEM;@@ -746,12 +752,6 @@ video_size_row = new_row_size; screenbuf_size = new_screen_size;
Quoted 9 lines
drivers/char/vt.c 2003-03-18 16:58:38.000000000 +0000 line 757
Quoted 9 lines
drivers/char/vt.c 2003-03-18 16:58:38.000000000 +0000 renamed from drivers/char/vt.c 2003-03-18 16:46:47.000000000 +0000 +0
-6- err = resize_screen(currcons, new_cols, new_rows); - if (err) { - kfree(newscreen); - return err; - } - rlth = min(old_row_size, new_row_size); rrem = new_row_size - rlth; old_origin = origin;
I understand. But if resize_screen() failed this attempt to kfree before kmalloc. Is there case resize_screen success but kmalloc fail?
How about patch bellow.
drivers/char/vt.c renamed from drivers/char/vt.c.orig +6 -6
@@ -736,6 +736,12 @@if (!newscreen)return -ENOMEM ; + err =resize_screen (currcons, new_cols, new_rows); +if (err) { +kfree (newscreen); +return err; + } + old_rows = video_num_lines; old_cols = video_num_columns; old_row_size = video_size_row;
@@ -746,12 +752,6 @@ video_size_row = new_row_size; screenbuf_size = new_screen_size; - err =resize_screen (currcons, new_cols, new_rows); -if (err) { -kfree (newscreen); -return err; - } - rlth =min (old_row_size, new_row_size); rrem = new_row_size - rlth; old_origin = origin;
Regards,
Osamu Tomita
Quoted 11 lines · Osamu Tomita
Quoted 10 lines · Petr Vandrovec
Quoted 3 lines · Osamu Tomita
I have a aquestion about patch in patch-2.5.65-ac1 for
vt.c. Here is a extracted patch from patch-2.5.65-ac1.
I think it's no need for 2.5.65.There should be none of these two
resize_screencalls. If you'll resize non-foreground VT, they'll triggerfbcon_resizewith con !=visible_con, resizing your display even if they should not.
Quoted 8 lines
Quoted 4 lines
Only the "if (
IS_VISIBLE) err =resize_screen(...);" resize should be there (AFAIK), ifcon_resizefollows other con_* APIs: call it only if con is visible, like it is done with putcs and others.Quoted 1 line
old_origin = origin;I understand. But if
resize_screen()failed this attempt to kfree before kmalloc. Is there caseresize_screensuccess but kmalloc fail?
How about patch bellow.
As I said: currently there is one unconditional call to resize_screen and one conditional (depending on IS_VISIBLE). Unconditional one should not be moved around, but removed completely. Look at fbcon_resize (only con_resize user) implementation, it will do wrong things if called with non-visible currcons. I believe that James has this correct in his latest patches.
Petr Vandrovec [email protected]
Quoted 33 lines
drivers/char/vt.c renamed from drivers/char/vt.c.orig +6
-6@@ -736,6 +736,12 @@if (!newscreen)return -ENOMEM ; + err =resize_screen (currcons, new_cols, new_rows); +if (err) { +kfree (newscreen); +return err; + } + old_rows = video_num_lines; old_cols = video_num_columns; old_row_size = video_size_row;@@ -746,12 +752,6 @@ video_size_row = new_row_size; screenbuf_size = new_screen_size; - err =resize_screen (currcons, new_cols, new_rows); -if (err) { -kfree (newscreen); -return err; - } - rlth =min (old_row_size, new_row_size); rrem = new_row_size - rlth; old_origin = origin;Regards,
Osamu Tomita