linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] net: qrtr: send msgs from local of same id as broadcast
@ 2020-04-09  2:53 Wang Wenhu
  2020-04-09 17:09 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Wenhu @ 2020-04-09  2:53 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Bjorn Andersson, Wen Gong,
	Allison Randal, Willem de Bruijn, Arnd Bergmann, Johannes Berg,
	Carl Huang, Wang Wenhu, Thomas Gleixner, netdev, linux-kernel
  Cc: kernel

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;
#define QRTR_NODE_BCAST	0xffffffffu

Fixes: commit fdf5fd397566 ("net: qrtr: Broadcast messages only from control port")
Signed-off-by: Wang Wenhu <wenhu.wang@vivo.com>
---
Changlog:
 - v3 Use whitespace rather than tabs to make the line up correct.
 - v2 For coding style, line up the newline of the if conditional judgement
      with the one exists before.
---
 net/qrtr/qrtr.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 5a8e42ad1504..b7b854621c26 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -907,20 +907,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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] net: qrtr: send msgs from local of same id as broadcast
  2020-04-09  2:53 [PATCH v3] net: qrtr: send msgs from local of same id as broadcast Wang Wenhu
@ 2020-04-09 17:09 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-04-09 17:09 UTC (permalink / raw)
  To: wenhu.wang
  Cc: kuba, bjorn.andersson, wgong, allison, willemb, arnd,
	johannes.berg, cjhuang, tglx, netdev, linux-kernel, kernel

From: Wang Wenhu <wenhu.wang@vivo.com>
Date: Wed,  8 Apr 2020 19:53:53 -0700

> 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;
> #define QRTR_NODE_BCAST	0xffffffffu
> 
> Fixes: commit fdf5fd397566 ("net: qrtr: Broadcast messages only from control port")
> Signed-off-by: Wang Wenhu <wenhu.wang@vivo.com>

Please do not put the word "commit" in your Fixes: tag in the future,
it does not belong there.

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-09 17:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-09  2:53 [PATCH v3] net: qrtr: send msgs from local of same id as broadcast Wang Wenhu
2020-04-09 17:09 ` 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).