* [PATCH v2] net: hamradio: 6pack: fix uninit-value in sixpack_receive_buf [not found] <20260407165007.GB469338@kernel.org> @ 2026-04-07 17:31 ` Mashiro Chen 2026-04-10 16:13 ` Simon Horman 2026-04-10 22:30 ` patchwork-bot+netdevbpf 0 siblings, 2 replies; 3+ messages in thread From: Mashiro Chen @ 2026-04-07 17:31 UTC (permalink / raw) To: netdev Cc: horms, davem, edumazet, kuba, pabeni, linux-hams, stable, Mashiro Chen, syzbot+ecdb8c9878a81eb21e54 sixpack_receive_buf() does not properly skip bytes with TTY error flags. The while loop iterates through the flags buffer but never advances the data pointer (cp), and passes the original count (including error bytes) to sixpack_decode(). This causes sixpack_decode() to process bytes that should have been skipped due to TTY errors. The TTY layer does not guarantee that cp[i] holds a meaningful value when fp[i] is set, so passing those positions to sixpack_decode() results in KMSAN reporting an uninit-value read. Fix this by processing bytes one at a time, advancing cp on each iteration, and only passing valid (non-error) bytes to sixpack_decode(). This matches the pattern used by slip_receive_buf() and mkiss_receive_buf() for the same purpose. Reported-by: syzbot+ecdb8c9878a81eb21e54@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=ecdb8c9878a81eb21e54 Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Mashiro Chen <mashiro.chen@mailbox.org> --- drivers/net/hamradio/6pack.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 885992951e8a6..c8b2dc5c1becc 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -391,7 +391,6 @@ static void sixpack_receive_buf(struct tty_struct *tty, const u8 *cp, const u8 *fp, size_t count) { struct sixpack *sp; - size_t count1; if (!count) return; @@ -401,16 +400,16 @@ static void sixpack_receive_buf(struct tty_struct *tty, const u8 *cp, return; /* Read the characters out of the buffer */ - count1 = count; - while (count) { - count--; + while (count--) { if (fp && *fp++) { if (!test_and_set_bit(SIXPF_ERROR, &sp->flags)) sp->dev->stats.rx_errors++; + cp++; continue; } + sixpack_decode(sp, cp, 1); + cp++; } - sixpack_decode(sp, cp, count1); tty_unthrottle(tty); } -- 2.53.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: hamradio: 6pack: fix uninit-value in sixpack_receive_buf 2026-04-07 17:31 ` [PATCH v2] net: hamradio: 6pack: fix uninit-value in sixpack_receive_buf Mashiro Chen @ 2026-04-10 16:13 ` Simon Horman 2026-04-10 22:30 ` patchwork-bot+netdevbpf 1 sibling, 0 replies; 3+ messages in thread From: Simon Horman @ 2026-04-10 16:13 UTC (permalink / raw) To: Mashiro Chen Cc: netdev, davem, edumazet, kuba, pabeni, linux-hams, stable, syzbot+ecdb8c9878a81eb21e54 On Wed, Apr 08, 2026 at 01:31:01AM +0800, Mashiro Chen wrote: > sixpack_receive_buf() does not properly skip bytes with TTY error flags. > The while loop iterates through the flags buffer but never advances the > data pointer (cp), and passes the original count (including error bytes) > to sixpack_decode(). This causes sixpack_decode() to process bytes that > should have been skipped due to TTY errors. The TTY layer does not > guarantee that cp[i] holds a meaningful value when fp[i] is set, so > passing those positions to sixpack_decode() results in KMSAN reporting > an uninit-value read. > > Fix this by processing bytes one at a time, advancing cp on each > iteration, and only passing valid (non-error) bytes to sixpack_decode(). > This matches the pattern used by slip_receive_buf() and > mkiss_receive_buf() for the same purpose. > > Reported-by: syzbot+ecdb8c9878a81eb21e54@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=ecdb8c9878a81eb21e54 > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Signed-off-by: Mashiro Chen <mashiro.chen@mailbox.org> Thanks for the updates. Reviewed-by: Simon Horman <horms@kernel.org> ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: hamradio: 6pack: fix uninit-value in sixpack_receive_buf 2026-04-07 17:31 ` [PATCH v2] net: hamradio: 6pack: fix uninit-value in sixpack_receive_buf Mashiro Chen 2026-04-10 16:13 ` Simon Horman @ 2026-04-10 22:30 ` patchwork-bot+netdevbpf 1 sibling, 0 replies; 3+ messages in thread From: patchwork-bot+netdevbpf @ 2026-04-10 22:30 UTC (permalink / raw) To: Mashiro Chen Cc: netdev, horms, davem, edumazet, kuba, pabeni, linux-hams, stable, syzbot+ecdb8c9878a81eb21e54 Hello: This patch was applied to netdev/net.git (main) by Jakub Kicinski <kuba@kernel.org>: On Wed, 8 Apr 2026 01:31:01 +0800 you wrote: > sixpack_receive_buf() does not properly skip bytes with TTY error flags. > The while loop iterates through the flags buffer but never advances the > data pointer (cp), and passes the original count (including error bytes) > to sixpack_decode(). This causes sixpack_decode() to process bytes that > should have been skipped due to TTY errors. The TTY layer does not > guarantee that cp[i] holds a meaningful value when fp[i] is set, so > passing those positions to sixpack_decode() results in KMSAN reporting > an uninit-value read. > > [...] Here is the summary with links: - [v2] net: hamradio: 6pack: fix uninit-value in sixpack_receive_buf https://git.kernel.org/netdev/net/c/bf9a38803b26 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-10 22:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260407165007.GB469338@kernel.org>
2026-04-07 17:31 ` [PATCH v2] net: hamradio: 6pack: fix uninit-value in sixpack_receive_buf Mashiro Chen
2026-04-10 16:13 ` Simon Horman
2026-04-10 22:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox