Skip to content

Commit b2d3ea4

Browse files
edumazetdavem330
authored andcommitted
tcp: switch back to proper tcp_skb_cb size check in tcp_init()
Revert to the tcp_skb_cb size check that tcp_init() had before commit b4772ef ("net: use common macro for assering skb->cb[] available size in protocol families"). As related commit 744d5a3 ("net: move skb->dropcount to skb->cb[]") explains, the sock_skb_cb_check_size() mechanism was added to ensure that there is space for dropcount, "for protocol families using it". But TCP is not a protocol using dropcount, so tcp_init() doesn't need to provision space for dropcount in the skb->cb[], and thus we can revert to the older form of the tcp_skb_cb size check. Doing so allows TCP to use 4 more bytes of the skb->cb[] space. Fixes: b4772ef ("net: use common macro for assering skb->cb[] available size in protocol families") Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: Soheil Hassas Yeganeh <[email protected]> Signed-off-by: Neal Cardwell <[email protected]> Signed-off-by: Yuchung Cheng <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7787914 commit b2d3ea4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/ipv4/tcp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3261,11 +3261,12 @@ static void __init tcp_init_mem(void)
32613261

32623262
void __init tcp_init(void)
32633263
{
3264-
unsigned long limit;
32653264
int max_rshare, max_wshare, cnt;
3265+
unsigned long limit;
32663266
unsigned int i;
32673267

3268-
sock_skb_cb_check_size(sizeof(struct tcp_skb_cb));
3268+
BUILD_BUG_ON(sizeof(struct tcp_skb_cb) >
3269+
FIELD_SIZEOF(struct sk_buff, cb));
32693270

32703271
percpu_counter_init(&tcp_sockets_allocated, 0, GFP_KERNEL);
32713272
percpu_counter_init(&tcp_orphan_count, 0, GFP_KERNEL);

0 commit comments

Comments
 (0)