diff options
author | Pavel Skripkin <paskripkin@gmail.com> | 2021-07-23 17:31:32 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-07-23 18:48:06 +0200 |
commit | 52f3456a96c06760b9bfae460e39596fec7af22e (patch) | |
tree | ecd9696e9a744d91aa86d0ebadeb2d4b3c4c9637 /net/netlink | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf (diff) | |
download | linux-52f3456a96c06760b9bfae460e39596fec7af22e.tar.xz linux-52f3456a96c06760b9bfae460e39596fec7af22e.zip |
net: qrtr: fix memory leaks
Syzbot reported memory leak in qrtr. The problem was in unputted
struct sock. qrtr_local_enqueue() function calls qrtr_port_lookup()
which takes sock reference if port was found. Then there is the following
check:
if (!ipc || &ipc->sk == skb->sk) {
...
return -ENODEV;
}
Since we should drop the reference before returning from this function and
ipc can be non-NULL inside this if, we should add qrtr_port_put() inside
this if.
The similar corner case is in qrtr_endpoint_post() as Manivannan
reported. In case of sock_queue_rcv_skb() failure we need to put
port reference to avoid leaking struct sock pointer.
Fixes: e04df98adf7d ("net: qrtr: Remove receive worker")
Fixes: bdabad3e363d ("net: Add Qualcomm IPC router")
Reported-and-tested-by: syzbot+35a511c72ea7356cdcf3@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
0 files changed, 0 insertions, 0 deletions