[PATCH v1 05/16] j1939: transport: handle skb_clone() error in j1939_tp_txtimer()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
---
 net/can/j1939/transport.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index cd68b98fee92..19014c4811bc 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -883,10 +883,16 @@ static enum hrtimer_restart j1939_tp_txtimer(struct hrtimer *hrtimer)
 		struct sk_buff *se_skb = j1939_session_skb_find(session);
 
 		if (se_skb) {
-			ret = j1939_send_one(priv,
-					     skb_clone(se_skb, GFP_ATOMIC));
-			if (!ret)
-				j1939_session_deactivate_activate_next(session);
+			struct sk_buff *skb;
+
+			skb = skb_clone(se_skb, GFP_ATOMIC);
+			if (skb) {
+				ret = j1939_send_one(priv, skb);
+				if (!ret)
+					j1939_session_deactivate_activate_next(session);
+			} else {
+				ret = session->err = -ENOMEM;
+			}
 		}
 	} else {
 		ret = j1939_tp_txnext(session);
@@ -908,7 +914,8 @@ static enum hrtimer_restart j1939_tp_txtimer(struct hrtimer *hrtimer)
 	} else if (ret) {
 		netdev_alert(priv->ndev, "%s: tx aborted with unknown reason: %i\n",
 			     __func__, ret);
-		j1939_session_cancel(session, J1939_XTP_ABORT_OTHER);
+		if (session->skcb.addr.type != J1939_SIMPLE)
+			j1939_session_cancel(session, J1939_XTP_ABORT_OTHER);
 	} else {
 		session->tx_retry = 0;
 	}
-- 
2.20.1




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux