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

net: qrtr: send msgs from local of same id as broadcast

If the local node id(qrtr_local_nid) is not modified after its
initialization, it equals to the broadcast node id(QRTR_NODE_BCAST).
So the messages from local node should not be taken as broadcast
and keep the process going to send them out anyway.

The definitions are as follow:
static unsigned int qrtr_local_nid = NUMA_NO_NODE;

Fixes: fdf5fd397566 ("net: qrtr: Broadcast messages only from control port")
Signed-off-by: Wang Wenhu <wenhu.wang@vivo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Wang Wenhu and committed by
David S. Miller
6dbf02ac 3d61a39d

+4 -3
+4 -3
net/qrtr/qrtr.c
··· 906 906 907 907 node = NULL; 908 908 if (addr->sq_node == QRTR_NODE_BCAST) { 909 - enqueue_fn = qrtr_bcast_enqueue; 910 - if (addr->sq_port != QRTR_PORT_CTRL) { 909 + if (addr->sq_port != QRTR_PORT_CTRL && 910 + qrtr_local_nid != QRTR_NODE_BCAST) { 911 911 release_sock(sk); 912 912 return -ENOTCONN; 913 913 } 914 + enqueue_fn = qrtr_bcast_enqueue; 914 915 } else if (addr->sq_node == ipc->us.sq_node) { 915 916 enqueue_fn = qrtr_local_enqueue; 916 917 } else { 917 - enqueue_fn = qrtr_node_enqueue; 918 918 node = qrtr_node_lookup(addr->sq_node); 919 919 if (!node) { 920 920 release_sock(sk); 921 921 return -ECONNRESET; 922 922 } 923 + enqueue_fn = qrtr_node_enqueue; 923 924 } 924 925 925 926 plen = (len + 3) & ~3;