summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Lichvar <mlichvar@redhat.com>2022-01-11 16:10:53 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-01-27 11:05:39 +0100
commit62009fa50c1a70a291f8f72a66b08449a03ea50e (patch)
treef712f491377d45391dcd51e1e45dd9e46756632e
parent55d613f5d4c26ac8e5c5addc4d2dd4e876016750 (diff)
downloadlinux-62009fa50c1a70a291f8f72a66b08449a03ea50e.tar.gz
linux-62009fa50c1a70a291f8f72a66b08449a03ea50e.tar.bz2
linux-62009fa50c1a70a291f8f72a66b08449a03ea50e.zip
net: fix sock_timestamping_bind_phc() to release device
commit 2a4d75bfe41232608f5596a6d1369f92ccb20817 upstream. 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 <mlichvar@redhat.com> Cc: Yangbo Lu <yangbo.lu@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/core/sock.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 1b31e1018162..6ea317f84edd 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -830,6 +830,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;