mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sctp: avoid NULL pointer dereference in sctp_sf_violation
@ 2021-11-02 20:27 Alexey Khoroshilov
  2021-11-03 12:43 ` Xin Long
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Khoroshilov @ 2021-11-02 20:27 UTC (permalink / raw)
  To: Vlad Yasevich, Neil Horman, Marcelo Ricardo Leitner, David S. Miller
  Cc: Jakub Kicinski, Xin Long, linux-sctp, netdev, linux-kernel,
	ldv-project, Alexey Khoroshilov

Some callers (e.g. sctp_sf_violation_chunk) passes NULL to
asoc argument of sctp_sf_violation. So, it should check it
before calling sctp_vtag_verify().

Probably it could be exploited by a malicious SCTP packet
to cause NULL pointer dereference.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Fixes: aa0f697e4528 ("sctp: add vtag check in sctp_sf_violation")
---
 net/sctp/sm_statefuns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index fb3da4d8f4a3..77f3cd6c516e 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4669,7 +4669,7 @@ enum sctp_disposition sctp_sf_violation(struct net *net,
 {
 	struct sctp_chunk *chunk = arg;
 
-	if (!sctp_vtag_verify(chunk, asoc))
+	if (asoc && !sctp_vtag_verify(chunk, asoc))
 		return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
 
 	/* Make sure that the chunk has a valid length. */
-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-07 19:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 20:27 [PATCH] sctp: avoid NULL pointer dereference in sctp_sf_violation Alexey Khoroshilov
2021-11-03 12:43 ` Xin Long
2021-11-05 17:30   ` [PATCH] sctp: remove unreachable code from sctp_sf_violation_chunk() Alexey Khoroshilov
2021-11-07 19:40     ` 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

all inboxes | Powered by JetHome®