android_kernel_samsung_a7y1.../drivers/net/ethernet/stmicro/stmmac
Antonio Borneo eb76395b9c net: stmmac: fix length of PTP clock's name string
[ Upstream commit 5da202c88f8c355ad79bc2e8eb582e6d433060e7 ]

The field "name" in struct ptp_clock_info has a fixed size of 16
chars and is used as zero terminated string by clock_name_show()
in drivers/ptp/ptp_sysfs.c
The current initialization value requires 17 chars to fit also the
null termination, and this causes overflow to the next bytes in
the struct when the string is read as null terminated:
	hexdump -C /sys/class/ptp/ptp0/clock_name
	00000000  73 74 6d 6d 61 63 5f 70  74 70 5f 63 6c 6f 63 6b  |stmmac_ptp_clock|
	00000010  a0 ac b9 03 0a                                    |.....|
where the extra 4 bytes (excluding the newline) after the string
represent the integer 0x03b9aca0 = 62500000 assigned to the field
"max_adj" that follows "name" in the same struct.

There is no strict requirement for the "name" content and in the
comment in ptp_clock_kernel.h it's reported it should just be 'A
short "friendly name" to identify the clock'.
Replace it with "stmmac ptp".

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Fixes: 92ba6888510c ("stmmac: add the support for PTP hw clock driver")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-07 13:43:38 +02:00
..
chain_mode.c
common.h net: stmmac: 16KB buffer must be 16 byte aligned 2020-04-07 13:37:51 +02:00
descs_com.h net: stmmac: use correct DMA buffer size in the RX descriptor 2020-04-07 13:13:01 +02:00
descs.h
dwmac100_core.c
dwmac100_dma.c
dwmac100.h
dwmac1000_core.c
dwmac1000_dma.c
dwmac1000.h
dwmac_dma.h
dwmac_lib.c
dwmac-generic.c
dwmac-ipq806x.c net: ethernet: stmmac: Fix signedness bug in ipq806x_gmac_of_parse() 2020-04-07 13:43:30 +02:00
dwmac-lpc18xx.c
dwmac-meson.c
dwmac-rk.c
dwmac-socfpga.c
dwmac-sti.c
dwmac-sunxi.c net: stmmac: dwmac-sunxi: Allow all RGMII modes 2020-04-07 13:29:04 +02:00
enh_desc.c net: stmmac: use correct DMA buffer size in the RX descriptor 2020-04-07 13:13:01 +02:00
Kconfig
Makefile
mmc_core.c
mmc.h
norm_desc.c net: stmmac: use correct DMA buffer size in the RX descriptor 2020-04-07 13:13:01 +02:00
ring_mode.c
stmmac_ethtool.c
stmmac_hwtstamp.c
stmmac_main.c net: stmmac: Enable 16KB buffer size 2020-04-07 13:37:53 +02:00
stmmac_mdio.c
stmmac_pci.c
stmmac_platform.c
stmmac_platform.h
stmmac_ptp.c net: stmmac: fix length of PTP clock's name string 2020-04-07 13:43:38 +02:00
stmmac_ptp.h
stmmac.h