All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -stable 0/3] Bugfixes for the kvaser_usb module
@ 2015-03-21  2:03 Ahmed S. Darwish
  2015-03-21  2:03 ` [PATCH -stable 1/3] can: kvaser_usb: Avoid double free on URB submission failures Ahmed S. Darwish
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ahmed S. Darwish @ 2015-03-21  2:03 UTC (permalink / raw)
  To: Marc Kleine-Budde, Olivier Sobrie; +Cc: Linux-CAN, Ahmed S. Darwish

From: "Ahmed S. Darwish" <ahmed.darwish@valeo.com>

Hi Marc,

This is a series of kvaser_usb bugfixes, backported for -stable
and generated against v3.19. It should apply cleanly on most
of the -stable kernel trees out there.

The patches needed simple backporting since `kvaser_usb' in all
earlier kernels does not have the can_change_state() changes or
the extra code for USBCan-II hardware models.

Each patch contains a reference in its log to the corresponding
upstream commit.

I've verified that each patch matches exactly, _hunk for hunk_,
its corresponding upstream commit. Nonetheless, I don't have a
pure Kvaser Leaf hardware at hand; someone with a Leaf-based
model should give them a quick smoke test (Olivier Sobrie?)

Thanks,

Ahmed S. Darwish (3):
  can: kvaser_usb: Avoid double free on URB submission failures
  can: kvaser_usb: Read all messages in a bulk-in URB buffer
  can: kvaser_usb: Fix tx queue start/stop race conditions

 drivers/net/can/usb/kvaser_usb.c |  131 ++++++++++++++++++++++++--------------
 1 files changed, 82 insertions(+), 49 deletions(-)

-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH -stable 1/3] can: kvaser_usb: Avoid double free on URB submission failures
  2015-03-21  2:03 [PATCH -stable 0/3] Bugfixes for the kvaser_usb module Ahmed S. Darwish
@ 2015-03-21  2:03 ` Ahmed S. Darwish
  2015-03-26  7:46   ` Marc Kleine-Budde
  2015-03-21  2:03 ` [PATCH -stable 2/3] can: kvaser_usb: Read all messages in a bulk-in URB buffer Ahmed S. Darwish
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Ahmed S. Darwish @ 2015-03-21  2:03 UTC (permalink / raw)
  To: Marc Kleine-Budde, Olivier Sobrie; +Cc: Linux-CAN, Ahmed S. Darwish

From: "Ahmed S. Darwish" <ahmed.darwish@valeo.com>

Upon a URB submission failure, the driver calls usb_free_urb()
but then manually frees the URB buffer by itself.  Meanwhile
usb_free_urb() has alredy freed out that transfer buffer since
we're the only code path holding a reference to this URB.

Remove two of such invalid manual free().

This is a backport of upstream commit: deb2701cf704a2

Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
---
 drivers/net/can/usb/kvaser_usb.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 7af379c..db43c5a 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -595,7 +595,6 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv,
 		netdev_err(netdev, "Error transmitting URB\n");
 		usb_unanchor_urb(urb);
 		usb_free_urb(urb);
-		kfree(buf);
 		return err;
 	}
 
@@ -1278,8 +1277,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	struct urb *urb;
 	void *buf;
 	struct kvaser_msg *msg;
-	int i, err;
-	int ret = NETDEV_TX_OK;
+	int i, err, ret = NETDEV_TX_OK;
 
 	if (can_dropped_invalid_skb(netdev, skb))
 		return NETDEV_TX_OK;
@@ -1296,7 +1294,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	if (!buf) {
 		stats->tx_dropped++;
 		dev_kfree_skb(skb);
-		goto nobufmem;
+		goto freeurb;
 	}
 
 	msg = buf;
@@ -1333,8 +1331,10 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	/* This should never happen; it implies a flow control bug */
 	if (!context) {
 		netdev_warn(netdev, "cannot find free context\n");
+
+		kfree(buf);
 		ret =  NETDEV_TX_BUSY;
-		goto releasebuf;
+		goto freeurb;
 	}
 
 	context->priv = priv;
@@ -1371,16 +1371,12 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 		else
 			netdev_warn(netdev, "Failed tx_urb %d\n", err);
 
-		goto releasebuf;
+		goto freeurb;
 	}
 
-	usb_free_urb(urb);
-
-	return NETDEV_TX_OK;
+	ret = NETDEV_TX_OK;
 
-releasebuf:
-	kfree(buf);
-nobufmem:
+freeurb:
 	usb_free_urb(urb);
 	return ret;
 }
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH -stable 2/3] can: kvaser_usb: Read all messages in a bulk-in URB buffer
  2015-03-21  2:03 [PATCH -stable 0/3] Bugfixes for the kvaser_usb module Ahmed S. Darwish
  2015-03-21  2:03 ` [PATCH -stable 1/3] can: kvaser_usb: Avoid double free on URB submission failures Ahmed S. Darwish
@ 2015-03-21  2:03 ` Ahmed S. Darwish
  2015-03-21  2:03 ` [PATCH -stable 3/3] can: kvaser_usb: Fix tx queue start/stop race conditions Ahmed S. Darwish
  2015-03-26  7:46 ` [PATCH -stable 0/3] Bugfixes for the kvaser_usb module Marc Kleine-Budde
  3 siblings, 0 replies; 6+ messages in thread
From: Ahmed S. Darwish @ 2015-03-21  2:03 UTC (permalink / raw)
  To: Marc Kleine-Budde, Olivier Sobrie; +Cc: Linux-CAN, Ahmed S. Darwish

From: "Ahmed S. Darwish" <ahmed.darwish@valeo.com>

The Kvaser firmware can only read and write messages that are
not crossing the USB endpoint's wMaxPacketSize boundary. While
receiving commands from the CAN device, if the next command in
the same URB buffer crossed that max packet size boundary, the
firmware puts a zero-length placeholder command in its place
then moves the real command to the next boundary mark.

The driver did not recognize such behavior, leading to missing
a good number of rx events during a heavy rx load session.

Moreover, a tx URB context only gets freed upon receiving its
respective tx ACK event. Over time, the free tx URB contexts
pool gets depleted due to the missing ACK events. Consequently,
the netif transmission queue gets __permanently__ stopped; no
frames could be sent again except after restarting the CAN
newtwork interface.

This is a backport of upstream commit: 2fec5104f9c61d

Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
---
 drivers/net/can/usb/kvaser_usb.c |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index db43c5a..ba651a2 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -12,6 +12,7 @@
  * Copyright (C) 2012 Olivier Sobrie <olivier@sobrie.be>
  */
 
+#include <linux/kernel.h>
 #include <linux/completion.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
@@ -403,8 +404,15 @@ static int kvaser_usb_wait_msg(const struct kvaser_usb *dev, u8 id,
 		while (pos <= actual_len - MSG_HEADER_LEN) {
 			tmp = buf + pos;
 
-			if (!tmp->len)
-				break;
+			/* Handle messages crossing the USB endpoint max packet
+			 * size boundary. Check kvaser_usb_read_bulk_callback()
+			 * for further details.
+			 */
+			if (tmp->len == 0) {
+				pos = round_up(pos,
+					       dev->bulk_in->wMaxPacketSize);
+				continue;
+			}
 
 			if (pos + tmp->len > actual_len) {
 				dev_err(dev->udev->dev.parent,
@@ -979,8 +987,19 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb)
 	while (pos <= urb->actual_length - MSG_HEADER_LEN) {
 		msg = urb->transfer_buffer + pos;
 
-		if (!msg->len)
-			break;
+		/* The Kvaser firmware can only read and write messages that
+		 * does not cross the USB's endpoint wMaxPacketSize boundary.
+		 * If a follow-up command crosses such boundary, firmware puts
+		 * a placeholder zero-length command in its place then aligns
+		 * the real command to the next max packet size.
+		 *
+		 * Handle such cases or we're going to miss a significant
+		 * number of events in case of a heavy rx load on the bus.
+		 */
+		if (msg->len == 0) {
+			pos = round_up(pos, dev->bulk_in->wMaxPacketSize);
+			continue;
+		}
 
 		if (pos + msg->len > urb->actual_length) {
 			dev_err(dev->udev->dev.parent, "Format error\n");
@@ -988,7 +1007,6 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb)
 		}
 
 		kvaser_usb_handle_message(dev, msg);
-
 		pos += msg->len;
 	}
 
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH -stable 3/3] can: kvaser_usb: Fix tx queue start/stop race conditions
  2015-03-21  2:03 [PATCH -stable 0/3] Bugfixes for the kvaser_usb module Ahmed S. Darwish
  2015-03-21  2:03 ` [PATCH -stable 1/3] can: kvaser_usb: Avoid double free on URB submission failures Ahmed S. Darwish
  2015-03-21  2:03 ` [PATCH -stable 2/3] can: kvaser_usb: Read all messages in a bulk-in URB buffer Ahmed S. Darwish
@ 2015-03-21  2:03 ` Ahmed S. Darwish
  2015-03-26  7:46 ` [PATCH -stable 0/3] Bugfixes for the kvaser_usb module Marc Kleine-Budde
  3 siblings, 0 replies; 6+ messages in thread
From: Ahmed S. Darwish @ 2015-03-21  2:03 UTC (permalink / raw)
  To: Marc Kleine-Budde, Olivier Sobrie; +Cc: Linux-CAN, Ahmed S. Darwish

From: "Ahmed S. Darwish" <ahmed.darwish@valeo.com>

A number of tx queue wake-up events went missing due to the
outlined scenario below. Start state is a pool of 16 tx URBs,
active tx_urbs count = 15, with the netdev tx queue open.

CPU #1 [softirq]                         CPU #2 [softirq]
start_xmit()                             tx_acknowledge()
................                         ................

atomic_inc(&tx_urbs);
if (atomic_read(&tx_urbs) >= 16) {
                        -->
                                         atomic_dec(&tx_urbs);
                                         netif_wake_queue();
                                         return;
                        <--
    netif_stop_queue();
}

At the end, the correct state expected is a 15 tx_urbs count
value with the tx queue state _open_. Due to the race, we get
the same tx_urbs value but with the tx queue state _stopped_.
The wake-up event is completely lost.

Thus avoid hand-rolled concurrency mechanisms and use a proper
lock for contexts and tx queue protection.

This is a backport of upstream commit: a9dc960c37b0d4

Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
---
 drivers/net/can/usb/kvaser_usb.c |   83 +++++++++++++++++++++++--------------
 1 files changed, 51 insertions(+), 32 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index ba651a2..e928fee 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -12,6 +12,7 @@
  * Copyright (C) 2012 Olivier Sobrie <olivier@sobrie.be>
  */
 
+#include <linux/spinlock.h>
 #include <linux/kernel.h>
 #include <linux/completion.h>
 #include <linux/module.h>
@@ -298,10 +299,11 @@ struct kvaser_usb {
 struct kvaser_usb_net_priv {
 	struct can_priv can;
 
-	atomic_t active_tx_urbs;
-	struct usb_anchor tx_submitted;
+	spinlock_t tx_contexts_lock;
+	int active_tx_contexts;
 	struct kvaser_usb_tx_urb_context tx_contexts[MAX_TX_URBS];
 
+	struct usb_anchor tx_submitted;
 	struct completion start_comp, stop_comp;
 
 	struct kvaser_usb *dev;
@@ -504,6 +506,7 @@ static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev,
 	struct kvaser_usb_net_priv *priv;
 	struct sk_buff *skb;
 	struct can_frame *cf;
+	unsigned long flags;
 	u8 channel = msg->u.tx_acknowledge.channel;
 	u8 tid = msg->u.tx_acknowledge.tid;
 
@@ -545,12 +548,15 @@ static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev,
 
 	stats->tx_packets++;
 	stats->tx_bytes += context->dlc;
-	can_get_echo_skb(priv->netdev, context->echo_index);
 
-	context->echo_index = MAX_TX_URBS;
-	atomic_dec(&priv->active_tx_urbs);
+	spin_lock_irqsave(&priv->tx_contexts_lock, flags);
 
+	can_get_echo_skb(priv->netdev, context->echo_index);
+	context->echo_index = MAX_TX_URBS;
+	--priv->active_tx_contexts;
 	netif_wake_queue(priv->netdev);
+
+	spin_unlock_irqrestore(&priv->tx_contexts_lock, flags);
 }
 
 static void kvaser_usb_simple_msg_callback(struct urb *urb)
@@ -611,17 +617,6 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv,
 	return 0;
 }
 
-static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv)
-{
-	int i;
-
-	usb_kill_anchored_urbs(&priv->tx_submitted);
-	atomic_set(&priv->active_tx_urbs, 0);
-
-	for (i = 0; i < MAX_TX_URBS; i++)
-		priv->tx_contexts[i].echo_index = MAX_TX_URBS;
-}
-
 static void kvaser_usb_rx_error(const struct kvaser_usb *dev,
 				const struct kvaser_msg *msg)
 {
@@ -1178,6 +1173,24 @@ error:
 	return err;
 }
 
+static void kvaser_usb_reset_tx_urb_contexts(struct kvaser_usb_net_priv *priv)
+{
+	int i;
+
+	priv->active_tx_contexts = 0;
+	for (i = 0; i < MAX_TX_URBS; i++)
+		priv->tx_contexts[i].echo_index = MAX_TX_URBS;
+}
+
+/* This method might sleep. Do not call it in the atomic context
+ * of URB completions.
+ */
+static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv)
+{
+	usb_kill_anchored_urbs(&priv->tx_submitted);
+	kvaser_usb_reset_tx_urb_contexts(priv);
+}
+
 static void kvaser_usb_unlink_all_urbs(struct kvaser_usb *dev)
 {
 	int i;
@@ -1296,6 +1309,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	void *buf;
 	struct kvaser_msg *msg;
 	int i, err, ret = NETDEV_TX_OK;
+	unsigned long flags;
 
 	if (can_dropped_invalid_skb(netdev, skb))
 		return NETDEV_TX_OK;
@@ -1339,12 +1353,21 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	if (cf->can_id & CAN_RTR_FLAG)
 		msg->u.tx_can.flags |= MSG_FLAG_REMOTE_FRAME;
 
+	spin_lock_irqsave(&priv->tx_contexts_lock, flags);
 	for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) {
 		if (priv->tx_contexts[i].echo_index == MAX_TX_URBS) {
 			context = &priv->tx_contexts[i];
+
+			context->echo_index = i;
+			can_put_echo_skb(skb, netdev, context->echo_index);
+			++priv->active_tx_contexts;
+			if (priv->active_tx_contexts >= MAX_TX_URBS)
+				netif_stop_queue(netdev);
+
 			break;
 		}
 	}
+	spin_unlock_irqrestore(&priv->tx_contexts_lock, flags);
 
 	/* This should never happen; it implies a flow control bug */
 	if (!context) {
@@ -1356,7 +1379,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	}
 
 	context->priv = priv;
-	context->echo_index = i;
 	context->dlc = cf->can_dlc;
 
 	msg->u.tx_can.tid = context->echo_index;
@@ -1368,18 +1390,17 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 			  kvaser_usb_write_bulk_callback, context);
 	usb_anchor_urb(urb, &priv->tx_submitted);
 
-	can_put_echo_skb(skb, netdev, context->echo_index);
-
-	atomic_inc(&priv->active_tx_urbs);
-
-	if (atomic_read(&priv->active_tx_urbs) >= MAX_TX_URBS)
-		netif_stop_queue(netdev);
-
 	err = usb_submit_urb(urb, GFP_ATOMIC);
 	if (unlikely(err)) {
+		spin_lock_irqsave(&priv->tx_contexts_lock, flags);
+
 		can_free_echo_skb(netdev, context->echo_index);
+		context->echo_index = MAX_TX_URBS;
+		--priv->active_tx_contexts;
+		netif_wake_queue(netdev);
+
+		spin_unlock_irqrestore(&priv->tx_contexts_lock, flags);
 
-		atomic_dec(&priv->active_tx_urbs);
 		usb_unanchor_urb(urb);
 
 		stats->tx_dropped++;
@@ -1506,7 +1527,7 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
 	struct kvaser_usb *dev = usb_get_intfdata(intf);
 	struct net_device *netdev;
 	struct kvaser_usb_net_priv *priv;
-	int i, err;
+	int err;
 
 	err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel);
 	if (err)
@@ -1520,19 +1541,17 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
 
 	priv = netdev_priv(netdev);
 
+	init_usb_anchor(&priv->tx_submitted);
 	init_completion(&priv->start_comp);
 	init_completion(&priv->stop_comp);
 
-	init_usb_anchor(&priv->tx_submitted);
-	atomic_set(&priv->active_tx_urbs, 0);
-
-	for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++)
-		priv->tx_contexts[i].echo_index = MAX_TX_URBS;
-
 	priv->dev = dev;
 	priv->netdev = netdev;
 	priv->channel = channel;
 
+	spin_lock_init(&priv->tx_contexts_lock);
+	kvaser_usb_reset_tx_urb_contexts(priv);
+
 	priv->can.state = CAN_STATE_STOPPED;
 	priv->can.clock.freq = CAN_USB_CLOCK;
 	priv->can.bittiming_const = &kvaser_usb_bittiming_const;
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -stable 0/3] Bugfixes for the kvaser_usb module
  2015-03-21  2:03 [PATCH -stable 0/3] Bugfixes for the kvaser_usb module Ahmed S. Darwish
                   ` (2 preceding siblings ...)
  2015-03-21  2:03 ` [PATCH -stable 3/3] can: kvaser_usb: Fix tx queue start/stop race conditions Ahmed S. Darwish
@ 2015-03-26  7:46 ` Marc Kleine-Budde
  3 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2015-03-26  7:46 UTC (permalink / raw)
  To: Ahmed S. Darwish, Olivier Sobrie; +Cc: Linux-CAN, Ahmed S. Darwish

[-- Attachment #1: Type: text/plain, Size: 1276 bytes --]

On 03/21/2015 03:03 AM, Ahmed S. Darwish wrote:
> This is a series of kvaser_usb bugfixes, backported for -stable
> and generated against v3.19. It should apply cleanly on most
> of the -stable kernel trees out there.
> 
> The patches needed simple backporting since `kvaser_usb' in all
> earlier kernels does not have the can_change_state() changes or
> the extra code for USBCan-II hardware models.
> 
> Each patch contains a reference in its log to the corresponding
> upstream commit.
> 
> I've verified that each patch matches exactly, _hunk for hunk_,
> its corresponding upstream commit. Nonetheless, I don't have a
> pure Kvaser Leaf hardware at hand; someone with a Leaf-based
> model should give them a quick smoke test (Olivier Sobrie?)

After Greg has taken many patches into stable in the last days, I think
it's time to send this series to -stable and ask to apply them.

There is one hunk in patch 1 that you might remove, see my reply for
more details.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -stable 1/3] can: kvaser_usb: Avoid double free on URB submission failures
  2015-03-21  2:03 ` [PATCH -stable 1/3] can: kvaser_usb: Avoid double free on URB submission failures Ahmed S. Darwish
@ 2015-03-26  7:46   ` Marc Kleine-Budde
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2015-03-26  7:46 UTC (permalink / raw)
  To: Ahmed S. Darwish, Olivier Sobrie; +Cc: Linux-CAN, Ahmed S. Darwish

[-- Attachment #1: Type: text/plain, Size: 1682 bytes --]

On 03/21/2015 03:03 AM, Ahmed S. Darwish wrote:
> From: "Ahmed S. Darwish" <ahmed.darwish@valeo.com>
> 
> Upon a URB submission failure, the driver calls usb_free_urb()
> but then manually frees the URB buffer by itself.  Meanwhile
> usb_free_urb() has alredy freed out that transfer buffer since
> we're the only code path holding a reference to this URB.
> 
> Remove two of such invalid manual free().
> 
> This is a backport of upstream commit: deb2701cf704a2
> 
> Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
> ---
>  drivers/net/can/usb/kvaser_usb.c |   20 ++++++++------------
>  1 files changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
> index 7af379c..db43c5a 100644
> --- a/drivers/net/can/usb/kvaser_usb.c
> +++ b/drivers/net/can/usb/kvaser_usb.c
> @@ -595,7 +595,6 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv,
>  		netdev_err(netdev, "Error transmitting URB\n");
>  		usb_unanchor_urb(urb);
>  		usb_free_urb(urb);
> -		kfree(buf);
>  		return err;
>  	}
>  
> @@ -1278,8 +1277,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
>  	struct urb *urb;
>  	void *buf;
>  	struct kvaser_msg *msg;
> -	int i, err;
> -	int ret = NETDEV_TX_OK;
> +	int i, err, ret = NETDEV_TX_OK;

Nitpick: you can remove that hunk.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-26  7:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-21  2:03 [PATCH -stable 0/3] Bugfixes for the kvaser_usb module Ahmed S. Darwish
2015-03-21  2:03 ` [PATCH -stable 1/3] can: kvaser_usb: Avoid double free on URB submission failures Ahmed S. Darwish
2015-03-26  7:46   ` Marc Kleine-Budde
2015-03-21  2:03 ` [PATCH -stable 2/3] can: kvaser_usb: Read all messages in a bulk-in URB buffer Ahmed S. Darwish
2015-03-21  2:03 ` [PATCH -stable 3/3] can: kvaser_usb: Fix tx queue start/stop race conditions Ahmed S. Darwish
2015-03-26  7:46 ` [PATCH -stable 0/3] Bugfixes for the kvaser_usb module Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.