summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorWang Wenhu <wenhu.wang@vivo.com>2020-04-09 05:53:53 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-21 10:03:04 +0300
commitc08e523e1507824733f4d5670e1717b52b3d8255 (patch)
tree7a1092fab9bc4c2fe2096afec55e1b6e3d111de6 /net
parent8fdf8a84ea68fff914f137169e20aba95978a7af (diff)
downloadlinux-c08e523e1507824733f4d5670e1717b52b3d8255.tar.xz
net: qrtr: send msgs from local of same id as broadcast
[ Upstream commit 6dbf02acef69b0742c238574583b3068afbd227c ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/qrtr/qrtr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 82d38f93c81a..518327dccb3c 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -769,20 +769,21 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
node = NULL;
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);
return -ENOTCONN;
}
+ enqueue_fn = qrtr_bcast_enqueue;
} else if (addr->sq_node == ipc->us.sq_node) {
enqueue_fn = qrtr_local_enqueue;
} else {
- enqueue_fn = qrtr_node_enqueue;
node = qrtr_node_lookup(addr->sq_node);
if (!node) {
release_sock(sk);
return -ECONNRESET;
}
+ enqueue_fn = qrtr_node_enqueue;
}
plen = (len + 3) & ~3;