[Devel] [PATCH RH7] vtty: possible ERR_PTR dereferencing in vtty_open_master

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 1 18:29:31 MSK 2020


On 05/31/2020 04:23 PM, Vasily Averin wrote:
> found by swatch:
> drivers/tty/pty.c:1306 vtty_open_master() error:
>  'tty' dereferencing possible ERR_PTR()
>
> Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
> ---
>  drivers/tty/pty.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
> index 698717e..be25302 100644
> --- a/drivers/tty/pty.c
> +++ b/drivers/tty/pty.c
> @@ -1294,6 +1294,9 @@ int vtty_open_master(envid_t veid, int idx)
>  	vtty_set_context(veid);
>
>  	tty = vtty_lookup(vttym_driver, NULL, idx);
> +	if (IS_ERR(tty))

"ret" to be set here

> +		goto err_install;
> +
>  	if (!tty) {
>  		tty = tty_init_dev(vttys_driver, idx);
>  		if (IS_ERR(tty))
>


More information about the Devel mailing list