All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Macpaul Lin <macpaul.lin@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: Mediatek WSD Upstream <wsd_upstream@mediatek.com>,
	Macpaul Lin <macpaul.lin@mediatek.com>,
	Macpaul Lin <macpaul.lin@gmail.com>,
	Eddie Hung <eddie.hung@mediatek.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] usb: gadget: configfs: Fix use-after-free issue with udc_name
Date: Tue, 27 Oct 2020 11:23:49 +0200	[thread overview]
Message-ID: <87eelkc996.fsf@kernel.org> (raw)
In-Reply-To: <1595040303-23046-1-git-send-email-macpaul.lin@mediatek.com>

[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]


Hi,

Macpaul Lin <macpaul.lin@mediatek.com> writes:
> From: Eddie Hung <eddie.hung@mediatek.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@mediatek.com>
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> Reviewed-by: Peter Chen <peter.chen@nxp.com>
> Cc: stable@vger.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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@kernel.org>
To: Macpaul Lin <macpaul.lin@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: stable@vger.kernel.org, Macpaul Lin <macpaul.lin@gmail.com>,
	Eddie Hung <eddie.hung@mediatek.com>,
	Macpaul Lin <macpaul.lin@mediatek.com>,
	Mediatek WSD Upstream <wsd_upstream@mediatek.com>
Subject: Re: [PATCH v2] usb: gadget: configfs: Fix use-after-free issue with udc_name
Date: Tue, 27 Oct 2020 11:23:49 +0200	[thread overview]
Message-ID: <87eelkc996.fsf@kernel.org> (raw)
In-Reply-To: <1595040303-23046-1-git-send-email-macpaul.lin@mediatek.com>


[-- Attachment #1.1: Type: text/plain, Size: 1402 bytes --]


Hi,

Macpaul Lin <macpaul.lin@mediatek.com> writes:
> From: Eddie Hung <eddie.hung@mediatek.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@mediatek.com>
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> Reviewed-by: Peter Chen <peter.chen@nxp.com>
> Cc: stable@vger.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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@kernel.org>
To: Macpaul Lin <macpaul.lin@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: stable@vger.kernel.org, Macpaul Lin <macpaul.lin@gmail.com>,
	Eddie Hung <eddie.hung@mediatek.com>,
	Macpaul Lin <macpaul.lin@mediatek.com>,
	Mediatek WSD Upstream <wsd_upstream@mediatek.com>
Subject: Re: [PATCH v2] usb: gadget: configfs: Fix use-after-free issue with udc_name
Date: Tue, 27 Oct 2020 11:23:49 +0200	[thread overview]
Message-ID: <87eelkc996.fsf@kernel.org> (raw)
In-Reply-To: <1595040303-23046-1-git-send-email-macpaul.lin@mediatek.com>


[-- Attachment #1.1: Type: text/plain, Size: 1402 bytes --]


Hi,

Macpaul Lin <macpaul.lin@mediatek.com> writes:
> From: Eddie Hung <eddie.hung@mediatek.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@mediatek.com>
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> Reviewed-by: Peter Chen <peter.chen@nxp.com>
> Cc: stable@vger.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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-10-27  9:24 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16  6:41 [PATCH] usb: gadget: configfs: Fix use-after-free issue with udc_name Macpaul Lin
2020-07-16  6:41 ` Macpaul Lin
2020-07-16  6:41 ` Macpaul Lin
2020-07-17  4:14 ` Peter Chen
2020-07-17  4:14   ` Peter Chen
2020-07-17  4:14   ` Peter Chen
2020-07-18  2:45 ` [PATCH v2] " Macpaul Lin
2020-07-18  2:45   ` Macpaul Lin
2020-07-18  2:45   ` Macpaul Lin
2020-07-18  2:58   ` Macpaul Lin
2020-07-18  2:58     ` Macpaul Lin
2020-07-18  2:58     ` Macpaul Lin
2020-07-21 11:33     ` Greg Kroah-Hartman
2020-07-21 11:33       ` Greg Kroah-Hartman
2020-07-21 11:33       ` Greg Kroah-Hartman
2020-07-22  1:59       ` Macpaul Lin
2020-07-22  1:59         ` Macpaul Lin
2020-07-22  1:59         ` Macpaul Lin
2020-10-20  6:36   ` Macpaul Lin
2020-10-20  6:36     ` Macpaul Lin
2020-10-20  6:36     ` Macpaul Lin
2020-10-27  9:23   ` Felipe Balbi [this message]
2020-10-27  9:23     ` Felipe Balbi
2020-10-27  9:23     ` Felipe Balbi
2020-11-01  5:37   ` [RESEND PATCH " Macpaul Lin
2020-11-01  5:37     ` Macpaul Lin
2020-11-01  5:37     ` Macpaul Lin
2020-12-29 10:53   ` [PATCH RESEND " Macpaul Lin
2020-12-29 10:53     ` Macpaul Lin
2020-12-29 10:53     ` Macpaul Lin
2020-10-28 17:55 [PATCH " Macpaul Lin
2020-10-28 17:55 ` Macpaul Lin
2020-10-28 17:55 ` Macpaul Lin
2020-10-28 17:59 ` Macpaul Lin
2020-10-28 17:59   ` Macpaul Lin
2020-10-28 17:59   ` Macpaul Lin

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=87eelkc996.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=eddie.hung@mediatek.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=macpaul.lin@gmail.com \
    --cc=macpaul.lin@mediatek.com \
    --cc=matthias.bgg@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=wsd_upstream@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.