[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1629461872-26965-2-git-send-email-zhenguo6858@gmail.com>
Date: Fri, 20 Aug 2021 20:17:46 +0800
From: Zhenguo Zhao <zhenguo6858@...il.com>
To: nianfu.bai@...soc.com, gregkh@...uxfoundation.org,
jirislaby@...nel.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 2/8] tty: n_gsm: Modify cr bit value when config requester
From: Zhenguo Zhao <Zhenguo.Zhao1@...soc.com>
When n_gsm config "initiator=0",as requester,gsmld will receive dlci
SABM and DISC control command frame,the CR bit value should be 1.
If cr == 0,it will goto invalid,and it can't send UA response
frame and open requster dlci.
case SABM|PF:
- if (cr == 0)
+ if (cr == 0) {
+ printk("gsm_queue invalid\n");
goto invalid;
+ }
Example,gsmld receive dlc0 SABM command frame:f9 03 3f 01 1c f9
but gsmld goto invalid.
Kernel test log:
[ 101.794705] c0 gsmld_receive: 00000000: f9 03 3f 01 1c f9
[ 101.803341] c0 <-- 0) C: SABM(P)
[ 101.811371] c0 gsm_queue invalid
Signed-off-by: Zhenguo Zhao <Zhenguo.Zhao1@...soc.com>
---
drivers/tty/n_gsm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 5fea02c..becca2c 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1779,7 +1779,7 @@ static void gsm_queue(struct gsm_mux *gsm)
switch (gsm->control) {
case SABM|PF:
- if (cr == 0)
+ if (cr == 1)
goto invalid;
if (dlci == NULL)
dlci = gsm_dlci_alloc(gsm, address);
@@ -1793,7 +1793,7 @@ static void gsm_queue(struct gsm_mux *gsm)
}
break;
case DISC|PF:
- if (cr == 0)
+ if (cr == 1)
goto invalid;
if (dlci == NULL || dlci->state == DLCI_CLOSED) {
gsm_response(gsm, address, DM);
--
1.9.1
Powered by blists - more mailing lists