Skip to content

Commit c74bfbd

Browse files
wdebruijdavem330
authored andcommitted
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: 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>
1 parent 0564bf0 commit c74bfbd

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

net/sctp/input.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ int sctp_rcv(struct sk_buff *skb)
112112
struct sctp_ep_common *rcvr;
113113
struct sctp_transport *transport = NULL;
114114
struct sctp_chunk *chunk;
115-
struct sctphdr *sh;
116115
union sctp_addr src;
117116
union sctp_addr dest;
118117
int family;
@@ -127,8 +126,6 @@ int sctp_rcv(struct sk_buff *skb)
127126
if (skb_linearize(skb))
128127
goto discard_it;
129128

130-
sh = sctp_hdr(skb);
131-
132129
/* Pull up the IP and SCTP headers. */
133130
__skb_pull(skb, skb_transport_offset(skb));
134131
if (skb->len < sizeof(struct sctphdr))
@@ -230,7 +227,7 @@ int sctp_rcv(struct sk_buff *skb)
230227
chunk->rcvr = rcvr;
231228

232229
/* Remember the SCTP header. */
233-
chunk->sctp_hdr = sh;
230+
chunk->sctp_hdr = sctp_hdr(skb);
234231

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

0 commit comments

Comments
 (0)