From: Miroslav Lichvar Date: Tue, 11 Jan 2022 15:10:53 +0000 (+0100) Subject: net: fix sock_timestamping_bind_phc() to release device X-Git-Tag: v5.17-rc1~37^2~52 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=2a4d75bfe41232608f5596a6d1369f92ccb20817;p=linux-block.git net: fix sock_timestamping_bind_phc() to release device Don't forget to release the device in sock_timestamping_bind_phc() after it was used to get the vclock indices. Fixes: d463126e23f1 ("net: sock: extend SO_TIMESTAMPING for PHC binding") Signed-off-by: Miroslav Lichvar Cc: Yangbo Lu Signed-off-by: David S. Miller --- diff --git a/net/core/sock.c b/net/core/sock.c index e21485ab285d..f32ec08a0c37 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -844,6 +844,8 @@ static int sock_timestamping_bind_phc(struct sock *sk, int phc_index) } num = ethtool_get_phc_vclocks(dev, &vclock_index); + dev_put(dev); + for (i = 0; i < num; i++) { if (*(vclock_index + i) == phc_index) { match = true;