[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87eelkc996.fsf@kernel.org>
Date: Tue, 27 Oct 2020 11:23:49 +0200
From: Felipe Balbi <balbi@...nel.org>
To: Macpaul Lin <macpaul.lin@...iatek.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Matthias Brugger <matthias.bgg@...il.com>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Cc: Mediatek WSD Upstream <wsd_upstream@...iatek.com>,
Macpaul Lin <macpaul.lin@...iatek.com>,
Macpaul Lin <macpaul.lin@...il.com>,
Eddie Hung <eddie.hung@...iatek.com>, stable@...r.kernel.org
Subject: Re: [PATCH v2] usb: gadget: configfs: Fix use-after-free issue with
udc_name
Hi,
Macpaul Lin <macpaul.lin@...iatek.com> writes:
> From: Eddie Hung <eddie.hung@...iatek.com>
>
> There is a use-after-free issue, if access udc_name
> in function gadget_dev_desc_UDC_store after another context
> free udc_name in function unregister_gadget.
>
> Context 1:
> gadget_dev_desc_UDC_store()->unregister_gadget()->
> free udc_name->set udc_name to NULL
>
> Context 2:
> gadget_dev_desc_UDC_show()-> access udc_name
>
> Call trace:
> dump_backtrace+0x0/0x340
> show_stack+0x14/0x1c
> dump_stack+0xe4/0x134
> print_address_description+0x78/0x478
> __kasan_report+0x270/0x2ec
> kasan_report+0x10/0x18
> __asan_report_load1_noabort+0x18/0x20
> string+0xf4/0x138
> vsnprintf+0x428/0x14d0
> sprintf+0xe4/0x12c
> gadget_dev_desc_UDC_show+0x54/0x64
> configfs_read_file+0x210/0x3a0
> __vfs_read+0xf0/0x49c
> vfs_read+0x130/0x2b4
> SyS_read+0x114/0x208
> el0_svc_naked+0x34/0x38
>
> Add mutex_lock to protect this kind of scenario.
>
> Signed-off-by: Eddie Hung <eddie.hung@...iatek.com>
> Signed-off-by: Macpaul Lin <macpaul.lin@...iatek.com>
> Reviewed-by: Peter Chen <peter.chen@....com>
> Cc: stable@...r.kernel.org
patch doesn't apply:
$ patch -p1 --dry-run
/usr/bin/patch: **** Only garbage was found in the patch input.
Please resend using git send-email and make sure your smtp server sends
it as plain text, not base64.
--
balbi
Download attachment "signature.asc" of type "application/pgp-signature" (858 bytes)
Powered by blists - more mailing lists