Commit 6dbf02ac authored by Wang Wenhu's avatar Wang Wenhu Committed by David S. Miller

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: fdf5fd39 ("net: qrtr: Broadcast messages only from control port")
Signed-off-by: default avatarWang Wenhu <wenhu.wang@vivo.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3d61a39d
...@@ -906,20 +906,21 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) ...@@ -906,20 +906,21 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
node = NULL; node = NULL;
if (addr->sq_node == QRTR_NODE_BCAST) { if (addr->sq_node == QRTR_NODE_BCAST) {
enqueue_fn = qrtr_bcast_enqueue; if (addr->sq_port != QRTR_PORT_CTRL &&
if (addr->sq_port != QRTR_PORT_CTRL) { qrtr_local_nid != QRTR_NODE_BCAST) {
release_sock(sk); release_sock(sk);
return -ENOTCONN; return -ENOTCONN;
} }
enqueue_fn = qrtr_bcast_enqueue;
} else if (addr->sq_node == ipc->us.sq_node) { } else if (addr->sq_node == ipc->us.sq_node) {
enqueue_fn = qrtr_local_enqueue; enqueue_fn = qrtr_local_enqueue;
} else { } else {
enqueue_fn = qrtr_node_enqueue;
node = qrtr_node_lookup(addr->sq_node); node = qrtr_node_lookup(addr->sq_node);
if (!node) { if (!node) {
release_sock(sk); release_sock(sk);
return -ECONNRESET; return -ECONNRESET;
} }
enqueue_fn = qrtr_node_enqueue;
} }
plen = (len + 3) & ~3; plen = (len + 3) & ~3;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment