]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: phy: micrel: Fix potential null pointer dereference
authorAleksandr Mishin <amishin@t-argos.ru>
Fri, 29 Mar 2024 06:16:31 +0000 (09:16 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:35:52 +0000 (16:35 +0200)
commit95c1016a2d92c4c28a9d1b6d09859c00b19c0ea4
treed15e1a3f3e5f925de72b8061419f9dfbada4ac38
parentf996e5ecf07fad2c49af1fc0563f937ef528df7c
net: phy: micrel: Fix potential null pointer dereference

commit 96c155943a703f0655c0c4cab540f67055960e91 upstream.

In lan8814_get_sig_rx() and lan8814_get_sig_tx() ptp_parse_header() may
return NULL as ptp_header due to abnormal packet type or corrupted packet.
Fix this bug by adding ptp_header check.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20240329061631.33199-1-amishin@t-argos.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/phy/micrel.c