[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <begphn3f6rdcwgmyewnk6chmws643zd2gcucphntjcrpwhxxmp@75v7gll7non6>
Date: Sun, 19 May 2024 11:00:00 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Amit Sunil Dhamne <amitsd@...gle.com>
Cc: linux@...ck-us.net, heikki.krogerus@...ux.intel.com,
gregkh@...uxfoundation.org, megi@....cz, badhri@...gle.com, rdbabiera@...gle.com,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH v1] usb: typec: tcpm: fix use-after-free case in
tcpm_register_source_caps
On Tue, May 14, 2024 at 03:01:31PM -0700, Amit Sunil Dhamne wrote:
> There could be a potential use-after-free case in
> tcpm_register_source_caps(). This could happen when:
> * new (say invalid) source caps are advertised
> * the existing source caps are unregistered
> * tcpm_register_source_caps() returns with an error as
> usb_power_delivery_register_capabilities() fails
>
> This causes port->partner_source_caps to hold on to the now freed source
> caps.
>
> Reset port->partner_source_caps value to NULL after unregistering
> existing source caps.
>
> Fixes: 230ecdf71a64 ("usb: typec: tcpm: unregister existing source caps before re-registration")
> Cc: stable@...r.kernel.org
> Signed-off-by: Amit Sunil Dhamne <amitsd@...gle.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
--
With best wishes
Dmitry
Powered by blists - more mailing lists