Commit 23ec47a0 authored by Vladislav Yasevich's avatar Vladislav Yasevich Committed by David S. Miller

[SCTP]: Fix potential NULL pointer dereference in sctp_v4_get_saddr

It is possible to get to sctp_v4_get_saddr() without a valid
association.  This happens when processing OOTB packets and
the cached route entry is no longer valid.
However, when responding to OOTB packets we already properly
set the source address based on the information in the OOTB
packet.  So, if we we get to sctp_v4_get_saddr() without an
association we can simply return.
Signed-off-by: default avatarVladislav Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: default avatarSridhar Samudrala <sri@us.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8eb55910
...@@ -530,6 +530,9 @@ static void sctp_v4_get_saddr(struct sctp_association *asoc, ...@@ -530,6 +530,9 @@ static void sctp_v4_get_saddr(struct sctp_association *asoc,
{ {
struct rtable *rt = (struct rtable *)dst; struct rtable *rt = (struct rtable *)dst;
if (!asoc)
return;
if (rt) { if (rt) {
saddr->v4.sin_family = AF_INET; saddr->v4.sin_family = AF_INET;
saddr->v4.sin_port = asoc->base.bind_addr.port; saddr->v4.sin_port = asoc->base.bind_addr.port;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment