llc2: Reverse the true/false statements of the condition operator in llc_stat_ev_rx_null_dsap_xid_c and llc_stat_ev_rx_null_dsap_test_c.
Subsystems (3)
PATCH 1/1 llc2: Reverse the true/false statements of the condition operator in llc_stat_ev_rx_null_dsap_xid_c and llc_stat_ev_rx_null_dsap_test_c.
From: "Chan Shu Tak, Alex" <[email protected]>
When a frame with NULL DSAP is received, llc_station_rcv is called. In turn, llc_stat_ev_rx_null_dsap_xid_c is called to check if it is a NULL XID frame. The original true statement returns 0 while the false statement returns 1. As a result, an incoming NULL TEST frame would trigger an XID response instead.
The same error is found in llc_stat_ev_rx_null_dsap_test_c and fixed.
--- net/llc/llc_station.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/llc/llc_station.c +2 -2
@@ -32,7 +32,7 @@ static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb)return LLC_PDU_IS_CMD (pdu) &&/* command PDU */ LLC_PDU_TYPE_IS_U (pdu) &&/* U type PDU */ LLC_U_PDU_CMD (pdu) ==LLC_1_PDU_CMD_XID && - !pdu->dsap ?0 :1 ;/* NULL DSAP value */ + !pdu->dsap ?1 :0 ;/* NULL DSAP value */ }static int llc_stat_ev_rx_null_dsap_test_c (struct sk_buff *skb)
@@ -42,7 +42,7 @@ static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb)return LLC_PDU_IS_CMD (pdu) &&/* command PDU */ LLC_PDU_TYPE_IS_U (pdu) &&/* U type PDU */ LLC_U_PDU_CMD (pdu) ==LLC_1_PDU_CMD_TEST && - !pdu->dsap ?0 :1 ;/* NULL DSAP */ + !pdu->dsap ?1 :0 ;/* NULL DSAP */ }static int llc_station_ac_send_xid_r (struct sk_buff *skb)
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: "Chan Shu Tak, Alex" <[email protected]>
Date: Sun, 15 Dec 2019 00:26:58 +0800
Quoted 10 lines
net/llc/llc_station.c +1
-1@@ -32,7 +32,7 @@ static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb)return LLC_PDU_IS_CMD (pdu) &&/* command PDU */ LLC_PDU_TYPE_IS_U (pdu) &&/* U type PDU */ LLC_U_PDU_CMD (pdu) ==LLC_1_PDU_CMD_XID && - !pdu->dsap ?0 :1 ;/* NULL DSAP value */ + !pdu->dsap ?1 :0 ;/* NULL DSAP value */ }static int llc_stat_ev_rx_null_dsap_test_c (struct sk_buff *skb)
net/llc/llc_station.c static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb) · line 47
Quoted 7 lines
net/llc/llc_station.c +1
-1@@ -42,7 +42,7 @@ static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb)return LLC_PDU_IS_CMD (pdu) &&/* command PDU */ LLC_PDU_TYPE_IS_U (pdu) &&/* U type PDU */ LLC_U_PDU_CMD (pdu) ==LLC_1_PDU_CMD_TEST && - !pdu->dsap ?0 :1 ;/* NULL DSAP */ + !pdu->dsap ?1 :0 ;/* NULL DSAP */ }
These are both plain booleans now then. Just plain "!pdu->dsap" is therefore, sufficient.
PATCH v2 1/1 llc2: Remove the condition operator in llc_stat_ev_rx_null_dsap_xid_c and llc_stat_ev_rx_null_dsap_test_c.
In reply to Chan Shu Tak, AlexFrom: "Chan Shu Tak, Alex" <[email protected]>
When a frame with NULL DSAP is received, llc_station_rcv is called. In turn, llc_stat_ev_rx_null_dsap_xid_c is called to check if it is a NULL XID frame. The original condition operator returns 1 when the incoming frame is not a NULL XID frame and 0 otherwise. As a result, an incoming NULL TEST frame would trigger an XID response instead.
To fix the error, we just need to remove the condition operator.
The same error is found in llc_stat_ev_rx_null_dsap_test_c and fixed.
--- net/llc/llc_station.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/llc/llc_station.c +2 -2
@@ -32,7 +32,7 @@ static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb)return LLC_PDU_IS_CMD (pdu) &&/* command PDU */ LLC_PDU_TYPE_IS_U (pdu) &&/* U type PDU */ LLC_U_PDU_CMD (pdu) ==LLC_1_PDU_CMD_XID && - !pdu->dsap ?1 :0 ;/* NULL DSAP value */ + !pdu->dsap;/* NULL DSAP value */ }static int llc_stat_ev_rx_null_dsap_test_c (struct sk_buff *skb)
@@ -42,7 +42,7 @@ static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb)return LLC_PDU_IS_CMD (pdu) &&/* command PDU */ LLC_PDU_TYPE_IS_U (pdu) &&/* U type PDU */ LLC_U_PDU_CMD (pdu) ==LLC_1_PDU_CMD_TEST && - !pdu->dsap ?1 :0 ;/* NULL DSAP */ + !pdu->dsap;/* NULL DSAP */ }static int llc_station_ac_send_xid_r (struct sk_buff *skb)
Signature · 1 line
1.8.3.1
David Miller
maintainerRe: [PATCH v2] llc2: Remove the condition operator in llc_stat_ev_rx_null_dsap_xid_c and llc_stat_ev_rx_null_dsap_test_c.
From: "Chan Shu Tak, Alex" <[email protected]>
Date: Tue, 17 Dec 2019 12:00:36 +0800
net/llc/llc_station.c static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb) · line 35
Quoted 6 lines
net/llc/llc_station.c +1
-1@@ -32,7 +32,7 @@ static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb)return LLC_PDU_IS_CMD (pdu) &&/* command PDU */ LLC_PDU_TYPE_IS_U (pdu) &&/* U type PDU */ LLC_U_PDU_CMD (pdu) ==LLC_1_PDU_CMD_XID && - !pdu->dsap ?1 :0 ;/* NULL DSAP value */ + !pdu->dsap;/* NULL DSAP value */
This isn't a v2 of your patch, it's a patch against v1 of your patch.
Please do this properly, thank you.
Re: [PATCH v2] llc2: Remove the condition operator in llc_stat_ev_rx_null_dsap_xid_c and llc_stat_ev_rx_null_dsap_test_c.
Quoted 12 lines · David Miller
From: "Chan Shu Tak, Alex" <[email protected]>
Date: Tue, 17 Dec 2019 12:00:36 +0800net/llc/llc_station.c static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb) · line 35
Quoted 6 lines
net/llc/llc_station.c +1
-1@@ -32,7 +32,7 @@ static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb)return LLC_PDU_IS_CMD (pdu) &&/* command PDU */ LLC_PDU_TYPE_IS_U (pdu) &&/* U type PDU */ LLC_U_PDU_CMD (pdu) ==LLC_1_PDU_CMD_XID && - !pdu->dsap ?1 :0 ;/* NULL DSAP value */ + !pdu->dsap;/* NULL DSAP value */ This isn't a v2 of your patch, it's a patch against v1 of your patch.
Quoted 1 line
Please do this properly, thank you.
Thanks for your comments and patience and sorry for the troubles that I caused.
I will revise my patch and try again.
In this case, should I start anew or continue on this thread?
Thanks again for your time.
David Miller
maintainerRe: [PATCH v2] llc2: Remove the condition operator in llc_stat_ev_rx_null_dsap_xid_c and llc_stat_ev_rx_null_dsap_test_c.
From: "Chan Shu Tak, ALex" <[email protected]>
Date: Wed, 18 Dec 2019 23:07:37 +0800
Quoted 13 lines · David Miller
Quoted 12 lines
From: "Chan Shu Tak, Alex" <[email protected]>
Date: Tue, 17 Dec 2019 12:00:36 +0800net/llc/llc_station.c static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb) · line 35
Quoted 6 lines
net/llc/llc_station.c +1
-1@@ -32,7 +32,7 @@ static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb)return LLC_PDU_IS_CMD (pdu) &&/* command PDU */ LLC_PDU_TYPE_IS_U (pdu) &&/* U type PDU */ LLC_U_PDU_CMD (pdu) ==LLC_1_PDU_CMD_XID && - !pdu->dsap ?1 :0 ;/* NULL DSAP value */ + !pdu->dsap;/* NULL DSAP value */ This isn't a v2 of your patch, it's a patch against v1 of your patch.
Quoted 7 lines
Quoted 1 line
Please do this properly, thank you.
Thanks for your comments and patience and sorry for the troubles that I caused.
I will revise my patch and try again.
In this case, should I start anew or continue on this thread?
Post a new patch that does the full change from "!pdu->dsap ? 0 : 1" to just plain "!pdu->dsap".