Commit c74bfbdb authored by Willem de Bruijn's avatar Willem de Bruijn Committed by David S. Miller

sctp: load transport header after sk_filter

Do not cache pointers into the skb linear segment across sk_filter.
The function call can trigger pskb_expand_head.
Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0564bf0a
...@@ -112,7 +112,6 @@ int sctp_rcv(struct sk_buff *skb) ...@@ -112,7 +112,6 @@ int sctp_rcv(struct sk_buff *skb)
struct sctp_ep_common *rcvr; struct sctp_ep_common *rcvr;
struct sctp_transport *transport = NULL; struct sctp_transport *transport = NULL;
struct sctp_chunk *chunk; struct sctp_chunk *chunk;
struct sctphdr *sh;
union sctp_addr src; union sctp_addr src;
union sctp_addr dest; union sctp_addr dest;
int family; int family;
...@@ -127,8 +126,6 @@ int sctp_rcv(struct sk_buff *skb) ...@@ -127,8 +126,6 @@ int sctp_rcv(struct sk_buff *skb)
if (skb_linearize(skb)) if (skb_linearize(skb))
goto discard_it; goto discard_it;
sh = sctp_hdr(skb);
/* Pull up the IP and SCTP headers. */ /* Pull up the IP and SCTP headers. */
__skb_pull(skb, skb_transport_offset(skb)); __skb_pull(skb, skb_transport_offset(skb));
if (skb->len < sizeof(struct sctphdr)) if (skb->len < sizeof(struct sctphdr))
...@@ -230,7 +227,7 @@ int sctp_rcv(struct sk_buff *skb) ...@@ -230,7 +227,7 @@ int sctp_rcv(struct sk_buff *skb)
chunk->rcvr = rcvr; chunk->rcvr = rcvr;
/* Remember the SCTP header. */ /* Remember the SCTP header. */
chunk->sctp_hdr = sh; chunk->sctp_hdr = sctp_hdr(skb);
/* Set the source and destination addresses of the incoming chunk. */ /* Set the source and destination addresses of the incoming chunk. */
sctp_init_addrs(chunk, &src, &dest); sctp_init_addrs(chunk, &src, &dest);
......
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