* [PATCH] 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.
@ 2019-12-14 16:26 Chan Shu Tak, Alex
2019-12-17 0:26 ` David Miller
2019-12-17 4:00 ` [PATCH v2] llc2: Remove " Chan Shu Tak, Alex
0 siblings, 2 replies; 6+ messages in thread
From: Chan Shu Tak, Alex @ 2019-12-14 16:26 UTC (permalink / raw)
Cc: Chan Shu Tak, Alex, David S. Miller, netdev, linux-kernel
From: "Chan Shu Tak, Alex" <alexchan@task.com.hk>
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.
Signed-off-by: Chan Shu Tak, Alex <alexchan@task.com.hk>
---
net/llc/llc_station.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c
index 204a835..90955d7 100644
--- a/net/llc/llc_station.c
+++ b/net/llc/llc_station.c
@@ -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)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] 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.
2019-12-14 16:26 [PATCH] 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 Chan Shu Tak, Alex
@ 2019-12-17 0:26 ` David Miller
2019-12-17 4:00 ` [PATCH v2] llc2: Remove " Chan Shu Tak, Alex
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2019-12-17 0:26 UTC (permalink / raw)
To: alexchan; +Cc: netdev, linux-kernel
From: "Chan Shu Tak, Alex" <alexchan@task.com.hk>
Date: Sun, 15 Dec 2019 00:26:58 +0800
> @@ -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 */
> }
>
These are both plain booleans now then. Just plain "!pdu->dsap" is
therefore, sufficient.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [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.
2019-12-14 16:26 [PATCH] 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 Chan Shu Tak, Alex
2019-12-17 0:26 ` David Miller
@ 2019-12-17 4:00 ` Chan Shu Tak, Alex
2019-12-18 6:18 ` David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Chan Shu Tak, Alex @ 2019-12-17 4:00 UTC (permalink / raw)
Cc: Chan Shu Tak, Alex, David S. Miller, netdev, linux-kernel
From: "Chan Shu Tak, Alex" <alexchan@task.com.hk>
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.
Signed-off-by: Chan Shu Tak, Alex <alexchan@task.com.hk>
---
net/llc/llc_station.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c
index 90955d7..c29170e 100644
--- a/net/llc/llc_station.c
+++ b/net/llc/llc_station.c
@@ -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)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* 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.
2019-12-17 4:00 ` [PATCH v2] llc2: Remove " Chan Shu Tak, Alex
@ 2019-12-18 6:18 ` David Miller
2019-12-18 15:07 ` Chan Shu Tak, ALex
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2019-12-18 6:18 UTC (permalink / raw)
To: alexchan; +Cc: netdev, linux-kernel
From: "Chan Shu Tak, Alex" <alexchan@task.com.hk>
Date: Tue, 17 Dec 2019 12:00:36 +0800
> @@ -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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* 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.
2019-12-18 6:18 ` David Miller
@ 2019-12-18 15:07 ` Chan Shu Tak, ALex
2019-12-18 20:24 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Chan Shu Tak, ALex @ 2019-12-18 15:07 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-kernel
On Tue, Dec 17, 2019 at 10:18:46PM -0800, David Miller wrote:
> From: "Chan Shu Tak, Alex" <alexchan@task.com.hk>
> Date: Tue, 17 Dec 2019 12:00:36 +0800
>
> > @@ -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.
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* 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.
2019-12-18 15:07 ` Chan Shu Tak, ALex
@ 2019-12-18 20:24 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-12-18 20:24 UTC (permalink / raw)
To: alexchan; +Cc: netdev, linux-kernel
From: "Chan Shu Tak, ALex" <alexchan@task.com.hk>
Date: Wed, 18 Dec 2019 23:07:37 +0800
> On Tue, Dec 17, 2019 at 10:18:46PM -0800, David Miller wrote:
>> From: "Chan Shu Tak, Alex" <alexchan@task.com.hk>
>> Date: Tue, 17 Dec 2019 12:00:36 +0800
>>
>> > @@ -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.
>
> 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".
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-12-18 20:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-14 16:26 [PATCH] 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 Chan Shu Tak, Alex
2019-12-17 0:26 ` David Miller
2019-12-17 4:00 ` [PATCH v2] llc2: Remove " Chan Shu Tak, Alex
2019-12-18 6:18 ` David Miller
2019-12-18 15:07 ` Chan Shu Tak, ALex
2019-12-18 20:24 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).