[PATCH] vc_screen: modify vcs_size() handling in vcs_read()

George Kennedy posted 1 patch 2 years, 6 months ago
There is a newer version of this series
drivers/tty/vt/vc_screen.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] vc_screen: modify vcs_size() handling in vcs_read()
Posted by George Kennedy 2 years, 6 months ago
Restore the vcs_size() handling in vcs_read() to what
it had been in previous version.

Suggested-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: George Kennedy <george.kennedy@oracle.com>
---
 drivers/tty/vt/vc_screen.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
index f566eb1839dc..c0a2273bb998 100644
--- a/drivers/tty/vt/vc_screen.c
+++ b/drivers/tty/vt/vc_screen.c
@@ -414,10 +414,8 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 		 */
 		size = vcs_size(vc, attr, uni_mode);
 		if (size < 0) {
-			if (read)
-				break;
 			ret = size;
-			goto unlock_out;
+			break;
 		}
 		if (pos >= size)
 			break;
-- 
2.31.1
Re: [PATCH] vc_screen: modify vcs_size() handling in vcs_read()
Posted by Linus Torvalds 2 years, 6 months ago
On Mon, Feb 27, 2023 at 11:43 AM George Kennedy
<george.kennedy@oracle.com> wrote:
>
> Restore the vcs_size() handling in vcs_read() to what
> it had been in previous version.
>
> Suggested-by: Jiri Slaby <jirislaby@kernel.org>
> Signed-off-by: George Kennedy <george.kennedy@oracle.com>

Please also add a

   Fixes: 226fae124b2d ("vc_screen: move load of struct vc_data
pointer in vcs_read() to avoid UAF")

or whatever it was that broke this, so that we have that context to
what the "previous version" actually was.

               Linus