linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: qrtr: Fix message type of outgoing packets
@ 2019-05-20 23:51 Bjorn Andersson
  2019-05-21  0:53 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Andersson @ 2019-05-20 23:51 UTC (permalink / raw)
  To: David S. Miller
  Cc: Arun Kumar Neelakantam, Nicholas Mc Guire, netdev, linux-kernel,
	linux-arm-msm

QRTR packets has a message type in the header, which is repeated in the
control header. For control packets we therefor copy the type from
beginning of the outgoing payload and use that as message type.

For non-control messages an endianness fix introduced in v5.2-rc1 caused the
type to be 0, rather than QRTR_TYPE_DATA, causing all messages to be dropped by
the receiver. Fix this by converting and using qrtr_type, which will remain
QRTR_TYPE_DATA for non-control messages.

Fixes: 8f5e24514cbd ("net: qrtr: use protocol endiannes variable")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 net/qrtr/qrtr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 801872a2e7aa..05fa058bee59 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -733,8 +733,8 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 	struct sock *sk = sock->sk;
 	struct qrtr_node *node;
 	struct sk_buff *skb;
-	u32 type = 0;
 	size_t plen;
+	u32 type;
 	int rc;
 
 	if (msg->msg_flags & ~(MSG_DONTWAIT))
@@ -809,9 +809,9 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 
 		/* control messages already require the type as 'command' */
 		skb_copy_bits(skb, 0, &qrtr_type, 4);
-		type = le32_to_cpu(qrtr_type);
 	}
 
+	type = le32_to_cpu(qrtr_type);
 	rc = enqueue_fn(node, skb, type, &ipc->us, addr);
 	if (rc >= 0)
 		rc = len;
-- 
2.18.0


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

* Re: [PATCH] net: qrtr: Fix message type of outgoing packets
  2019-05-20 23:51 [PATCH] net: qrtr: Fix message type of outgoing packets Bjorn Andersson
@ 2019-05-21  0:53 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-05-21  0:53 UTC (permalink / raw)
  To: bjorn.andersson; +Cc: aneela, hofrat, netdev, linux-kernel, linux-arm-msm

From: Bjorn Andersson <bjorn.andersson@linaro.org>
Date: Mon, 20 May 2019 16:51:56 -0700

> QRTR packets has a message type in the header, which is repeated in the
> control header. For control packets we therefor copy the type from
> beginning of the outgoing payload and use that as message type.
> 
> For non-control messages an endianness fix introduced in v5.2-rc1 caused the
> type to be 0, rather than QRTR_TYPE_DATA, causing all messages to be dropped by
> the receiver. Fix this by converting and using qrtr_type, which will remain
> QRTR_TYPE_DATA for non-control messages.
> 
> Fixes: 8f5e24514cbd ("net: qrtr: use protocol endiannes variable")
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Applied, thank you.

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

end of thread, other threads:[~2019-05-21  0:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 23:51 [PATCH] net: qrtr: Fix message type of outgoing packets Bjorn Andersson
2019-05-21  0:53 ` 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).