]> git.baikalelectronics.ru Git - kernel.git/commit
sctp: sctp_sock_filter(): avoid list_entry() on possibly empty list
authorPietro Borrello <borrello@diag.uniroma1.it>
Thu, 9 Feb 2023 12:13:05 +0000 (12:13 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Feb 2023 11:50:40 +0000 (12:50 +0100)
commite809afb418eebbe1114d267a72e42501c1879f66
treebb47081a3e51aba9ed02f8d14acaf84c947b2266
parentaf2f720c34507678ccab6c275fc8e0028e8c9bbe
sctp: sctp_sock_filter(): avoid list_entry() on possibly empty list

commit a1221703a0f75a9d81748c516457e0fc76951496 upstream.

Use list_is_first() to check whether tsp->asoc matches the first
element of ep->asocs, as the list is not guaranteed to have an entry.

Fixes: 5b395b12047b ("sctp: add the sctp_diag.c file")
Signed-off-by: Pietro Borrello <borrello@diag.uniroma1.it>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://lore.kernel.org/r/20230208-sctp-filter-v2-1-6e1f4017f326@diag.uniroma1.it
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sctp/diag.c