<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/usb/musb, branch linux-4.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-10-26T11:15:48Z</updated>
<entry>
<title>usb: musb: Fix musb_gadget.c rxstate overflow bug</title>
<updated>2022-10-26T11:15:48Z</updated>
<author>
<name>Robin Guo</name>
</author>
<published>2022-09-06T02:21:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=826f84ab04a5cafe484ea9c2c85a3930068e5cb7'/>
<id>urn:sha1:826f84ab04a5cafe484ea9c2c85a3930068e5cb7</id>
<content type='text'>
[ Upstream commit eea4c860c3b366369eff0489d94ee4f0571d467d ]

The usb function device call musb_gadget_queue() adds the passed
request to musb_ep::req_list,If the (request-&gt;length &gt; musb_ep-&gt;packet_sz)
and (is_buffer_mapped(req) return false),the rxstate() will copy all data
in fifo to request-&gt;buf which may cause request-&gt;buf out of bounds.

Fix it by add the length check :
fifocnt = min_t(unsigned, request-&gt;length - request-&gt;actual, fifocnt);

Signed-off-by: Robin Guo &lt;guoweibin@inspur.com&gt;
Link: https://lore.kernel.org/r/20220906102119.1b071d07a8391ff115e6d1ef@inspur.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: musb: tusb6010: check return value after calling platform_get_resource()</title>
<updated>2021-11-26T10:48:40Z</updated>
<author>
<name>Yang Yingliang</name>
</author>
<published>2021-09-15T03:49:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b3f43659eb0b9af2e6ef18a8d829374610b19e7a'/>
<id>urn:sha1:b3f43659eb0b9af2e6ef18a8d829374610b19e7a</id>
<content type='text'>
[ Upstream commit 14651496a3de6807a17c310f63c894ea0c5d858e ]

It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Signed-off-by: Yang Yingliang &lt;yangyingliang@huawei.com&gt;
Link: https://lore.kernel.org/r/20210915034925.2399823-1-yangyingliang@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>
<entry>
<title>usb: musb: Balance list entry in musb_gadget_queue</title>
<updated>2021-11-12T12:18:02Z</updated>
<author>
<name>Viraj Shah</name>
</author>
<published>2021-10-21T09:36:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=69d178d1e26feba4678998079181c79e81cadbfc'/>
<id>urn:sha1:69d178d1e26feba4678998079181c79e81cadbfc</id>
<content type='text'>
commit 21b5fcdccb32ff09b6b63d4a83c037150665a83f upstream.

musb_gadget_queue() adds the passed request to musb_ep::req_list. If the
endpoint is idle and it is the first request then it invokes
musb_queue_resume_work(). If the function returns an error then the
error is passed to the caller without any clean-up and the request
remains enqueued on the list. If the caller enqueues the request again
then the list corrupts.

Remove the request from the list on error.

Fixes: ea2f35c01d5ea ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Viraj Shah &lt;viraj.shah@linutronix.de&gt;
Link: https://lore.kernel.org/r/20211021093644.4734-1-viraj.shah@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: musb: tusb6010: uninitialized data in tusb_fifo_write_unaligned()</title>
<updated>2021-10-06T08:23:38Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2021-09-16T13:57:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2a6992e7a05677bfcfd7e60498fe52831fbb3da7'/>
<id>urn:sha1:2a6992e7a05677bfcfd7e60498fe52831fbb3da7</id>
<content type='text'>
commit 517c7bf99bad3d6b9360558414aae634b7472d80 upstream.

This is writing to the first 1 - 3 bytes of "val" and then writing all
four bytes to musb_writel().  The last byte is always going to be
garbage.  Zero out the last bytes instead.

Fixes: 550a7375fe72 ("USB: Add MUSB and TUSB support")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Link: https://lore.kernel.org/r/20210916135737.GI25094@kili
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: musb: Fix runtime PM race in musb_queue_resume_work</title>
<updated>2021-03-03T16:44:41Z</updated>
<author>
<name>Paul Cercueil</name>
</author>
<published>2021-01-23T14:24:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=046f347755a3557387984ade430f796efdc6c998'/>
<id>urn:sha1:046f347755a3557387984ade430f796efdc6c998</id>
<content type='text'>
commit 0eaa1a3714db34a59ce121de5733c3909c529463 upstream.

musb_queue_resume_work() would call the provided callback if the runtime
PM status was 'active'. Otherwise, it would enqueue the request if the
hardware was still suspended (musb-&gt;is_runtime_suspended is true).

This causes a race with the runtime PM handlers, as it is possible to be
in the case where the runtime PM status is not yet 'active', but the
hardware has been awaken (PM resume function has been called).

When hitting the race, the resume work was not enqueued, which probably
triggered other bugs further down the stack. For instance, a telnet
connection on Ingenic SoCs would result in a 50/50 chance of a
segmentation fault somewhere in the musb code.

Rework the code so that either we call the callback directly if
(musb-&gt;is_runtime_suspended == 0), or enqueue the query otherwise.

Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
Cc: stable@vger.kernel.org # v4.9+
Tested-by: Tony Lindgren &lt;tony@atomide.com&gt;
Reviewed-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Paul Cercueil &lt;paul@crapouillou.net&gt;
Link: https://lore.kernel.org/r/20210123142502.16980-1-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: musb: Fix runtime PM imbalance on error</title>
<updated>2020-06-11T07:22:22Z</updated>
<author>
<name>Dinghao Liu</name>
</author>
<published>2020-05-25T02:50:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=74d904c16dfe2583fc578cc3b0ada8ce395a3714'/>
<id>urn:sha1:74d904c16dfe2583fc578cc3b0ada8ce395a3714</id>
<content type='text'>
commit e4befc121df03dc8ed2ac1031c98f9538e244bae upstream.

When copy_from_user() returns an error code, there
is a runtime PM usage counter imbalance.

Fix this by moving copy_from_user() to the beginning
of this function.

Fixes: 7b6c1b4c0e1e ("usb: musb: fix runtime PM in debugfs")

Signed-off-by: Dinghao Liu &lt;dinghao.liu@zju.edu.cn&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu &lt;b-liu@ti.com&gt;
Link: https://lore.kernel.org/r/20200525025049.3400-7-b-liu@ti.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: musb: fix crash with highmen PIO and usbmon</title>
<updated>2020-04-02T15:20:37Z</updated>
<author>
<name>Mans Rullgard</name>
</author>
<published>2020-03-16T21:11:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=edc87d9f7f76f88fe27b007f605f10df838ee413'/>
<id>urn:sha1:edc87d9f7f76f88fe27b007f605f10df838ee413</id>
<content type='text'>
commit 52974d94a206ce428d9d9b6eaa208238024be82a upstream.

When handling a PIO bulk transfer with highmem buffer, a temporary
mapping is assigned to urb-&gt;transfer_buffer.  After the transfer is
complete, an invalid address is left behind in this pointer.  This is
not ordinarily a problem since nothing touches that buffer before the
urb is released.  However, when usbmon is active, usbmon_urb_complete()
calls (indirectly) mon_bin_get_data() which does access the transfer
buffer if it is set.  To prevent an invalid memory access here, reset
urb-&gt;transfer_buffer to NULL when finished (musb_host_rx()), or do not
set it at all (musb_host_tx()).

Fixes: 8e8a55165469 ("usb: musb: host: Handle highmem in PIO mode")
Signed-off-by: Mans Rullgard &lt;mans@mansr.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu &lt;b-liu@ti.com&gt;
Link: https://lore.kernel.org/r/20200316211136.2274-8-b-liu@ti.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: musb: omap2430: Get rid of musb .set_vbus for omap2430 glue</title>
<updated>2020-02-28T14:42:34Z</updated>
<author>
<name>Tony Lindgren</name>
</author>
<published>2020-01-15T13:25:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c2ddc19a9614e9ff9bee880cac8a2f4915f255db'/>
<id>urn:sha1:c2ddc19a9614e9ff9bee880cac8a2f4915f255db</id>
<content type='text'>
[ Upstream commit 91b6dec32e5c25fbdbb564d1e5af23764ec17ef1 ]

We currently have musb_set_vbus() called from two different paths. Mostly
it gets called from the USB PHY via omap_musb_set_mailbox(), but in some
cases it can get also called from musb_stage0_irq() rather via .set_vbus:

(musb_set_host [musb_hdrc])
(omap2430_musb_set_vbus [omap2430])
(musb_stage0_irq [musb_hdrc])
(musb_interrupt [musb_hdrc])
(omap2430_musb_interrupt [omap2430])

This is racy and will not work with introducing generic helper functions
for musb_set_host() and musb_set_peripheral(). We want to get rid of the
busy loops in favor of usleep_range().

Let's just get rid of .set_vbus for omap2430 glue layer and let the PHY
code handle VBUS with musb_set_vbus(). Note that in the follow-up patch
we can completely remove omap2430_musb_set_vbus(), but let's do it in a
separate patch as this change may actually turn out to be needed as a
fix.

Reported-by: Pavel Machek &lt;pavel@ucw.cz&gt;
Acked-by: Pavel Machek &lt;pavel@ucw.cz&gt;
Signed-off-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Bin Liu &lt;b-liu@ti.com&gt;
Link: https://lore.kernel.org/r/20200115132547.364-5-b-liu@ti.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: musb: dma: Correct parameter passed to IRQ handler</title>
<updated>2020-01-14T19:04:29Z</updated>
<author>
<name>Paul Cercueil</name>
</author>
<published>2019-12-16T16:18:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6aacfedbd0b6af1c9823e3250435d17622b7a6d7'/>
<id>urn:sha1:6aacfedbd0b6af1c9823e3250435d17622b7a6d7</id>
<content type='text'>
commit c80d0f4426c7fdc7efd6ae8d8b021dcfc89b4254 upstream.

The IRQ handler was passed a pointer to a struct dma_controller, but the
argument was then casted to a pointer to a struct musb_dma_controller.

Fixes: 427c4f333474 ("usb: struct device - replace bus_id with dev_name(), dev_set_name()")
Signed-off-by: Paul Cercueil &lt;paul@crapouillou.net&gt;
Tested-by: Artur Rojek &lt;contact@artur-rojek.eu&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu &lt;b-liu@ti.com&gt;
Link: https://lore.kernel.org/r/20191216161844.772-2-b-liu@ti.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: musb: Disable pullup at init</title>
<updated>2020-01-14T19:04:29Z</updated>
<author>
<name>Paul Cercueil</name>
</author>
<published>2020-01-07T15:26:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=962e04ba8442d86cc5b5d38b343d2a72ebc87fdd'/>
<id>urn:sha1:962e04ba8442d86cc5b5d38b343d2a72ebc87fdd</id>
<content type='text'>
commit 96a0c12843109e5c4d5eb1e09d915fdd0ce31d25 upstream.

The pullup may be already enabled before the driver is initialized. This
happens for instance on JZ4740.

It has to be disabled at init time, as we cannot guarantee that a gadget
driver will be bound to the UDC.

Signed-off-by: Paul Cercueil &lt;paul@crapouillou.net&gt;
Suggested-by: Bin Liu &lt;b-liu@ti.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu &lt;b-liu@ti.com&gt;
Link: https://lore.kernel.org/r/20200107152625.857-3-b-liu@ti.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
