Skip to content

Commit 224be9b

Browse files
committed
net: Rename and export copy_skb_header
jira VULN-1439 cve-prereq CVE-2022-33741 commit-author Ilya Lesokhin <[email protected]> commit 08303c1 copy_skb_header is renamed to skb_copy_header and exported. Exposing this function give more flexibility in copying SKBs. skb_copy and skb_copy_expand do not give enough control over which parts are copied. Signed-off-by: Ilya Lesokhin <[email protected]> Signed-off-by: Boris Pismenny <[email protected]> Signed-off-by: David S. Miller <[email protected]> (cherry picked from commit 08303c1) Signed-off-by: Brett Mastbergen <[email protected]>
1 parent e3d43eb commit 224be9b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

include/linux/skbuff.h

+1
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,7 @@ static inline struct sk_buff *alloc_skb_head(gfp_t priority)
10301030
struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
10311031
int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
10321032
struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority);
1033+
void skb_copy_header(struct sk_buff *new, const struct sk_buff *old);
10331034
struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority);
10341035
struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask);
10351036

net/core/skbuff.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -1115,14 +1115,15 @@ static void skb_headers_offset_update(struct sk_buff *skb, int off)
11151115
skb->inner_mac_header += off;
11161116
}
11171117

1118-
static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
1118+
void skb_copy_header(struct sk_buff *new, const struct sk_buff *old)
11191119
{
11201120
__copy_skb_header(new, old);
11211121

11221122
skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size;
11231123
skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs;
11241124
skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type;
11251125
}
1126+
EXPORT_SYMBOL(skb_copy_header);
11261127

11271128
static inline int skb_alloc_rx_flag(const struct sk_buff *skb)
11281129
{
@@ -1166,7 +1167,7 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
11661167
if (skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len))
11671168
BUG();
11681169

1169-
copy_skb_header(n, skb);
1170+
skb_copy_header(n, skb);
11701171
return n;
11711172
}
11721173
EXPORT_SYMBOL(skb_copy);
@@ -1225,7 +1226,7 @@ struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask)
12251226
skb_clone_fraglist(n);
12261227
}
12271228

1228-
copy_skb_header(n, skb);
1229+
skb_copy_header(n, skb);
12291230
out:
12301231
return n;
12311232
}
@@ -1396,7 +1397,7 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
13961397
skb->len + head_copy_len))
13971398
BUG();
13981399

1399-
copy_skb_header(n, skb);
1400+
skb_copy_header(n, skb);
14001401

14011402
skb_headers_offset_update(n, newheadroom - oldheadroom);
14021403

0 commit comments

Comments
 (0)