Skip to content

ch348: address remaining v9 review and robustness issues - #1

Open
dormancygrace wants to merge 5 commits into
xdarklight:v9-prep-20251221from
dormancygrace:fix/v9-review-findings
Open

ch348: address remaining v9 review and robustness issues#1
dormancygrace wants to merge 5 commits into
xdarklight:v9-prep-20251221from
dormancygrace:fix/v9-review-findings

Conversation

@dormancygrace

@dormancygrace dormancygrace commented Aug 31, 2026

Copy link
Copy Markdown

This series addresses issues found while checking the v9 preparation branch
against Johan's v8 review and the vendor driver's receive-path fixes.

  • Validate status and serial RX record boundaries before reading payload fields.
  • Avoid a division by zero for B0 and correct the stop-bit constants.
  • Clear stale transmit accounting after a killed write URB.
  • Reject malformed bulk-out endpoint sizes.
  • Finish normalizing error-message style requested during v8 review.

Validation:

  • Each commit passes checkpatch.pl --strict with 0 errors and 0 warnings.
  • External-module build with W=1 succeeds against Ubuntu
    6.8.0-138-generic headers.
  • The unmodified v9 base was previously smoke-tested on a physical CH348Q as
    documented in
    dormancygrace/ch9344-dkms.

Hardware testing of this exact series on the CH348Q is pending re-verification
of the test host's changed SSH host key.

The receive callbacks access fixed and variable-length records directly in
the URB buffer. A short final record can make the status path read fields
beyond actual_length and make the serial path pass stale bytes to the tty
layer.

Require a complete record header and payload before processing either
receive stream.

Signed-off-by: Gleb Pesin <dormancygrace@gmail.com>
Returning early for B0 avoids sending an unsupported zero baud rate and
prevents a division by zero while calculating the receive timeout.

Also correct the stop-bit constant names and assignments. The vendor
protocol uses 0x00 for one stop bit and 0x02 for two stop bits.

Signed-off-by: Gleb Pesin <dormancygrace@gmail.com>
The write callback deliberately leaves tx_bytes untouched when a write URB
is killed. Clear it after killing the URB so a later open does not inherit
stale pending-byte accounting.

Signed-off-by: Gleb Pesin <dormancygrace@gmail.com>
Reject devices whose endpoint buffers cannot hold the corresponding
protocol header. This prevents the serial transmit length calculation from
underflowing on malformed descriptors.

Signed-off-by: Gleb Pesin <dormancygrace@gmail.com>
Use lower-case messages and consistent wording as requested during the v8
review.

Signed-off-by: Gleb Pesin <dormancygrace@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant