Skip to content

Commit

Permalink
net: qrtr: Fix message type of outgoing packets
Browse files Browse the repository at this point in the history
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: 8f5e245 ("net: qrtr: use protocol endiannes variable")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Bjorn Andersson authored and David S. Miller committed May 21, 2019
1 parent ba3c438 commit 7036e62
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/qrtr/qrtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7036e62

Please sign in to comment.