<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/usb/gadget/udc, branch linux-6.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.2.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.2.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-05-11T14:11:23Z</updated>
<entry>
<title>usb: gadget: tegra-xudc: Fix crash in vbus_draw</title>
<updated>2023-05-11T14:11:23Z</updated>
<author>
<name>Jon Hunter</name>
</author>
<published>2023-04-05T18:18:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=18571e1adb4a808627954a5a37919f35a428a537'/>
<id>urn:sha1:18571e1adb4a808627954a5a37919f35a428a537</id>
<content type='text'>
[ Upstream commit 5629d31955297ca47b9283c64fff70f2f34aa528 ]

Commit ac82b56bda5f ("usb: gadget: tegra-xudc: Add vbus_draw support")
populated the vbus_draw callback for the Tegra XUDC driver. The function
tegra_xudc_gadget_vbus_draw(), that was added by this commit, assumes
that the pointer 'curr_usbphy' has been initialised, which is not always
the case because this is only initialised when the USB role is updated.
Fix this crash, by checking that the 'curr_usbphy' is valid before
dereferencing.

Fixes: ac82b56bda5f ("usb: gadget: tegra-xudc: Add vbus_draw support")
Reviewed-by: Thierry Reding &lt;treding@nvidia.com&gt;
Signed-off-by: Jon Hunter &lt;jonathanh@nvidia.com&gt;
Link: https://lore.kernel.org/r/20230405181854.42355-1-jonathanh@nvidia.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: udc: renesas_usb3: Fix use after free bug in renesas_usb3_remove due to race condition</title>
<updated>2023-05-11T14:11:21Z</updated>
<author>
<name>Zheng Wang</name>
</author>
<published>2023-03-20T06:29:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1029639643c326396ce8e07a9f52ce7165c021c3'/>
<id>urn:sha1:1029639643c326396ce8e07a9f52ce7165c021c3</id>
<content type='text'>
[ Upstream commit 2b947f8769be8b8181dc795fd292d3e7120f5204 ]

In renesas_usb3_probe, role_work is bound with renesas_usb3_role_work.
renesas_usb3_start will be called to start the work.

If we remove the driver which will call usbhs_remove, there may be
an unfinished work. The possible sequence is as follows:

CPU0                  			CPU1

                    			 renesas_usb3_role_work
renesas_usb3_remove
usb_role_switch_unregister
device_unregister
kfree(sw)
//free usb3-&gt;role_sw
                    			 usb_role_switch_set_role
                    			 //use usb3-&gt;role_sw

The usb3-&gt;role_sw could be freed under such circumstance and then
used in usb_role_switch_set_role.

This bug was found by static analysis. And note that removing a
driver is a root-only operation, and should never happen in normal
case. But the root user may directly remove the device which
will also trigger the remove function.

Fix it by canceling the work before cleanup in the renesas_usb3_remove.

Fixes: 39facfa01c9f ("usb: gadget: udc: renesas_usb3: Add register of usb role switch")
Signed-off-by: Zheng Wang &lt;zyytlz.wz@163.com&gt;
Reviewed-by: Yoshihiro Shimoda &lt;yoshihiro.shimoda.uh@renesas.com&gt;
Link: https://lore.kernel.org/r/20230320062931.505170-1-zyytlz.wz@163.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: udc: core: Prevent redundant calls to pullup</title>
<updated>2023-05-11T14:10:49Z</updated>
<author>
<name>Badhri Jagan Sridharan</name>
</author>
<published>2023-04-07T03:07:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d4b9c2730aa1fc6c5e028248f24855eb5805cac3'/>
<id>urn:sha1:d4b9c2730aa1fc6c5e028248f24855eb5805cac3</id>
<content type='text'>
commit a3afbf5cc887fc3401f012fe629810998ed61859 upstream.

usb_gadget_connect calls gadget-&gt;ops-&gt;pullup without checking whether
gadget-&gt;connected was previously set. Make this symmetric to
usb_gadget_disconnect by returning early if gadget-&gt;connected is
already set.

Fixes: 5a1da544e572 ("usb: gadget: core: do not try to disconnect gadget if it is not connected")
Cc: stable@vger.kernel.org
Signed-off-by: Badhri Jagan Sridharan &lt;badhri@google.com&gt;
Link: https://lore.kernel.org/r/20230407030741.3163220-2-badhri@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: udc: core: Invoke usb_gadget_connect only when started</title>
<updated>2023-05-11T14:10:49Z</updated>
<author>
<name>Badhri Jagan Sridharan</name>
</author>
<published>2023-04-07T03:07:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d5797dc0225edec06f634100c32c4579e6234273'/>
<id>urn:sha1:d5797dc0225edec06f634100c32c4579e6234273</id>
<content type='text'>
commit 0db213ea8eed5534a5169e807f28103cbc9d23df upstream.

usb_udc_connect_control does not check to see if the udc has already
been started. This causes gadget-&gt;ops-&gt;pullup to be called through
usb_gadget_connect when invoked from usb_udc_vbus_handler even before
usb_gadget_udc_start is called. Guard this by checking for udc-&gt;started
in usb_udc_connect_control before invoking usb_gadget_connect.

Guarding udc-&gt;vbus, udc-&gt;started, gadget-&gt;connect, gadget-&gt;deactivate
related functions with connect_lock. usb_gadget_connect_locked,
usb_gadget_disconnect_locked, usb_udc_connect_control_locked,
usb_gadget_udc_start_locked, usb_gadget_udc_stop_locked are called with
this lock held as they can be simulataneously invoked from different code
paths.

Adding an additional check to make sure udc is started(udc-&gt;started)
before pullup callback is invoked.

Fixes: 628ef0d273a6 ("usb: udc: add usb_udc_vbus_handler")
Cc: stable@vger.kernel.org
Signed-off-by: Badhri Jagan Sridharan &lt;badhri@google.com&gt;
Link: https://lore.kernel.org/r/20230407030741.3163220-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: gadget: pxa27x_udc: fix memory leak with using debugfs_lookup()</title>
<updated>2023-03-11T12:50:43Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2023-02-02T15:32:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=67c931a3f2f061bf457995fd21fff114325e0c30'/>
<id>urn:sha1:67c931a3f2f061bf457995fd21fff114325e0c30</id>
<content type='text'>
[ Upstream commit 7a6952fa0366d4408eb8695af1a0578c39ec718a ]

When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time.  To make things simpler, just
call debugfs_lookup_and_remove() instead which handles all of the logic
at once.

Cc: Daniel Mack &lt;daniel@zonque.org&gt;
Cc: Haojian Zhuang &lt;haojian.zhuang@gmail.com&gt;
Cc: Robert Jarzmik &lt;robert.jarzmik@free.fr&gt;
Link: https://lore.kernel.org/r/20230202153235.2412790-12-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: gadget: pxa25x_udc: fix memory leak with using debugfs_lookup()</title>
<updated>2023-03-11T12:50:43Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2023-02-02T15:32:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8d48a7887dbca22e064c20caf20ae7949019fe9b'/>
<id>urn:sha1:8d48a7887dbca22e064c20caf20ae7949019fe9b</id>
<content type='text'>
[ Upstream commit 7a038a681b7df78362d9fc7013e5395a694a9d3a ]

When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time.  To make things simpler, just
call debugfs_lookup_and_remove() instead which handles all of the logic
at once.

Cc: Daniel Mack &lt;daniel@zonque.org&gt;
Cc: Haojian Zhuang &lt;haojian.zhuang@gmail.com&gt;
Cc: Robert Jarzmik &lt;robert.jarzmik@free.fr&gt;
Link: https://lore.kernel.org/r/20230202153235.2412790-11-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: gadget: lpc32xx_udc: fix memory leak with using debugfs_lookup()</title>
<updated>2023-03-11T12:50:43Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2023-02-02T15:32:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=72c25eb9ae4993ccac4821354ff34eb1f32e4781'/>
<id>urn:sha1:72c25eb9ae4993ccac4821354ff34eb1f32e4781</id>
<content type='text'>
[ Upstream commit e3965acaf3739fde9d74ad82979b46d37c6c208f ]

When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time.  To make things simpler, just
call debugfs_lookup_and_remove() instead which handles all of the logic
at once.

Cc: Jakob Koschel &lt;jakobkoschel@gmail.com&gt;
Cc: Miaoqian Lin &lt;linmq006@gmail.com&gt;
Acked-by: Vladimir Zapolskiy &lt;vz@mleia.com&gt;
Link: https://lore.kernel.org/r/20230202153235.2412790-10-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: gadget: bcm63xx_udc: fix memory leak with using debugfs_lookup()</title>
<updated>2023-03-11T12:50:43Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2023-02-02T15:32:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f30c7046dfa2748520a8045bb43ed2fbca0373b5'/>
<id>urn:sha1:f30c7046dfa2748520a8045bb43ed2fbca0373b5</id>
<content type='text'>
[ Upstream commit a91c99b1fe5c6f7e52fb932ad9e57ec7cfe913ec ]

When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time.  To make things simpler, just
call debugfs_lookup_and_remove() instead which handles all of the logic
at once.

Cc: Kevin Cernekee &lt;cernekee@gmail.com&gt;
Link: https://lore.kernel.org/r/20230202153235.2412790-9-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: gadget: gr_udc: fix memory leak with using debugfs_lookup()</title>
<updated>2023-03-11T12:50:43Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2023-02-02T15:32:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0933eca15f5223b5c2412080c8c3de8758465c78'/>
<id>urn:sha1:0933eca15f5223b5c2412080c8c3de8758465c78</id>
<content type='text'>
[ Upstream commit 73f4451368663ad28daa67980c6dd11d83b303eb ]

When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time.  To make things simpler, just
call debugfs_lookup_and_remove() instead which handles all of the logic
at once.

Cc: Jakob Koschel &lt;jakobkoschel@gmail.com&gt;
Link: https://lore.kernel.org/r/20230202153235.2412790-8-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: fusb300_udc: free irq on the error path in fusb300_probe()</title>
<updated>2023-03-10T08:28:47Z</updated>
<author>
<name>Gaosheng Cui</name>
</author>
<published>2022-11-23T01:41:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2a45906e654026850c0a2600080123660290332f'/>
<id>urn:sha1:2a45906e654026850c0a2600080123660290332f</id>
<content type='text'>
[ Upstream commit a8d3392e0e5cfeb03f0cea1f2bc3f5f183c1deb4 ]

When request_irq(ires1-&gt;start) failed in w5300_hw_probe(), irq
ires-&gt;start has not been freed, and on the clean_up3 error path,
we also need to free ires1-&gt;start irq, fix it.

In addition, We should add free_irq in fusb300_remove(), and give
the lables a proper name so that they can be understood easily,
so add free_irq in fusb300_remove(), and update clean_up3 to
err_alloc_request.

Fixes: 0fe6f1d1f612 ("usb: udc: add Faraday fusb300 driver")
Signed-off-by: Gaosheng Cui &lt;cuigaosheng1@huawei.com&gt;
Link: https://lore.kernel.org/r/20221123014121.1989721-1-cuigaosheng1@huawei.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
</feed>
