<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/usb/gadget/function/rndis.c, 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-03-23T08:00:34Z</updated>
<entry>
<title>usb: gadget: rndis: prevent integer overflow in rndis_set_response()</title>
<updated>2022-03-23T08:00:34Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2022-03-01T08:04:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8b3e4d26bc9cd0f6373d0095b9ffd99e7da8006b'/>
<id>urn:sha1:8b3e4d26bc9cd0f6373d0095b9ffd99e7da8006b</id>
<content type='text'>
commit 65f3324f4b6fed78b8761c3b74615ecf0ffa81fa upstream.

If "BufOffset" is very large the "BufOffset + 8" operation can have an
integer overflow.

Cc: stable@kernel.org
Fixes: 38ea1eac7d88 ("usb: gadget: rndis: check size of RNDIS_MSG_SET command")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Link: https://lore.kernel.org/r/20220301080424.GA17208@kili
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: rndis: add spinlock for rndis response list</title>
<updated>2022-03-02T10:32:04Z</updated>
<author>
<name>Daehwan Jung</name>
</author>
<published>2022-02-22T05:29:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9f5d8ba538ef81cd86ea587ca3f8c77e26bea405'/>
<id>urn:sha1:9f5d8ba538ef81cd86ea587ca3f8c77e26bea405</id>
<content type='text'>
commit aaaba1c86d04dac8e49bf508b492f81506257da3 upstream.

There's no lock for rndis response list. It could cause list corruption
if there're two different list_add at the same time like below.
It's better to add in rndis_add_response / rndis_free_response
/ rndis_get_next_response to prevent any race condition on response list.

[  361.894299] [1:   irq/191-dwc3:16979] list_add corruption.
next-&gt;prev should be prev (ffffff80651764d0),
but was ffffff883dc36f80. (next=ffffff80651764d0).

[  361.904380] [1:   irq/191-dwc3:16979] Call trace:
[  361.904391] [1:   irq/191-dwc3:16979]  __list_add_valid+0x74/0x90
[  361.904401] [1:   irq/191-dwc3:16979]  rndis_msg_parser+0x168/0x8c0
[  361.904409] [1:   irq/191-dwc3:16979]  rndis_command_complete+0x24/0x84
[  361.904417] [1:   irq/191-dwc3:16979]  usb_gadget_giveback_request+0x20/0xe4
[  361.904426] [1:   irq/191-dwc3:16979]  dwc3_gadget_giveback+0x44/0x60
[  361.904434] [1:   irq/191-dwc3:16979]  dwc3_ep0_complete_data+0x1e8/0x3a0
[  361.904442] [1:   irq/191-dwc3:16979]  dwc3_ep0_interrupt+0x29c/0x3dc
[  361.904450] [1:   irq/191-dwc3:16979]  dwc3_process_event_entry+0x78/0x6cc
[  361.904457] [1:   irq/191-dwc3:16979]  dwc3_process_event_buf+0xa0/0x1ec
[  361.904465] [1:   irq/191-dwc3:16979]  dwc3_thread_interrupt+0x34/0x5c

Fixes: f6281af9d62e ("usb: gadget: rndis: use list_for_each_entry_safe")
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Daehwan Jung &lt;dh10.jung@samsung.com&gt;
Link: https://lore.kernel.org/r/1645507768-77687-1-git-send-email-dh10.jung@samsung.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: rndis: check size of RNDIS_MSG_SET command</title>
<updated>2022-02-16T11:43:54Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2022-02-09T15:37:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ff0a90739925734c91c7e39befe3f4378e0c1369'/>
<id>urn:sha1:ff0a90739925734c91c7e39befe3f4378e0c1369</id>
<content type='text'>
commit 38ea1eac7d88072bbffb630e2b3db83ca649b826 upstream.

Check the size of the RNDIS_MSG_SET command given to us before
attempting to respond to an invalid message size.

Reported-by: Szymon Heidrich &lt;szymon.heidrich@gmail.com&gt;
Cc: stable@kernel.org
Tested-by: Szymon Heidrich &lt;szymon.heidrich@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: rndis: free response queue during REMOTE_NDIS_RESET_MSG</title>
<updated>2016-08-11T12:09:48Z</updated>
<author>
<name>Xerox Lin</name>
</author>
<published>2016-06-29T09:04:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=207707d8fd48ebc977fb2b2794004a020e1ee08e'/>
<id>urn:sha1:207707d8fd48ebc977fb2b2794004a020e1ee08e</id>
<content type='text'>
When rndis data transfer is in progress, some Windows7 Host PC is not
sending the GET_ENCAPSULATED_RESPONSE command for receiving the response
for the previous SEND_ENCAPSULATED_COMMAND processed.

The rndis function driver appends each response for the
SEND_ENCAPSULATED_COMMAND in a queue. As the above process got corrupted,
the Host sends a REMOTE_NDIS_RESET_MSG command to do a soft-reset.
As the rndis response queue is not freed, the previous response is sent
as a part of this REMOTE_NDIS_RESET_MSG's reset response and the Host
block any more Rndis transfers.

Hence free the rndis response queue as a part of this soft-reset so that
the correct response for REMOTE_NDIS_RESET_MSG is sent properly during the
response command.

Signed-off-by: Rajkumar Raghupathy &lt;raghup@codeaurora.org&gt;
Signed-off-by: Xerox Lin &lt;xerox_lin@htc.com&gt;
[AmitP: Cherry-picked this patch and folded other relevant
        fixes from Android common kernel android-4.4]
Signed-off-by: Amit Pundir &lt;amit.pundir@linaro.org&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>usb: gadget: rndis: fix itnull.cocci warnings</title>
<updated>2016-02-03T21:36:04Z</updated>
<author>
<name>Julia Lawall</name>
</author>
<published>2016-01-25T15:21:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1c17a353c5a8346b1ce128c60ffb862d156f7e7e'/>
<id>urn:sha1:1c17a353c5a8346b1ce128c60ffb862d156f7e7e</id>
<content type='text'>
The index variable of list_for_each_entry_safe is an offset from a list
pointer, and thus should not be NULL.

Generated by: scripts/coccinelle/iterators/itnull.cocci

CC: Geliang Tang &lt;geliangtang@163.com&gt;
Signed-off-by: Fengguang Wu &lt;fengguang.wu@intel.com&gt;
Signed-off-by: Julia Lawall &lt;julia.lawall@lip6.fr&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: rndis: use list_for_each_entry_safe</title>
<updated>2016-01-25T04:55:33Z</updated>
<author>
<name>Geliang Tang</name>
</author>
<published>2015-12-18T16:34:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f6281af9d62e128aa6efad29cf7265062af114f2'/>
<id>urn:sha1:f6281af9d62e128aa6efad29cf7265062af114f2</id>
<content type='text'>
Use list_for_each_entry_safe() instead of list_for_each_safe() to
simplify the code.

Signed-off-by: Geliang Tang &lt;geliangtang@163.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: rndis: use signed type for a signed value</title>
<updated>2015-05-21T21:29:14Z</updated>
<author>
<name>Andrzej Pietrasiewicz</name>
</author>
<published>2015-05-18T15:40:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=81dff8692865292aa70ec3fd93489ae9f33f709e'/>
<id>urn:sha1:81dff8692865292aa70ec3fd93489ae9f33f709e</id>
<content type='text'>
rndis_get_nr() returns either a non-negative value on success
or a negative value on failure. In case of failure an error code
is returned to the caller of rndis_register().
If the "i" is unsigned, the information about error from rndis_get_nr()
is lost. If there is no error but rndis_get_nr() returns a value greater
than 256 the least significant bits of i are zero effectively limiting the
number of configs to 256.

This patch fixes that.

Signed-off-by: Andrzej Pietrasiewicz &lt;andrzej.p@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: gadget: rndis: don't duplicate the "i" variable</title>
<updated>2015-05-21T21:29:05Z</updated>
<author>
<name>Andrzej Pietrasiewicz</name>
</author>
<published>2015-05-18T15:40:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c0d96af2e0427cc90b1f0d3c6a5294d90f93fcf4'/>
<id>urn:sha1:c0d96af2e0427cc90b1f0d3c6a5294d90f93fcf4</id>
<content type='text'>
If CONFIG_USB_GADGET_DEBUG_FILES is set then a block is opened and inside
it there is a local variable "i" which hides the "i" local to the
rndis_deregister(). Consequently, a random value is formatted
into the "name" buffer.

This patch removes the block-local i.

Signed-off-by: Andrzej Pietrasiewicz &lt;andrzej.p@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: gadget: rndis: change the value passed to rndis_signal_(dis)connect()</title>
<updated>2015-05-21T21:28:55Z</updated>
<author>
<name>Andrzej Pietrasiewicz</name>
</author>
<published>2015-05-18T15:40:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=868055fdd2399cbb0cb3fe0cd7b5047a3a77b8b9'/>
<id>urn:sha1:868055fdd2399cbb0cb3fe0cd7b5047a3a77b8b9</id>
<content type='text'>
The patch:

83210e59ee1527f229af6aef78c95b747bdcf9c4
usb: gadget: rndis: use rndis_params instead of configNr

should change all invocations of rndis_signal_(dis)connect().
This patch fixes that.

Signed-off-by: Andrzej Pietrasiewicz &lt;andrzej.p@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: gadget: rndis: remove the limit of available rndis connections</title>
<updated>2015-05-07T18:47:17Z</updated>
<author>
<name>Andrzej Pietrasiewicz</name>
</author>
<published>2015-02-06T12:43:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d6d22922d9070b660e3dce0a87a94f0b581e803e'/>
<id>urn:sha1:d6d22922d9070b660e3dce0a87a94f0b581e803e</id>
<content type='text'>
RNDIS function has a limitation on the number of allowed instances.
So far it has been RNDIS_MAX_CONFIGS, which happens to be one.
In order to eliminate this kind of arbitrary limitation we should not
preallocate a predefined (RNDIS_MAX_CONFIGS) array of struct rndis_params
instances but instead allow allocating them on demand.

This patch allocates struct rndis_params on demand in rndis_register().
Coversly, the structure is free()'d in rndis_deregister().
If CONFIG_USB_GADGET_DEBUG_FILES is set, the proc files are created which
is the same behaviour as before, but the moment of creation is delayed
until struct rndis_params is actually allocated.

rnids_init() and rndis_exit() have nothing to do, so they are eliminated.

Signed-off-by: Andrzej Pietrasiewicz &lt;andrzej.p@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
</feed>
