From: Vladislav Yasevich Date: Sat, 12 Nov 2005 00:05:55 +0000 (-0800) Subject: [SCTP]: Fix potential NULL pointer dereference in sctp_v4_get_saddr X-Git-Tag: upstream/snapshot3+hdmi~44813^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=23ec47a0889dabf4b9e7f8d52e848194734159ee;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git [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: Vladislav Yasevich Signed-off-by: Sridhar Samudrala Signed-off-by: David S. Miller --- diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 26de4d3..dc9dff3 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -530,6 +530,9 @@ static void sctp_v4_get_saddr(struct sctp_association *asoc, { struct rtable *rt = (struct rtable *)dst; + if (!asoc) + return; + if (rt) { saddr->v4.sin_family = AF_INET; saddr->v4.sin_port = asoc->base.bind_addr.port;