<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/usb/serial/mos7720.c, branch v4.9.331</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.9.331</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.9.331'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2021-09-22T09:42:56+00:00</updated>
<entry>
<title>USB: serial: mos7720: improve OOM-handling in read_mos_reg()</title>
<updated>2021-09-22T09:42:56+00:00</updated>
<author>
<name>Tom Rix</name>
<email>trix@redhat.com</email>
</author>
<published>2021-01-11T22:09:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f29268ea24baaed3bb0d72a9de28787991abf938'/>
<id>urn:sha1:f29268ea24baaed3bb0d72a9de28787991abf938</id>
<content type='text'>
commit 161a582bd1d8681095f158d11bc679a58f1d026b upstream.

clang static analysis reports this problem

mos7720.c:352:2: warning: Undefined or garbage value returned to caller
        return d;
        ^~~~~~~~

In the parport_mos7715_read_data()'s call to read_mos_reg(), 'd' is
only set after the alloc block.

	buf = kmalloc(1, GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

Although the problem is reported in parport_most7715_read_data(),
none of the callee's of read_mos_reg() check the return status.

Make sure to clear the return-value buffer also on allocation failures.

Fixes: 0d130367abf5 ("USB: serial: mos7720: fix control-message error handling")
Signed-off-by: Tom Rix &lt;trix@redhat.com&gt;
Link: https://lore.kernel.org/r/20210111220904.1035957-1-trix@redhat.com
[ johan: only clear the buffer on errors, amend commit message ]
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: mos7720: fix error code in mos7720_write()</title>
<updated>2021-03-03T16:44:42+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2021-01-28T09:35:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9c246cac2dd1359ab4f64aec95b13ae5638ff3cb'/>
<id>urn:sha1:9c246cac2dd1359ab4f64aec95b13ae5638ff3cb</id>
<content type='text'>
commit fea7372cbc40869876df0f045e367f6f97a1666c upstream.

This code should return -ENOMEM if the kmalloc() fails but instead
it returns success.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Fixes: 0f64478cbc7a ("USB: add USB serial mos7720 driver")
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: mos7720: fix parallel-port state restore</title>
<updated>2020-12-29T12:45:04+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2020-11-04T16:47:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=88b8bcc5edc5772ebad782fa3fcbb90a0bd229c6'/>
<id>urn:sha1:88b8bcc5edc5772ebad782fa3fcbb90a0bd229c6</id>
<content type='text'>
commit 975323ab8f116667676c30ca3502a6757bd89e8d upstream.

The parallel-port restore operations is called when a driver claims the
port and is supposed to restore the provided state (e.g. saved when
releasing the port).

Fixes: b69578df7e98 ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
Cc: stable &lt;stable@vger.kernel.org&gt;     # 2.6.35
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>USB: serial: mos7720: fix remote wakeup</title>
<updated>2019-11-28T17:29:05+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2019-11-07T13:21:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b5c3841527da31210da81a45a7a95f592010dc95'/>
<id>urn:sha1:b5c3841527da31210da81a45a7a95f592010dc95</id>
<content type='text'>
commit ea422312a462696093b5db59d294439796cba4ad upstream.

The driver was setting the device remote-wakeup feature during probe in
violation of the USB specification (which says it should only be set
just prior to suspending the device). This could potentially waste
power during suspend as well as lead to spurious wakeups.

Note that USB core would clear the remote-wakeup feature at first
resume.

Fixes: 0f64478cbc7a ("USB: add USB serial mos7720 driver")
Cc: stable &lt;stable@vger.kernel.org&gt;     # 2.6.19
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>USB: serial: mos7720: fix mos_parport refcount imbalance on error path</title>
<updated>2019-04-03T04:24:18+00:00</updated>
<author>
<name>Lin Yi</name>
<email>teroincn@163.com</email>
</author>
<published>2019-03-20T11:04:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bc9b45861deb0d7d8f8a91eca35dea0466825a85'/>
<id>urn:sha1:bc9b45861deb0d7d8f8a91eca35dea0466825a85</id>
<content type='text'>
commit 2908b076f5198d231de62713cb2b633a3a4b95ac upstream.

The write_parport_reg_nonblock() helper takes a reference to the struct
mos_parport, but failed to release it in a couple of error paths after
allocation failures, leading to a memory leak.

Johan said that move the kref_get() and mos_parport assignment to the
end of urbtrack initialisation is a better way, so move it. and
mos_parport do not used until urbtrack initialisation.

Signed-off-by: Lin Yi &lt;teroincn@163.com&gt;
Fixes: b69578df7e98 ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
Cc: stable &lt;stable@vger.kernel.org&gt;     # 2.6.35
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>USB: serial: mos7720: fix control-message error handling</title>
<updated>2017-10-08T08:26:06+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2017-01-12T13:56:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9553708eb98dd81357eb9be51b6317387d2e7ac4'/>
<id>urn:sha1:9553708eb98dd81357eb9be51b6317387d2e7ac4</id>
<content type='text'>
[ Upstream commit 0d130367abf582e7cbf60075c2a7ab53817b1d14 ]

Make sure to log an error on short transfers when reading a device
register.

Also clear the provided buffer (which if often an uninitialised
automatic variable) on errors as the driver currently does not bother to
check for errors.

Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: mos7720: fix parallel probe</title>
<updated>2017-01-12T10:39:16+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2017-01-03T15:39:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1bd67e85edf1826afbc592028bce941e0425f2dc'/>
<id>urn:sha1:1bd67e85edf1826afbc592028bce941e0425f2dc</id>
<content type='text'>
commit fde1faf872ed86d88e245191bc15a8e57368cd1c upstream.

A static usb-serial-driver structure that is used to initialise the
interrupt URB was modified during probe depending on the currently
probed device type, something which could break a parallel probe of a
device of a different type.

Fix this up by overriding the default completion callback for MCS7715
devices in attach() instead. We may want to use two usb-serial driver
instances for the two types later.

Fixes: fb088e335d78 ("USB: serial: add support for serial port on the moschip 7715")
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>USB: serial: mos7720: fix parport use-after-free on probe errors</title>
<updated>2017-01-12T10:39:16+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2017-01-03T15:39:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6ea44fb2183c6e4c4c7888e35498717f9d637c39'/>
<id>urn:sha1:6ea44fb2183c6e4c4c7888e35498717f9d637c39</id>
<content type='text'>
commit 75dd211e773afcbc264677b0749d1cf7d937ab2d upstream.

Do not submit the interrupt URB until after the parport has been
successfully registered to avoid another use-after-free in the
completion handler when accessing the freed parport private data in case
of a racing completion.

Fixes: b69578df7e98 ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>USB: serial: mos7720: fix use-after-free on probe errors</title>
<updated>2017-01-12T10:39:16+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2017-01-03T15:39:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e7cf756c89326f8dcee8a109d092d73acc59d72e'/>
<id>urn:sha1:e7cf756c89326f8dcee8a109d092d73acc59d72e</id>
<content type='text'>
commit 91a1ff4d53c5184d383d0baeeaeab6f9736f2ff3 upstream.

The interrupt URB was submitted on probe but never stopped on probe
errors. This can lead to use-after-free issues in the completion
handler when accessing the freed usb-serial struct:

Unable to handle kernel paging request at virtual address 6b6b6be7
...
[&lt;bf052e70&gt;] (mos7715_interrupt_callback [mos7720]) from [&lt;c052a894&gt;] (__usb_hcd_giveback_urb+0x80/0x140)
[&lt;c052a894&gt;] (__usb_hcd_giveback_urb) from [&lt;c052a9a4&gt;] (usb_hcd_giveback_urb+0x50/0x138)
[&lt;c052a9a4&gt;] (usb_hcd_giveback_urb) from [&lt;c0550684&gt;] (musb_giveback+0xc8/0x1cc)

Fixes: b69578df7e98 ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>USB: serial: mos7720: fix NULL-deref at open</title>
<updated>2017-01-12T10:39:16+00:00</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2017-01-03T15:39:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ac81f1fa956f217b5a111631b81e7d7c9b6ebd73'/>
<id>urn:sha1:ac81f1fa956f217b5a111631b81e7d7c9b6ebd73</id>
<content type='text'>
commit b05aebc25fdc5aeeac3ee29f0dc9f58dd07c13cc upstream.

Fix NULL-pointer dereference at port open if a device lacks the expected
bulk in and out endpoints.

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
[&lt;bf071c20&gt;] (mos7720_open [mos7720]) from [&lt;bf0490e0&gt;] (serial_port_activate+0x68/0x98 [usbserial])
[&lt;bf0490e0&gt;] (serial_port_activate [usbserial]) from [&lt;c0470ca4&gt;] (tty_port_open+0x9c/0xe8)
[&lt;c0470ca4&gt;] (tty_port_open) from [&lt;bf049d98&gt;] (serial_open+0x48/0x6c [usbserial])
[&lt;bf049d98&gt;] (serial_open [usbserial]) from [&lt;c0469178&gt;] (tty_open+0xcc/0x5cc)

Fixes: 0f64478cbc7a ("USB: add USB serial mos7720 driver")
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
