[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1eb62346-304b-54d5-8a62-8a35888d51bd@kernel.org>
Date: Thu, 4 Aug 2022 07:47:09 +0200
From: Jiri Slaby <jirislaby@...nel.org>
To: Helge Deller <deller@....de>,
Khalid Masum <khalid.masum.92@...il.com>,
syzbot <syzbot+14b0e8f3fd1612e35350@...kaller.appspotmail.com>,
dri-devel@...ts.freedesktop.org, linux-fbdev@...r.kernel.org,
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] tty: vt: selection: Add check for valid tiocl_selection
values
On 30. 07. 22, 20:49, Helge Deller wrote:
> The line and column numbers for the selection need to start at 1.
> Add the checks to prevent invalid input.
>
> Signed-off-by: Helge Deller <deller@....de>
> Reported-by: syzbot+14b0e8f3fd1612e35350@...kaller.appspotmail.com
>
> diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
> index f7755e73696e..58692a9b4097 100644
> --- a/drivers/tty/vt/selection.c
> +++ b/drivers/tty/vt/selection.c
> @@ -326,6 +326,9 @@ static int vc_selection(struct vc_data *vc, struct tiocl_selection *v,
> return 0;
> }
>
> + if (!v->xs || !v->ys || !v->xe || !v->ye)
> + return -EINVAL;
Hmm, I'm not sure about this. It potentially breaks userspace (by
returning EINVAL now). And the code below should handle this just fine,
right:
> +
> v->xs = min_t(u16, v->xs - 1, vc->vc_cols - 1);
> v->ys = min_t(u16, v->ys - 1, vc->vc_rows - 1);
> v->xe = min_t(u16, v->xe - 1, vc->vc_cols - 1);
?
thanks,
--
js
suse labs
Powered by blists - more mailing lists