Commit e0ab9806 authored by Fedor Pchelkin's avatar Fedor Pchelkin Committed by Zheng Zengkai
Browse files

can: j1939: j1939_session_destroy(): fix memory leak of skbs

stable inclusion
from stable-v5.10.138
commit a220ff343396bae8d3b6abee72ab51f1f34b3027
category: bugfix
bugzilla: 187869, https://gitee.com/src-openeuler/kernel/issues/I5X3MU
CVE: CVE-2022-3633

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a220ff343396bae8d3b6abee72ab51f1f34b3027

--------------------------------

commit 8c21c54a upstream.

We need to drop skb references taken in j1939_session_skb_queue() when
destroying a session in j1939_session_destroy(). Otherwise those skbs
would be lost.

Link to Syzkaller info and repro: https://forge.ispras.ru/issues/11743.

Found by Linux Verification Center (linuxtesting.org) with Syzkaller.

V1: https://lore.kernel.org/all/20220708175949.539064-1-pchelkin@ispras.ru



Fixes: 9d71dd0c ("can: add support of SAE J1939 protocol")
Suggested-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/all/20220805150216.66313-1-pchelkin@ispras.ru


Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarDong Chenchen <dongchenchen2@huawei.com>
Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent e4f4becf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment