Skip to content

Commit

Permalink
sctp: load transport header after sk_filter
Browse files Browse the repository at this point in the history
Do not cache pointers into the skb linear segment across sk_filter.
The function call can trigger pskb_expand_head.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Willem de Bruijn authored and David S. Miller committed Jul 19, 2016
1 parent 0564bf0 commit c74bfbd
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions net/sctp/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ int sctp_rcv(struct sk_buff *skb)
struct sctp_ep_common *rcvr;
struct sctp_transport *transport = NULL;
struct sctp_chunk *chunk;
struct sctphdr *sh;
union sctp_addr src;
union sctp_addr dest;
int family;
Expand All @@ -127,8 +126,6 @@ int sctp_rcv(struct sk_buff *skb)
if (skb_linearize(skb))
goto discard_it;

sh = sctp_hdr(skb);

/* Pull up the IP and SCTP headers. */
__skb_pull(skb, skb_transport_offset(skb));
if (skb->len < sizeof(struct sctphdr))
Expand Down Expand Up @@ -230,7 +227,7 @@ int sctp_rcv(struct sk_buff *skb)
chunk->rcvr = rcvr;

/* Remember the SCTP header. */
chunk->sctp_hdr = sh;
chunk->sctp_hdr = sctp_hdr(skb);

/* Set the source and destination addresses of the incoming chunk. */
sctp_init_addrs(chunk, &src, &dest);
Expand Down

0 comments on commit c74bfbd

Please sign in to comment.