Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f35e7bc3 authored by Chris Lew's avatar Chris Lew
Browse files

net: qrtr: Fix hello packet drop memory leak



If a node_enqueue is called on a node that has not finished the hello
packet negotiation, the packet to be enqueued will be dropped. Make
sure to free this dropped packet.

Change-Id: I52a6f5d6b07fff272e3912d85221e7f6540cfa33
Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
parent 7bba1009
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015, Sony Mobile Communications Inc.
 * Copyright (c) 2013, 2018 The Linux Foundation. All rights reserved.
 * Copyright (c) 2013, 2018-2019 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -505,8 +505,10 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
	size_t len = skb->len;
	int rc = -ENODEV;

	if (!atomic_read(&node->hello_sent) && type != QRTR_TYPE_HELLO)
	if (!atomic_read(&node->hello_sent) && type != QRTR_TYPE_HELLO) {
		kfree_skb(skb);
		return rc;
	}

	/* If sk is null, this is a forwarded packet and should not wait */
	if (!skb->sk) {