Commit d94ef51d authored by David S. Miller's avatar David S. Miller
Browse files

Merge tag 'linux-can-fixes-for-5.18-20220417' of...

Merge tag 'linux-can-fixes-for-5.18-20220417' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can



Marc Kleine-Budde says:

====================
pull-request: can 2022-04-17

this is a pull request of 1 patch for net/master.

The patch is by Oliver Hartkopp and fixes a timeout monitoring problem
in the ISO TP protocol found by the syzbot.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 49aefd13 d7349708
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -906,6 +906,7 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
	struct canfd_frame *cf;
	int ae = (so->opt.flags & CAN_ISOTP_EXTEND_ADDR) ? 1 : 0;
	int wait_tx_done = (so->opt.flags & CAN_ISOTP_WAIT_TX_DONE) ? 1 : 0;
	s64 hrtimer_sec = 0;
	int off;
	int err;

@@ -1004,7 +1005,9 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
		isotp_create_fframe(cf, so, ae);

		/* start timeout for FC */
		hrtimer_start(&so->txtimer, ktime_set(1, 0), HRTIMER_MODE_REL_SOFT);
		hrtimer_sec = 1;
		hrtimer_start(&so->txtimer, ktime_set(hrtimer_sec, 0),
			      HRTIMER_MODE_REL_SOFT);
	}

	/* send the first or only CAN frame */
@@ -1017,6 +1020,11 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
	if (err) {
		pr_notice_once("can-isotp: %s: can_send_ret %pe\n",
			       __func__, ERR_PTR(err));

		/* no transmission -> no timeout monitoring */
		if (hrtimer_sec)
			hrtimer_cancel(&so->txtimer);

		goto err_out_drop;
	}