public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Denis Efremov (Oracle)" <efremov@linux.com>
Cc: stable@vger.kernel.org, Duoming Zhou <duoming@zju.edu.cn>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Re: [PATCH] Input: cyttsp4_core - change del_timer_sync() to timer_shutdown_sync()
Date: Fri, 8 Sep 2023 07:15:07 +0100	[thread overview]
Message-ID: <2023090835-playroom-plastic-494c@gregkh> (raw)
In-Reply-To: <20230908014144.61151-1-efremov@linux.com>

On Fri, Sep 08, 2023 at 05:41:35AM +0400, Denis Efremov (Oracle) wrote:
> From: Duoming Zhou <duoming@zju.edu.cn>
> 
> The watchdog_timer can schedule tx_timeout_task and watchdog_work
> can also arm watchdog_timer. The process is shown below:
> 
> ----------- timer schedules work ------------
> cyttsp4_watchdog_timer() //timer handler
>   schedule_work(&cd->watchdog_work)
> 
> ----------- work arms timer ------------
> cyttsp4_watchdog_work() //workqueue callback function
>   cyttsp4_start_wd_timer()
>     mod_timer(&cd->watchdog_timer, ...)
> 
> Although del_timer_sync() and cancel_work_sync() are called in
> cyttsp4_remove(), the timer and workqueue could still be rearmed.
> As a result, the possible use after free bugs could happen. The
> process is shown below:
> 
>   (cleanup routine)           |  (timer and workqueue routine)
> cyttsp4_remove()              | cyttsp4_watchdog_timer() //timer
>   cyttsp4_stop_wd_timer()     |   schedule_work()
>     del_timer_sync()          |
>                               | cyttsp4_watchdog_work() //worker
>                               |   cyttsp4_start_wd_timer()
>                               |     mod_timer()
>     cancel_work_sync()        |
>                               | cyttsp4_watchdog_timer() //timer
>                               |   schedule_work()
>     del_timer_sync()          |
>   kfree(cd) //FREE            |
>                               | cyttsp4_watchdog_work() // reschedule!
>                               |   cd-> //USE
> 
> This patch changes del_timer_sync() to timer_shutdown_sync(),
> which could prevent rearming of the timer from the workqueue.
> 
> Cc: stable@vger.kernel.org
> Fixes: CVE-2023-4134

"CVE" is not a valid Fixes tag :(

> Fixes: 17fb1563d69b ("Input: cyttsp4 - add core driver for Cypress TMA4XX touchscreen devices")
> Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
> Link: https://lore.kernel.org/r/20230421082919.8471-1-duoming@zju.edu.cn
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
> ---
> 
> I've only added Cc: stable and Fixes tag.

What is the commit id in Linus's tree for this?

thanks,

greg k-h

  reply	other threads:[~2023-09-08  6:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08  1:41 [PATCH] Input: cyttsp4_core - change del_timer_sync() to timer_shutdown_sync() Denis Efremov (Oracle)
2023-09-08  6:15 ` Greg KH [this message]
2023-09-08  6:34   ` Denis Efremov (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2023090835-playroom-plastic-494c@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=duoming@zju.edu.cn \
    --cc=efremov@linux.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox