Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

llc2: Fix return statement of llc_stat_ev_rx_null_dsap_xid_c (and _test_c)

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 return statement of llc_stat_ev_rx_null_dsap_xid_c returns 1
when the incoming frame is not a NULL XID frame and 0 otherwise. Hence, a
NULL XID response is returned unexpectedly, e.g. when the incoming frame is
a NULL TEST command.

To fix the error, simply remove the conditional operator.

A similar error in llc_stat_ev_rx_null_dsap_test_c is also fixed.

Signed-off-by: Chan Shu Tak, Alex <alexchan@task.com.hk>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Chan Shu Tak, Alex and committed by
David S. Miller
af1c0e4e 90b3b339

+2 -2
+2 -2
net/llc/llc_station.c
··· 32 32 return LLC_PDU_IS_CMD(pdu) && /* command PDU */ 33 33 LLC_PDU_TYPE_IS_U(pdu) && /* U type PDU */ 34 34 LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_XID && 35 - !pdu->dsap ? 0 : 1; /* NULL DSAP value */ 35 + !pdu->dsap; /* NULL DSAP value */ 36 36 } 37 37 38 38 static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb) ··· 42 42 return LLC_PDU_IS_CMD(pdu) && /* command PDU */ 43 43 LLC_PDU_TYPE_IS_U(pdu) && /* U type PDU */ 44 44 LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_TEST && 45 - !pdu->dsap ? 0 : 1; /* NULL DSAP */ 45 + !pdu->dsap; /* NULL DSAP */ 46 46 } 47 47 48 48 static int llc_station_ac_send_xid_r(struct sk_buff *skb)