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] [day] [month] [year] [list]
Message-ID: <20201117201034.GA2009714@dtor-ws>
Date:   Tue, 17 Nov 2020 12:10:34 -0800
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     linux-kernel@...r.kernel.org, linux-input@...r.kernel.org
Subject: Re: [PATCH] Input: sunkbd - fix UAF in sunkbd_reinit()

Hi Yang,

On Tue, Nov 17, 2020 at 09:27:51PM +0800, Yang Yingliang wrote:
> 
> After sunkbd->tq is added to workqueue, before scheduled work finish, sunkbd is
> freed by sunkbd_disconnect(), when sunkbd is used in sunkbd_reinit(), it causes
> a UAF. Fix this by calling flush_scheduled_work() before free sunkbd.
> 
> This fixes CVE-2020-25669.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
>  drivers/input/keyboard/sunkbd.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c
> index 27126e621eb6..b6222896acdf 100644
> --- a/drivers/input/keyboard/sunkbd.c
> +++ b/drivers/input/keyboard/sunkbd.c
> @@ -316,6 +316,7 @@ static void sunkbd_disconnect(struct serio *serio)
>  {
>  	struct sunkbd *sunkbd = serio_get_drvdata(serio);
>  
> +	flush_scheduled_work();

This is unfortunately racy as we may get interrupt and reschedule the
work again before we get to disabling the port.

It is properly fixed by 77e70d351db7de07a46ac49b87a6c3c7a60fca7e.

>  	sunkbd_enable(sunkbd, false);
>  	input_unregister_device(sunkbd->dev);
>  	serio_close(serio);
> -- 
> 2.17.1
> 

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ