Skip to content

net: wan: fix FSL UCC HDLC lifecycle bugs

Myeonghun Pak linuxppc-dev lkml netdev stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest4 patches 1 replyIn review

Changes in v3 from the cover letter

- split the generic unregister_hdlc_device() change into its own patch;
- audit all eight in-tree HDLC hardware drivers and document farsync;
- fix the NULL protocol dereference reported in uhdlc_open();
- keep NAPI enabled when the suspend backup allocation fails;
- rebase the series onto Linux 7.3-rc1.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4net: wan: fsl_ucc_hdlc: validate protocol before starting devicedrivers/net/wan/fsl_ucc_hdlc.c+9 -90 replies
2/4net: wan: fsl_ucc_hdlc: allocate suspend backup before quiescingdrivers/net/wan/fsl_ucc_hdlc.c+4 -40 replies
3/4net: wan: hdlc: close active devices before protocol detachdrivers/net/wan/hdlc.c+1 -01 reply
4/4net: wan: fsl_ucc_hdlc: release HDLC device on removedrivers/net/wan/fsl_ucc_hdlc.c+3 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH net v3 0/4] net: wan: fix FSL UCC HDLC lifecycle bugs

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

The v2 review found two pre-existing FSL UCC HDLC bugs and asked that the generic HDLC behavior change be separated and audited.

Patch 1 validates that an HDLC protocol is attached before starting the UCC, avoiding a NULL protocol dereference on a premature interface open. Patch 2 allocates the suspend backup before disabling NAPI, so allocation failure leaves the running interface usable. Patch 3 closes active HDLC devices before detaching their protocol and documents the audit of every current caller, including the farsync probe unwind. Patch 4 unregisters and frees the FSL UCC HDLC netdev before its private resources.

Patch 4 depends on patch 3 to stop an active device while its protocol is still attached and before UCC and DMA resources are released.

These fixes and changelogs were prepared with an LLM and then checked against the cited source paths and call ordering.

Changes since v2:
- split the generic unregister_hdlc_device() change into its own patch;
- audit all eight in-tree HDLC hardware drivers and document farsync;
- fix the NULL protocol dereference reported in uhdlc_open();
- keep NAPI enabled when the suspend backup allocation fails;
- rebase the series onto Linux 7.3-rc1.

v2: https://lore.kernel.org/r/[email protected]
review: https://lore.kernel.org/r/[email protected]

Validation:
The series applies cleanly to net commit 784450234395. All four patches pass strict checkpatch.
No hardware runtime testing was performed.

Myeonghun Pak (4):
net: wan: fsl_ucc_hdlc: validate protocol before starting device
net: wan: fsl_ucc_hdlc: allocate suspend backup before quiescing
net: wan: hdlc: close active devices before protocol detach
net: wan: fsl_ucc_hdlc: release HDLC device on remove

 drivers/net/wan/fsl_ucc_hdlc.c | 29 ++++++++++++++++-------------
 drivers/net/wan/hdlc.c         |  1 +
 2 files changed, 17 insertions(+), 13 deletions(-)

base-commit: cee9395acd8043be0644b25c34bfa86623f2b935

Signature · 1 line
2.47.1