diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-06-14 18:24:04 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-15 00:38:36 +0200 |
commit | f9e42b853523cda0732022c2e0473c183f7aec65 (patch) | |
tree | 2fafd6347ab04c066b51759d0e85cc53a7378d35 /net/sctp/proc.c | |
parent | Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jesse/... (diff) | |
download | linux-f9e42b853523cda0732022c2e0473c183f7aec65.tar.xz linux-f9e42b853523cda0732022c2e0473c183f7aec65.zip |
net: sctp: sideeffect: throw BUG if primary_path is NULL
This clearly states a BUG somewhere in the SCTP code as e.g. fixed once
in f28156335 ("sctp: Use correct sideffect command in duplicate cookie
handling"). If this ever happens, throw a trace in the sideeffect engine
where assocs clearly must have a primary_path assigned.
When in sctp_seq_dump_local_addrs() also throw a WARN and bail out since
we do not need to panic for printing this one asterisk. Also, it will
avoid the not so obvious case when primary != NULL test passes and at a
later point in time triggering a NULL ptr dereference caused by primary.
While at it, also fix up the white space.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/proc.c')
-rw-r--r-- | net/sctp/proc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/net/sctp/proc.c b/net/sctp/proc.c index 4e45ee35d0db..0c83162a6bf8 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c @@ -134,9 +134,15 @@ static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_commo struct sctp_af *af; if (epb->type == SCTP_EP_TYPE_ASSOCIATION) { - asoc = sctp_assoc(epb); - peer = asoc->peer.primary_path; - primary = &peer->saddr; + asoc = sctp_assoc(epb); + + peer = asoc->peer.primary_path; + if (unlikely(peer == NULL)) { + WARN(1, "Association %p with NULL primary path!", asoc); + return; + } + + primary = &peer->saddr; } rcu_read_lock(); |