summaryrefslogtreecommitdiffstats
path: root/net/strparser
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2019-06-03 18:16:58 -0400
committerDavid S. Miller <davem@davemloft.net>2019-06-04 17:33:50 -0400
commitda29e4b466e6916a52e0e2f60054f855c324a9c2 (patch)
tree920af641fcecb8ac9956ded01c33df742c917add /net/strparser
parent7e7d199e05f80735864efcb5b306fefd98039a58 (diff)
net/tls: fully initialize the msg wrapper skb
If strparser gets cornered into starting a new message from an sk_buff which already has frags, it will allocate a new skb to become the "wrapper" around the fragments of the message. This new skb does not inherit any metadata fields. In case of TLS offload this may lead to unnecessarily re-encrypting the message, as skb->decrypted is not set for the wrapper skb. Try to be conservative and copy all fields of old skb strparser's user may reasonably need. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Reviewed-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/strparser')
-rw-r--r--net/strparser/strparser.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c
index e137698e8aef..3fe541b746b0 100644
--- a/net/strparser/strparser.c
+++ b/net/strparser/strparser.c
@@ -160,18 +160,14 @@ static int __strp_recv(read_descriptor_t *desc, struct sk_buff *orig_skb,
160 return 0; 160 return 0;
161 } 161 }
162 162
163 skb = alloc_skb(0, GFP_ATOMIC); 163 skb = alloc_skb_for_msg(head);
164 if (!skb) { 164 if (!skb) {
165 STRP_STATS_INCR(strp->stats.mem_fail); 165 STRP_STATS_INCR(strp->stats.mem_fail);
166 desc->error = -ENOMEM; 166 desc->error = -ENOMEM;
167 return 0; 167 return 0;
168 } 168 }
169 skb->len = head->len; 169
170 skb->data_len = head->len;
171 skb->truesize = head->truesize;
172 *_strp_msg(skb) = *_strp_msg(head);
173 strp->skb_nextp = &head->next; 170 strp->skb_nextp = &head->next;
174 skb_shinfo(skb)->frag_list = head;
175 strp->skb_head = skb; 171 strp->skb_head = skb;
176 head = skb; 172 head = skb;
177 } else { 173 } else {