lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dcaaf7d5-b2d5-dbb9-f3fe-2232ee525cc8@kernel.org>
Date:   Mon, 20 Feb 2023 12:48:59 +0100
From:   Jiri Slaby <jirislaby@...nel.org>
To:     linux@...ssschuh.net, George Kennedy <george.kennedy@...cle.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, Randy Dunlap <rdunlap@...radead.org>,
        Storm Dragon <stormdragon2976@...il.com>
Subject: Re: [PATCH] vc_screen: don't clobber return value in vcs_read

On 20. 02. 23, 7:46, linux@...ssschuh.net wrote:
> From: Thomas Weißschuh <linux@...ssschuh.net>
> 
> Commit 226fae124b2d
> ("vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF")
> moved the call to vcs_vc() into the loop.
> While doing this it also moved the unconditional assignment of
> "ret = -ENXIO".
> This unconditional assignment was valid outside the loop but within it
> it clobbers the actual value of ret.
> 
> To avoid this only assign "ret = -ENXIO" when actually needed.

Not sure -- I cannot find it -- but hasn't George fixed this yet?

> Reported-by: Storm Dragon <stormdragon2976@...il.com>
> Link: https://lore.kernel.org/lkml/Y%2FKS6vdql2pIsCiI@hotmail.com/
> Fixes: 226fae124b2d ("vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF")
> Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
> 
> ---
> 
> @Storm Could you validate this patch?
> ---
>   drivers/tty/vt/vc_screen.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
> index f566eb1839dc..2ef519a40a87 100644
> --- a/drivers/tty/vt/vc_screen.c
> +++ b/drivers/tty/vt/vc_screen.c
> @@ -403,10 +403,11 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
>   		unsigned int this_round, skip = 0;
>   		int size;
>   
> -		ret = -ENXIO;
>   		vc = vcs_vc(inode, &viewed);
> -		if (!vc)
> +		if (!vc) {
> +			ret = -ENXIO;
>   			goto unlock_out;
> +		}
>   
>   		/* Check whether we are above size each round,
>   		 * as copy_to_user at the end of this loop
> 
> base-commit: c9c3395d5e3dcc6daee66c6908354d47bf98cb0c

-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ