Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
d3e54fc0
Commit
d3e54fc0
authored
Sep 02, 2002
by
Alexey Kuznetsov
Committed by
David S. Miller
Sep 02, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net/ipv4/tcp_output.c: Fix crashes due to bugs in TSO.
parent
c5402fdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
8 deletions
+51
-8
net/ipv4/tcp_output.c
net/ipv4/tcp_output.c
+51
-8
No files found.
net/ipv4/tcp_output.c
View file @
d3e54fc0
...
...
@@ -478,6 +478,56 @@ static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len)
return
0
;
}
/* This is similar to __pskb_pull_head() (it will go to core/skbuff.c
* eventually). The difference is that pulled data not copied, but
* immediately discarded.
*/
unsigned
char
*
__pskb_trim_head
(
struct
sk_buff
*
skb
,
int
len
)
{
int
i
,
k
,
eat
;
eat
=
len
;
k
=
0
;
for
(
i
=
0
;
i
<
skb_shinfo
(
skb
)
->
nr_frags
;
i
++
)
{
if
(
skb_shinfo
(
skb
)
->
frags
[
i
].
size
<=
eat
)
{
put_page
(
skb_shinfo
(
skb
)
->
frags
[
i
].
page
);
eat
-=
skb_shinfo
(
skb
)
->
frags
[
i
].
size
;
}
else
{
skb_shinfo
(
skb
)
->
frags
[
k
]
=
skb_shinfo
(
skb
)
->
frags
[
i
];
if
(
eat
)
{
skb_shinfo
(
skb
)
->
frags
[
k
].
page_offset
+=
eat
;
skb_shinfo
(
skb
)
->
frags
[
k
].
size
-=
eat
;
eat
=
0
;
}
k
++
;
}
}
skb_shinfo
(
skb
)
->
nr_frags
=
k
;
skb
->
tail
=
skb
->
data
;
skb
->
data_len
-=
len
;
skb
->
len
=
skb
->
data_len
;
return
skb
->
tail
;
}
static
int
tcp_trim_head
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
u32
len
)
{
if
(
skb_cloned
(
skb
)
&&
pskb_expand_head
(
skb
,
0
,
0
,
GFP_ATOMIC
))
return
-
ENOMEM
;
if
(
len
<=
skb_headlen
(
skb
))
{
__skb_pull
(
skb
,
len
);
}
else
{
if
(
__pskb_trim_head
(
skb
,
len
-
skb_headlen
(
skb
))
==
NULL
)
return
-
ENOMEM
;
}
TCP_SKB_CB
(
skb
)
->
seq
+=
len
;
skb
->
ip_summed
=
CHECKSUM_HW
;
return
0
;
}
/* This function synchronize snd mss to current pmtu/exthdr set.
tp->user_mss is mss set by user by TCP_MAXSEG. It does NOT counts
...
...
@@ -836,8 +886,6 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
return
-
EAGAIN
;
if
(
before
(
TCP_SKB_CB
(
skb
)
->
seq
,
tp
->
snd_una
))
{
struct
sk_buff
*
skb2
;
if
(
before
(
TCP_SKB_CB
(
skb
)
->
end_seq
,
tp
->
snd_una
))
BUG
();
...
...
@@ -847,13 +895,8 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
tp
->
mss_cache
=
tp
->
mss_cache_std
;
}
if
(
tcp_fragment
(
sk
,
skb
,
tp
->
snd_una
-
TCP_SKB_CB
(
skb
)
->
seq
))
if
(
tcp_trim_head
(
sk
,
skb
,
tp
->
snd_una
-
TCP_SKB_CB
(
skb
)
->
seq
))
return
-
ENOMEM
;
skb2
=
skb
->
next
;
__skb_unlink
(
skb
,
skb
->
list
);
tcp_free_skb
(
sk
,
skb
);
skb
=
skb2
;
}
/* If receiver has shrunk his window, and skb is out of
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment