Skip to content

Commit b6fcb15

Browse files
committed
can: isotp: fix support for transmission of SF without flow control
JIRA: https://issues.redhat.com/browse/RHEL-80832 commit 0bfe711 Author: Oliver Hartkopp <[email protected]> Date: Mon Aug 21 16:45:46 2023 +0200 can: isotp: fix support for transmission of SF without flow control The original implementation had a very simple handling for single frame transmissions as it just sent the single frame without a timeout handling. With the new echo frame handling the echo frame was also introduced for single frames but the former exception ('simple without timers') has been maintained by accident. This leads to a 1 second timeout when closing the socket and to an -ECOMM error when CAN_ISOTP_WAIT_TX_DONE is selected. As the echo handling is always active (also for single frames) remove the wrong extra condition for single frames. Fixes: 9f39d36 ("can: isotp: add support for transmission without flow control") Signed-off-by: Oliver Hartkopp <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Radu Rendec <[email protected]>
1 parent 46c5f2f commit b6fcb15

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

net/can/isotp.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,6 @@ static bool isotp_register_rxid(struct isotp_sock *so)
175175
return (isotp_bc_flags(so) == 0);
176176
}
177177

178-
static bool isotp_register_txecho(struct isotp_sock *so)
179-
{
180-
/* all modes but SF_BROADCAST register for tx echo skbs */
181-
return (isotp_bc_flags(so) != CAN_ISOTP_SF_BROADCAST);
182-
}
183-
184178
static enum hrtimer_restart isotp_rx_timer_handler(struct hrtimer *hrtimer)
185179
{
186180
struct isotp_sock *so = container_of(hrtimer, struct isotp_sock,
@@ -1176,7 +1170,7 @@ static int isotp_release(struct socket *sock)
11761170
lock_sock(sk);
11771171

11781172
/* remove current filters & unregister */
1179-
if (so->bound && isotp_register_txecho(so)) {
1173+
if (so->bound) {
11801174
if (so->ifindex) {
11811175
struct net_device *dev;
11821176

@@ -1290,14 +1284,12 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len)
12901284
can_rx_register(net, dev, rx_id, SINGLE_MASK(rx_id),
12911285
isotp_rcv, sk, "isotp", sk);
12921286

1293-
if (isotp_register_txecho(so)) {
1294-
/* no consecutive frame echo skb in flight */
1295-
so->cfecho = 0;
1287+
/* no consecutive frame echo skb in flight */
1288+
so->cfecho = 0;
12961289

1297-
/* register for echo skb's */
1298-
can_rx_register(net, dev, tx_id, SINGLE_MASK(tx_id),
1299-
isotp_rcv_echo, sk, "isotpe", sk);
1300-
}
1290+
/* register for echo skb's */
1291+
can_rx_register(net, dev, tx_id, SINGLE_MASK(tx_id),
1292+
isotp_rcv_echo, sk, "isotpe", sk);
13011293

13021294
dev_put(dev);
13031295

@@ -1518,7 +1510,7 @@ static void isotp_notify(struct isotp_sock *so, unsigned long msg,
15181510
case NETDEV_UNREGISTER:
15191511
lock_sock(sk);
15201512
/* remove current filters & unregister */
1521-
if (so->bound && isotp_register_txecho(so)) {
1513+
if (so->bound) {
15221514
if (isotp_register_rxid(so))
15231515
can_rx_unregister(dev_net(dev), dev, so->rxid,
15241516
SINGLE_MASK(so->rxid),

0 commit comments

Comments
 (0)