Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 944521bb authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Rectify the recovery algorithm in case for raw packet"

parents 1582711b 173db0eb
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1236,19 +1236,21 @@ static void diag_hdlc_start_recovery(unsigned char *buf, int len)
	int i;
	static uint32_t bad_byte_counter;
	unsigned char *start_ptr = NULL;
	struct diag_pkt_frame_t *actual_pkt = NULL;

	hdlc_reset = 1;
	hdlc_reset_timer_start();

	actual_pkt = (struct diag_pkt_frame_t *)buf;
	for (i = 0; i < len; i++) {
		if (buf[i] == CONTROL_CHAR && (i +
				sizeof(struct diag_pkt_frame_t)
				<= (len - 1))) {
			if (buf[i+1] == 1) {
		if (actual_pkt->start == CONTROL_CHAR &&
			actual_pkt->version == 1 &&
			actual_pkt->length < len &&
			(*(uint8_t *)(buf + sizeof(struct diag_pkt_frame_t) +
			actual_pkt->length) == CONTROL_CHAR)) {
				start_ptr = &buf[i];
				break;
		}
		}
		bad_byte_counter++;
		if (bad_byte_counter > (DIAG_MAX_REQ_SIZE +
				sizeof(struct diag_pkt_frame_t) + 1)) {
+4 −0
Original line number Diff line number Diff line
@@ -616,6 +616,10 @@ static void socket_read_work_fn(struct work_struct *work)
	struct diag_socket_info *info = container_of(work,
						     struct diag_socket_info,
						     read_work);

	if (!info)
		return;

	diagfwd_channel_read(info->fwd_ctxt);
}