Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1340052 > unrolled thread

[PATCH 6/8] tty: n_gsm: add missing length field in control channel commands

Started byAndrej Krpic <ak77@tnode.com>
First post2016-02-23 00:00 +0100
Last post2016-02-23 00:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 6/8] tty: n_gsm: add missing length field in control channel commands Andrej Krpic <ak77@tnode.com> - 2016-02-23 00:00 +0100

#1340052 — [PATCH 6/8] tty: n_gsm: add missing length field in control channel commands

FromAndrej Krpic <ak77@tnode.com>
Date2016-02-23 00:00 +0100
Subject[PATCH 6/8] tty: n_gsm: add missing length field in control channel commands
Message-ID<r57Cr-4w9-27@gated-at.bofh.it>
Observing debug output while running initator and responder using n_gsm
shows all control channel commands sent by initiator are malformed
 - they don't include length field (3GPP TS 07.10 ver 7.2.0, 5.4.6.1).

Add length field to transmitted control channel commands in the
gsm_control_transmit) as it is done in gsm_control_reply and expected in
gsm_dlci_command.

Signed-off-by: Andrej Krpic <ak77@tnode.com>
---
 drivers/tty/n_gsm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 3c4c521..8aa90e0 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1320,12 +1320,13 @@ static void gsm_control_response(struct gsm_mux *gsm, unsigned int command,
 
 static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control *ctrl)
 {
-	struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, gsm->ftype);
+	struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 2, gsm->ftype);
 
 	if (msg == NULL)
 		return;
-	msg->data[0] = (ctrl->cmd << 1) | 2 | EA;	/* command */
-	memcpy(msg->data + 1, ctrl->data, ctrl->len);
+	msg->data[0] = (ctrl->cmd << 1) | 2 | EA;   /* command */
+	msg->data[1] = ((ctrl->len) << 1) | EA;
+	memcpy(msg->data + 2, ctrl->data, ctrl->len);
 	gsm_data_queue(gsm->dlci[0], msg);
 }
 
-- 
2.7.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web