]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: mscc: ocelot: perform error cleanup in ocelot_hwstamp_set()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 5 Dec 2024 14:55:19 +0000 (16:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Dec 2024 17:08:54 +0000 (18:08 +0100)
commit1c765f5710c53691c169f2687d6149ce174e7764
tree7cf0dc435e108640d865b8781e5dff69f0d29333
parentda0732ef2abff267e46d4bdb00c7bf4b881e2820
net: mscc: ocelot: perform error cleanup in ocelot_hwstamp_set()

[ Upstream commit 43a4166349a254446e7a3db65f721c6a30daccf3 ]

An unsupported RX filter will leave the port with TX timestamping still
applied as per the new request, rather than the old setting. When
parsing the tx_type, don't apply it just yet, but delay that until after
we've parsed the rx_filter as well (and potentially returned -ERANGE for
that).

Similarly, copy_to_user() may fail, which is a rare occurrence, but
should still be treated by unwinding what was done.

Fixes: 96ca08c05838 ("net: mscc: ocelot: set up traps for PTP packets")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://patch.msgid.link/20241205145519.1236778-6-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mscc/ocelot_ptp.c