Skip to content
Commit 9aa9379d authored by Anant Thazhemadam's avatar Anant Thazhemadam Committed by Marc Kleine-Budde
Browse files

can: af_can: prevent potential access of uninitialized member in canfd_rcv()



In canfd_rcv(), cfd->len is uninitialized when skb->len = 0, and this
uninitialized cfd->len is accessed nonetheless by pr_warn_once().

Fix this uninitialized variable access by checking cfd->len's validity
condition (cfd->len > CANFD_MAX_DLEN) separately after the skb->len's
condition is checked, and appropriately modify the log messages that
are generated as well.
In case either of the required conditions fail, the skb is freed and
NET_RX_DROP is returned, same as before.

Fixes: d4689846 ("can: af_can: canfd_rcv(): replace WARN_ONCE by pr_warn_once")
Reported-by: default avatar <syzbot+9bcb0c9409066696d3aa@syzkaller.appspotmail.com>
Tested-by: default avatarAnant Thazhemadam <anant.thazhemadam@gmail.com>
Signed-off-by: default avatarAnant Thazhemadam <anant.thazhemadam@gmail.com>
Link: https://lore.kernel.org/r/20201103213906.24219-3-anant.thazhemadam@gmail.com


Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent c8c958a5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment