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: Chris Lew <clew@codeaurora.org>
This commit is contained in:
Chris Lew 2019-02-19 18:28:18 -08:00
parent 7bba100902
commit f35e7bc3f3

View file

@ -1,6 +1,6 @@
/*
* 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) {