<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/net/can/usb/usb_8dev.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>2021-08-04T09:58:02Z</updated>
<entry>
<title>can: usb_8dev: fix memory leak</title>
<updated>2021-08-04T09:58:02Z</updated>
<author>
<name>Pavel Skripkin</name>
</author>
<published>2021-07-27T16:59:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f61dd3dcc0422fccb2a1cb66aea65c0ffde75a4f'/>
<id>urn:sha1:f61dd3dcc0422fccb2a1cb66aea65c0ffde75a4f</id>
<content type='text'>
commit 0e865f0c31928d6a313269ef624907eec55287c4 upstream.

In usb_8dev_start() MAX_RX_URBS coherent buffers are allocated and
there is nothing, that frees them:

1) In callback function the urb is resubmitted and that's all
2) In disconnect function urbs are simply killed, but URB_FREE_BUFFER
   is not set (see usb_8dev_start) and this flag cannot be used with
   coherent buffers.

So, all allocated buffers should be freed with usb_free_coherent()
explicitly.

Side note: This code looks like a copy-paste of other can drivers. The
same patch was applied to mcba_usb driver and it works nice with real
hardware. There is no change in functionality, only clean-up code for
coherent buffers.

Fixes: 0024d8ad1639 ("can: usb_8dev: Add support for USB2CAN interface from 8 devices")
Link: https://lore.kernel.org/r/d39b458cd425a1cf7f512f340224e6e9563b07bd.1627404470.git.paskripkin@gmail.com
Cc: linux-stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Pavel Skripkin &lt;paskripkin@gmail.com&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>can: usb_8dev: fix use-after-free on disconnect</title>
<updated>2019-11-12T18:15:46Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2019-10-01T10:29:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0589de2de3c89d149e7ee0f6696ed98b22b5537c'/>
<id>urn:sha1:0589de2de3c89d149e7ee0f6696ed98b22b5537c</id>
<content type='text'>
commit 3759739426186a924675651b388d1c3963c5710e upstream.

The driver was accessing its driver data after having freed it.

Fixes: 0024d8ad1639 ("can: usb_8dev: Add support for USB2CAN interface from 8 devices")
Cc: stable &lt;stable@vger.kernel.org&gt;     # 3.9
Cc: Bernd Krumboeck &lt;b.krumboeck@gmail.com&gt;
Cc: Wolfgang Grandegger &lt;wg@grandegger.com&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>can: usb_8dev: cancel urb on -EPIPE and -EPROTO</title>
<updated>2017-12-14T08:28:10Z</updated>
<author>
<name>Martin Kelly</name>
</author>
<published>2017-12-05T19:15:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4b4e6f675846c0700fae441f30bcb18dca074af7'/>
<id>urn:sha1:4b4e6f675846c0700fae441f30bcb18dca074af7</id>
<content type='text'>
commit 12147edc434c9e4c7c2f5fee2e5519b2e5ac34ce upstream.

In mcba_usb, we have observed that when you unplug the device, the driver will
endlessly resubmit failing URBs, which can cause CPU stalls. This issue
is fixed in mcba_usb by catching the codes seen on device disconnect
(-EPIPE and -EPROTO).

This driver also resubmits in the case of -EPIPE and -EPROTO, so fix it
in the same way.

Signed-off-by: Martin Kelly &lt;mkelly@xevo.com&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>can: usb_8dev: Fix memory leak of priv-&gt;cmd_msg_buffer</title>
<updated>2017-03-12T05:41:48Z</updated>
<author>
<name>Marc Kleine-Budde</name>
</author>
<published>2017-03-02T11:03:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7afc0ee6ae73c23d8acc7a58113e269f6c1da2a2'/>
<id>urn:sha1:7afc0ee6ae73c23d8acc7a58113e269f6c1da2a2</id>
<content type='text'>
commit 7c42631376306fb3f34d51fda546b50a9b6dd6ec upstream.

The priv-&gt;cmd_msg_buffer is allocated in the probe function, but never
kfree()ed. This patch converts the kzalloc() to resource-managed
kzalloc.

Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>net: can: usb: usb_8dev: don't print error when allocating urb fails</title>
<updated>2016-08-13T21:53:39Z</updated>
<author>
<name>Wolfram Sang</name>
</author>
<published>2016-08-11T21:05:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7fe7cfa43a99056ffa52aed4053693dedc3cbbbb'/>
<id>urn:sha1:7fe7cfa43a99056ffa52aed4053693dedc3cbbbb</id>
<content type='text'>
kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang &lt;wsa-dev@sang-engineering.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>can: remove obsolete assignment for CAN protocol error type</title>
<updated>2015-11-23T08:37:38Z</updated>
<author>
<name>Oliver Hartkopp</name>
</author>
<published>2015-11-21T17:41:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a2ec19f888f1fb06e2424486423a16f86ad1fcc4'/>
<id>urn:sha1:a2ec19f888f1fb06e2424486423a16f86ad1fcc4</id>
<content type='text'>
The assignment 'cf-&gt;data[2] |= CAN_ERR_PROT_UNSPEC' used at CAN error message
creation time is obsolete as CAN_ERR_PROT_UNSPEC is zero and cf-&gt;data[2] is
initialized with zero in alloc_can_err_skb() anyway.

So we could either assign 'cf-&gt;data[2] = CAN_ERR_PROT_UNSPEC' correctly or we
can remove the obsolete OR operation entirely.

Signed-off-by: Oliver Hartkopp &lt;socketcan@hartkopp.net&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: fix assignment of error location in CAN error messages</title>
<updated>2015-11-23T08:37:34Z</updated>
<author>
<name>Oliver Hartkopp</name>
</author>
<published>2015-11-21T17:41:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ffd461f80d536336811d573f197f3e6d9872d054'/>
<id>urn:sha1:ffd461f80d536336811d573f197f3e6d9872d054</id>
<content type='text'>
As Dan Carpenter reported in http://marc.info/?l=linux-can&amp;m=144793696016187
the assignment of the error location in CAN error messages had some bit wise
overlaps. Indeed the value to be assigned in data[3] is no bitfield but defines
a single value which points to a location inside the CAN frame on the wire.

This patch fixes the assignments for the error locations in error messages.

Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Oliver Hartkopp &lt;socketcan@hartkopp.net&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: usb_8dev: don't touch skb after netif_rx()</title>
<updated>2015-07-15T07:04:28Z</updated>
<author>
<name>Marc Kleine-Budde</name>
</author>
<published>2015-07-11T19:16:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9b721a4cefcbdedadbe72b5ec405046c139cf8ad'/>
<id>urn:sha1:9b721a4cefcbdedadbe72b5ec405046c139cf8ad</id>
<content type='text'>
There is no guarantee that the skb is in the same state after calling
net_receive_skb() or netif_rx(). It might be freed or reused. Not really
harmful as its a read access, except you turn on the proper debugging options
which catch a use after free.

Cc: Bernd Krumboeck &lt;b.krumboeck@gmail.com&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: move can_stats.bus_off++ from can_bus_off into can_change_state</title>
<updated>2015-01-20T12:56:53Z</updated>
<author>
<name>Andri Yngvason</name>
</author>
<published>2015-01-16T14:30:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=be38a6f9f4093b0f1fa9e7d8cb47d588bc117c21'/>
<id>urn:sha1:be38a6f9f4093b0f1fa9e7d8cb47d588bc117c21</id>
<content type='text'>
In order to be able to move the stats increment from can_bus_off() into
can_change_state(), the increment had to be moved back into code that was using
can_bus_off() but not can_change_state().

As a side-effect, this patch fixes the following bugs:
 * Redundant call to can_bus_off() in c_can.
 * Bus-off counted twice in xilinx_can.

Signed-off-by: Andri Yngvason &lt;andri.yngvason@marel.com&gt;
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>Merge tag 'linux-can-fixes-for-3.15-20140401' of git://gitorious.org/linux-can/linux-can</title>
<updated>2014-04-01T21:49:50Z</updated>
<author>
<name>David S. Miller</name>
</author>
<published>2014-04-01T21:49:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f91ca783f11029940aa60a9a5aad4dce666e6414'/>
<id>urn:sha1:f91ca783f11029940aa60a9a5aad4dce666e6414</id>
<content type='text'>
linux-can-fixes-for-3.15-20140401

Marc Kleine-Budde says:

====================
this is a pull request of 16 patches for the 3.15 release cycle.

Bjorn Van Tilt contributes a patch which fixes a memory leak in usb_8dev's
usb_8dev_start_xmit()s error path. A patch by Robert Schwebel fixes a typo in
the can documentation. The remaining patches all target the c_can driver. Two
of them are by me; they add a missing netif_napi_del() and return value
checking. Thomas Gleixner contributes 12 patches, which address several
shortcomings in the driver like hardware initialisation, concurrency, message
ordering and poor performance.
====================

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
