summaryrefslogtreecommitdiffstats
path: root/net/qrtr
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2019-05-20 19:51:56 -0400
committerDavid S. Miller <davem@davemloft.net>2019-05-20 20:50:31 -0400
commit7036e621455f4e62781b69bb76c71fddcc8664bf (patch)
treeded117af12671b67d6c9ab02763d5782fd837b43 /net/qrtr
parentba3c43851f1a3439b449593bc8b9fc100951d84c (diff)
net: qrtr: Fix message type of outgoing packets
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/qrtr')
-rw-r--r--net/qrtr/qrtr.c4
1 files 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)
733 struct sock *sk = sock->sk; 733 struct sock *sk = sock->sk;
734 struct qrtr_node *node; 734 struct qrtr_node *node;
735 struct sk_buff *skb; 735 struct sk_buff *skb;
736 u32 type = 0;
737 size_t plen; 736 size_t plen;
737 u32 type;
738 int rc; 738 int rc;
739 739
740 if (msg->msg_flags & ~(MSG_DONTWAIT)) 740 if (msg->msg_flags & ~(MSG_DONTWAIT))
@@ -809,9 +809,9 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
809 809
810 /* control messages already require the type as 'command' */ 810 /* control messages already require the type as 'command' */
811 skb_copy_bits(skb, 0, &qrtr_type, 4); 811 skb_copy_bits(skb, 0, &qrtr_type, 4);
812 type = le32_to_cpu(qrtr_type);
813 } 812 }
814 813
814 type = le32_to_cpu(qrtr_type);
815 rc = enqueue_fn(node, skb, type, &ipc->us, addr); 815 rc = enqueue_fn(node, skb, type, &ipc->us, addr);
816 if (rc >= 0) 816 if (rc >= 0)
817 rc = len; 817 rc = len;