lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200830131336.275844-1-rkovhaev@gmail.com>
Date:   Sun, 30 Aug 2020 06:13:36 -0700
From:   Rustam Kovhaev <rkovhaev@...il.com>
To:     davem@...emloft.net, kuba@...nel.org
Cc:     netdev@...r.kernel.org, bpf@...r.kernel.org,
        linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org,
        Rustam Kovhaev <rkovhaev@...il.com>
Subject: [PATCH] veth: fix memory leak in veth_newlink()

when register_netdevice(dev) fails we should check whether struct
veth_rq has been allocated via ndo_init callback and free it, because,
depending on the code path, register_netdevice() might not call
priv_destructor() callback

Reported-and-tested-by: syzbot+59ef240dd8f0ed7598a8@...kaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=59ef240dd8f0ed7598a8
Signed-off-by: Rustam Kovhaev <rkovhaev@...il.com>
---
 drivers/net/veth.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index a475f48d43c4..e40ca62a046a 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1394,7 +1394,9 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
 	return 0;
 
 err_register_dev:
-	/* nothing to do */
+	priv = netdev_priv(dev);
+	if (priv->rq)
+		veth_dev_free(dev);
 err_configure_peer:
 	unregister_netdevice(peer);
 	return err;
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ