提交 23ec47a0 编写于 作者: V Vladislav Yasevich 提交者: 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: NVladislav Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: NSridhar Samudrala <sri@us.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册