Re: [syzbot] WARNING: lock held when returning to user space in ethnl_act_cable_test

From: syzbot
Date: Mon Aug 26 2024 - 07:44:07 EST


For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.

***

Subject: WARNING: lock held when returning to user space in ethnl_act_cable_test
Author: djahchankoike@xxxxxxxxx

#syz test

Fix an unreleased lock when taking the out_dev_put path.

Signed-off-by: Diogo Jahchan Koike <djahchankoike@xxxxxxxxx>
---
I'm not entirely sure why are there two labels
when all paths should release the lock, maybe
remove out_dev_put and out_rtnl for a simpler
out? I've kept it just in case, but I can make
the change if needed.
---
net/ethtool/cabletest.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/ethtool/cabletest.c b/net/ethtool/cabletest.c
index 01db8f394869..c6ca1107c470 100644
--- a/net/ethtool/cabletest.c
+++ b/net/ethtool/cabletest.c
@@ -77,6 +77,7 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
info->extack);
if (IS_ERR_OR_NULL(phydev)) {
ret = -EOPNOTSUPP;
+ rtnl_unlock();
goto out_dev_put;
}

--
2.43.0