aboutsummaryrefslogtreecommitdiffstats
path: root/mm/truncate.c
diff options
context:
space:
mode:
authorDave Martin <dave.martin@linaro.org>2011-03-03 05:41:12 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-03-10 11:49:06 -0500
commit6f685c5cdd29649cf8cc8f57c72791159f936e07 (patch)
tree892575c8f378609771752e12e88d4f2699084c70 /mm/truncate.c
parent23bfdacf4eb525ff3404161429cedaa281c23e47 (diff)
ARM: 6781/1: Thumb-2: Work around buggy Thumb-2 short branch relocations in gas
Various binutils versions can resolve Thumb-2 branches to locally-defined, preemptible global symbols as short-range "b.n" branch instructions. This is a problem, because there's no guarantee the final destination of the symbol, or any candidate locations for a trampoline, are within range of the branch. For this reason, the kernel does not support fixing up the R_ARM_THM_JUMP11 (102) relocation in modules at all, and it makes little sense to add support. The symptom is that the kernel fails with an "unsupported relocation" error when loading some modules. Until fixed tools are available, passing -fno-optimize-sibling-calls to gcc should prevent gcc generating code which hits this problem, at the cost of a bit of extra runtime stack usage in some cases. The problem is described in more detail at: https://bugs.launchpad.net/binutils-linaro/+bug/725126 Only Thumb-2 kernels are affected. This patch adds a new CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11 config option which adds -fno-optimize-sibling-calls to CFLAGS_MODULE when building a Thumb-2 kernel. Signed-off-by: Dave Martin <dave.martin@linaro.org> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'mm/truncate.c')
0 files changed, 0 insertions, 0 deletions
et/ll_poll.h to include/net/busy_poll.h' href='/cgit/cgit.cgi/litmus-rt-ext-res.git/commit/net/ipv4/tcp_ipv4.c?id=076bb0c82a44fbe46fe2c8527a5b5b64b69f679d'>076bb0c82a44
1da177e4c3f4






cfb6eeb4c860


ab32ea5d8a76

4bc2f18ba4f2
1da177e4c3f4
1da177e4c3f4
cfb6eeb4c860
a915da9b6927
318cf7aaa0a6
cfb6eeb4c860

5caea4ea7088
4bc2f18ba4f2
1da177e4c3f4
cf533ea53ebf
1da177e4c3f4
eddc9ec53be2

aa8223c7bb0b

1da177e4c3f4

6d6ee43e0b8b

















9d729f72dca9
6d6ee43e0b8b










6d6ee43e0b8b

1da177e4c3f4


2d7192d6cbab
1da177e4c3f4

dca8b089c95d
bada8adc4e66
da905bd1d5a6
2d7192d6cbab
1da177e4c3f4
f6d8bd051c39
1da177e4c3f4







f6d8bd051c39


1da177e4c3f4

f6d8bd051c39
1da177e4c3f4

dca8b089c95d

da905bd1d5a6

b23dd4fe42b4





7c73a6faffae
b23dd4fe42b4
584bdf8cbdf6
1da177e4c3f4





f6d8bd051c39
da905bd1d5a6
1da177e4c3f4
c720c7e8383a
da905bd1d5a6
c720c7e8383a
1da177e4c3f4
c720c7e8383a
1da177e4c3f4


ee9952831cfd

1da177e4c3f4

295ff7edb8f7
81166dd6fa8e

1da177e4c3f4
c720c7e8383a

1da177e4c3f4
d83d8461f902
f6d8bd051c39

1da177e4c3f4
bee7ca9ec03a
1da177e4c3f4






a7f5e7f16478
1da177e4c3f4


da905bd1d5a6
b23dd4fe42b4



1da177e4c3f4
b23dd4fe42b4
1da177e4c3f4
bcd76111178e
d8d1f30b95a6
1da177e4c3f4
ee9952831cfd
c720c7e8383a


1da177e4c3f4

c720c7e8383a
1da177e4c3f4
2b9164771efe
ee9952831cfd
1da177e4c3f4






7174259e6ced



1da177e4c3f4


c720c7e8383a
1da177e4c3f4

4bc2f18ba4f2
1da177e4c3f4
1da177e4c3f4
563d34d05786


1da177e4c3f4
563d34d05786
1da177e4c3f4


563d34d05786
1da177e4c3f4
80d0a69fc577

1da177e4c3f4

1da177e4c3f4








482fc6094afa
d83d8461f902
1da177e4c3f4










55be7a9c6074



1ed5c48f231c
6700c2709c08
55be7a9c6074

1da177e4c3f4















4d1a2d9ec1c1
1da177e4c3f4
b71d1d426d26
4d1a2d9ec1c1
f1ecd5d9e736
1da177e4c3f4

4d1a2d9ec1c1

1da177e4c3f4
f1ecd5d9e736
168a8f58059a
1da177e4c3f4
f1ecd5d9e736
1da177e4c3f4
4d1a2d9ec1c1
1da177e4c3f4
4d1a2d9ec1c1
dcfc23cac103
1da177e4c3f4


fd54d716b1f6
4d1a2d9ec1c1
1da177e4c3f4
dcfc23cac103
1da177e4c3f4


9469c7b4aa21
1da177e4c3f4





563d34d05786

1da177e4c3f4
b74aa930ef49



1da177e4c3f4


97e3ecd112ba




f1ecd5d9e736
1da177e4c3f4
168a8f58059a
1da177e4c3f4

168a8f58059a


de0744af1fe2
1da177e4c3f4



55be7a9c6074


1da177e4c3f4










0d4f0608619d






563d34d05786
144d56e91044
563d34d05786
144d56e91044



1da177e4c3f4



f1ecd5d9e736







168a8f58059a

8f49c2703b33


f1ecd5d9e736
9ad7c049f0f7

f1ecd5d9e736










f1ecd5d9e736





1da177e4c3f4







168a8f58059a







1da177e4c3f4
60236fdd08b2
1da177e4c3f4



463c84b97f24

1da177e4c3f4





547b792cac0a
1da177e4c3f4
2e6599cb899b
de0744af1fe2
1da177e4c3f4








463c84b97f24
848bf15f361c
1da177e4c3f4



168a8f58059a

1da177e4c3f4

1da177e4c3f4







































28850dc7c71d
1da177e4c3f4
aa8223c7bb0b
1da177e4c3f4
84fa7933a33f
419f9f896074
663ead3bb8d5
ff1dcadb1b55
1da177e4c3f4
419f9f896074
07f0757a6808
1da177e4c3f4




419f9f896074
bb29624614c2
419f9f896074
cf533ea53ebf
419f9f896074


4bc2f18ba4f2
419f9f896074
1da177e4c3f4












cfb6eeb4c860
1da177e4c3f4
cf533ea53ebf
cfb6eeb4c860


714e85be3557
cfb6eeb4c860

1da177e4c3f4
cfb6eeb4c860

658ddaaf6694



cfb6eeb4c860
a86b1e301945
1da177e4c3f4




511c3f92ad5b
1da177e4c3f4


cfb6eeb4c860




1da177e4c3f4

cfb6eeb4c860
1da177e4c3f4
cfb6eeb4c860


1da177e4c3f4

7174259e6ced
cfb6eeb4c860



658ddaaf6694









da5e36308d9f

658ddaaf6694


















cfb6eeb4c860








49a72dfb8814
78e645cb890b

cfb6eeb4c860

eddc9ec53be2

52cd5750e81e
1da177e4c3f4
88ef4a5a78e6
e2446eaab558
4c67525849e0

e2446eaab558
4c67525849e0

1da177e4c3f4
adf30907d638
66b13d99d96a
be9f4a44e7d4
70e7341673a4
1da177e4c3f4
63231bddf651

658ddaaf6694







1da177e4c3f4





9501f9722922
ee684b6f2830
88ef4a5a78e6
66b13d99d96a
1da177e4c3f4
cf533ea53ebf
1da177e4c3f4

714e85be3557
cfb6eeb4c860
714e85be3557
cfb6eeb4c860

1da177e4c3f4

adf30907d638
1da177e4c3f4

7174259e6ced
1da177e4c3f4


ee684b6f2830
cfb6eeb4c860


ee684b6f2830

cb48cfe8079d
1da177e4c3f4










cfb6eeb4c860
cfb6eeb4c860
ee684b6f2830
cfb6eeb4c860







49a72dfb8814
90b7e1120bb4

cfb6eeb4c860

88ef4a5a78e6
eddc9ec53be2

1da177e4c3f4

9501f9722922

66b13d99d96a
be9f4a44e7d4
70e7341673a4
1da177e4c3f4
63231bddf651
1da177e4c3f4



8feaf0c0a548
cfb6eeb4c860
1da177e4c3f4
9501f9722922
7174259e6ced
ee684b6f2830
9501f9722922

88ef4a5a78e6
66b13d99d96a

9501f9722922
1da177e4c3f4
8feaf0c0a548
1da177e4c3f4

6edafaaf6f5e
7174259e6ced
1da177e4c3f4
168a8f58059a





ee684b6f2830
9501f9722922

a915da9b6927

66b13d99d96a

1da177e4c3f4

1da177e4c3f4
9bf1d83e7ee6
60236fdd08b2
1da177e4c3f4

72659ecce685

397b41746333
1da177e4c3f4
2e6599cb899b
6bd023f3dddf
1da177e4c3f4



ba3f7f04ef2b
fd80eb942ad9
1da177e4c3f4
1a2c6181c4a1
1da177e4c3f4

634fb979e8f3
1da177e4c3f4
fff326990789
634fb979e8f3

2e6599cb899b
b9df3cb8cf9a
016818d07687

1da177e4c3f4

1da177e4c3f4


1a2c6181c4a1
fd80eb942ad9
397b41746333
e6c022a4fa2d



fd80eb942ad9

1da177e4c3f4
60236fdd08b2
1da177e4c3f4
60236fdd08b2
1da177e4c3f4
a51482bde22f
1da177e4c3f4

946cedccbd73
a2a385d627e1
946cedccbd73
a2a385d627e1
946cedccbd73

1da177e4c3f4
946cedccbd73
a2a385d627e1
946cedccbd73


1da177e4c3f4
2a1d4bd46047
946cedccbd73
2a1d4bd46047
a2a385d627e1
946cedccbd73

80e40daa4797
946cedccbd73


5ad37d5deee1
946cedccbd73
afd465030acb
946cedccbd73


2a1d4bd46047
946cedccbd73
1da177e4c3f4

60236fdd08b2
1da177e4c3f4
5dff747b7038
1da177e4c3f4
f6d8bd051c39

1da177e4c3f4

f6d8bd051c39

1da177e4c3f4

f6d8bd051c39
1da177e4c3f4







cfb6eeb4c860







a915da9b6927


cfb6eeb4c860

a915da9b6927
a915da9b6927
a8afca032998
cfb6eeb4c860
a8afca032998

b4fb05ea402c

a8afca032998
cfb6eeb4c860
a915da9b6927



b67bfe0d42ca
a915da9b6927



cfb6eeb4c860


a915da9b6927
cfb6eeb4c860



a915da9b6927



cfb6eeb4c860
cfb6eeb4c860

f5b99bcdddfb

cfb6eeb4c860
a915da9b6927

634fb979e8f3
a915da9b6927
cfb6eeb4c860


a915da9b6927

cfb6eeb4c860

b0a713e9e609
cfb6eeb4c860
a915da9b6927
cfb6eeb4c860
c0353c7b5da4
cfb6eeb4c860

a915da9b6927
b0a713e9e609
a915da9b6927

260fcbeb1ae9
a8afca032998

a915da9b6927


cfb6eeb4c860
cfb6eeb4c860
a915da9b6927

a8afca032998
a915da9b6927
cfb6eeb4c860
5f3d9cb29629
a915da9b6927

71cea17ed39f
5f3d9cb29629
a915da9b6927
cfb6eeb4c860
a915da9b6927







cfb6eeb4c860

a915da9b6927
cfb6eeb4c860
a915da9b6927
cfb6eeb4c860
a915da9b6927

c0353c7b5da4
a915da9b6927


5f3d9cb29629
a915da9b6927
a915da9b6927
cfb6eeb4c860
a915da9b6927
cfb6eeb4c860
e0683e707c12
cfb6eeb4c860

a915da9b6927
b67bfe0d42ca
a8afca032998
cfb6eeb4c860
a8afca032998

b67bfe0d42ca
a915da9b6927
5f3d9cb29629
a915da9b6927
cfb6eeb4c860


7174259e6ced

cfb6eeb4c860


cfb6eeb4c860



7174259e6ced
cfb6eeb4c860




a8afca032998
a915da9b6927

cfb6eeb4c860



a915da9b6927


cfb6eeb4c860

49a72dfb8814

cfb6eeb4c860
cfb6eeb4c860
49a72dfb8814
cfb6eeb4c860

cfb6eeb4c860

49a72dfb8814
cfb6eeb4c860





076fb7223357
49a72dfb8814
c7da57a183a2
49a72dfb8814



a915da9b6927
318cf7aaa0a6
49a72dfb8814

















cfb6eeb4c860

cfb6eeb4c860
cfb6eeb4c860
49a72dfb8814
cfb6eeb4c860



49a72dfb8814
cfb6eeb4c860

49a72dfb8814
318cf7aaa0a6

cfb6eeb4c860
49a72dfb8814

318cf7aaa0a6
cfb6eeb4c860


c720c7e8383a

49a72dfb8814
634fb979e8f3

cfb6eeb4c860
49a72dfb8814


cfb6eeb4c860
49a72dfb8814



























cfb6eeb4c860
49a72dfb8814
cfb6eeb4c860
a2a385d627e1
cfb6eeb4c860








cf533ea53ebf
cfb6eeb4c860
eddc9ec53be2
cf533ea53ebf
cfb6eeb4c860
cfb6eeb4c860

a915da9b6927

7d5d5525bd88
cfb6eeb4c860
cfb6eeb4c860

a2a385d627e1
cfb6eeb4c860

785957d3e8c6
a2a385d627e1
cfb6eeb4c860


785957d3e8c6
a2a385d627e1
cfb6eeb4c860




49a72dfb8814


cfb6eeb4c860

e87cc4728f0e




a2a385d627e1
cfb6eeb4c860
a2a385d627e1
cfb6eeb4c860



72a3effaf633
1da177e4c3f4
2e6599cb899b
72659ecce685
60236fdd08b2

1da177e4c3f4
72659ecce685
1da177e4c3f4

cfb6eeb4c860
b2e4b3debc32
cfb6eeb4c860
e3afe7b75ed8
cfb6eeb4c860
b6332e6cf9c9
cfb6eeb4c860
168a8f58059a























































149479d019e0
168a8f58059a

149479d019e0

168a8f58059a









149479d019e0

168a8f58059a





149479d019e0

168a8f58059a






1a2c6181c4a1
168a8f58059a




016818d07687
168a8f58059a
e6c022a4fa2d

168a8f58059a








634fb979e8f3

016818d07687


168a8f58059a






































168a8f58059a
6ae705323b71
168a8f58059a


















6f73601efb35
168a8f58059a







1da177e4c3f4


60236fdd08b2
e6b4d1136751
4957faade11b
e6b4d1136751
eddc9ec53be2

1da177e4c3f4
a2a385d627e1
168a8f58059a




1da177e4c3f4

511c3f92ad5b
1da177e4c3f4





5ad37d5deee1

946cedccbd73


1da177e4c3f4






2aeef18d37aa

1da177e4c3f4
2aeef18d37aa
1da177e4c3f4
ce4a7d0d48bb
1da177e4c3f4


cfb6eeb4c860



1da177e4c3f4
bee7ca9ec03a
4957faade11b
1a2c6181c4a1
1da177e4c3f4
4dfc28170259
1da177e4c3f4
1da177e4c3f4
1da177e4c3f4
1da177e4c3f4

bb5b7c11263d
634fb979e8f3

bb5b7c11263d
5dff747b7038
bb5b7c11263d
284904aa7946
bb5b7c11263d
284904aa7946
172d69e63c7f
5d134f1c1f36
1da177e4c3f4

1da177e4c3f4
172d69e63c7f
1da177e4c3f4
1da177e4c3f4









295ff7edb8f7
ba3f7f04ef2b
81166dd6fa8e

de0744af1fe2
7cd04fa7e351
1da177e4c3f4



463c84b97f24
1da177e4c3f4
81166dd6fa8e
1da177e4c3f4






afd465030acb
673d57e72398
7cd04fa7e351
1da177e4c3f4

a94f723d595e
1da177e4c3f4
2e6599cb899b
1da177e4c3f4
168a8f58059a


















168a8f58059a


634fb979e8f3
168a8f58059a





634fb979e8f3

168a8f58059a



016818d07687
168a8f58059a





1a2c6181c4a1
1da177e4c3f4

1da177e4c3f4

7cd04fa7e351

1da177e4c3f4
60236fdd08b2
1da177e4c3f4
848bf15f361c
1da177e4c3f4

4bc2f18ba4f2
1da177e4c3f4






60236fdd08b2
1da177e4c3f4

2e6599cb899b
1da177e4c3f4


cfb6eeb4c860


f6d8bd051c39
1da177e4c3f4



1da177e4c3f4

093d282321da
1da177e4c3f4
bcd76111178e
fae6ef87faeb
1da177e4c3f4


2e6599cb899b
634fb979e8f3


f6d8bd051c39

2e6599cb899b
463c84b97f24
eddc9ec53be2
4c507d2897bd
d83d8461f902
f6d8bd051c39

c720c7e8383a
1da177e4c3f4
dfd25ffffc13






0e734419923b

5d424d5a674f
1da177e4c3f4
0dbaee3b37e1
f5fff5dc8a7a



1da177e4c3f4

cfb6eeb4c860

a915da9b6927

c720c7e8383a
cfb6eeb4c860





a915da9b6927

a465419b1feb
cfb6eeb4c860


0e734419923b

9327f7053e39
1da177e4c3f4



de0744af1fe2
093d282321da

1da177e4c3f4
de0744af1fe2
1da177e4c3f4
0e734419923b
e337e24d6624

0e734419923b
1da177e4c3f4
4bc2f18ba4f2
1da177e4c3f4


aa8223c7bb0b
eddc9ec53be2
1da177e4c3f4
60236fdd08b2
1da177e4c3f4
463c84b97f24

1da177e4c3f4
8336886f786f
1da177e4c3f4
3b1e0a655f8e
c67499c0e772
1da177e4c3f4





9469c7b4aa21
1da177e4c3f4



af9b4738574b
1da177e4c3f4




b51655b958df
1da177e4c3f4
eddc9ec53be2

84fa7933a33f
eddc9ec53be2

fb286bb2990a
1da177e4c3f4
fb286bb2990a
1da177e4c3f4
fb286bb2990a
eddc9ec53be2
fb286bb2990a

1da177e4c3f4
fb286bb2990a
1da177e4c3f4














cfb6eeb4c860







7174259e6ced
cfb6eeb4c860


1da177e4c3f4
404e0a8b6a55

bdeab9919186
404e0a8b6a55
505fbcf035c2

92101b3b2e31



c995ae2259ee
1da177e4c3f4


ab6a5bb6b28a
1da177e4c3f4







bdeab9919186
cfb6eeb4c860

1da177e4c3f4
cfb6eeb4c860
1da177e4c3f4

ca55158c6ecb
bdeab9919186
ca55158c6ecb
aa8223c7bb0b
cfb6eeb4c860
1da177e4c3f4
cfb6eeb4c860
1da177e4c3f4


cfb6eeb4c860
1da177e4c3f4









6a5dc9e598fe
63231bddf651
1da177e4c3f4

4bc2f18ba4f2
1da177e4c3f4
160eb5a6b14c
41063e9dd119
41063e9dd119


41063e9dd119
41063e9dd119
160eb5a6b14c
41063e9dd119
45f00f99d6e7
160eb5a6b14c
41063e9dd119

45f00f99d6e7
41063e9dd119

160eb5a6b14c
41063e9dd119
45f00f99d6e7
41063e9dd119
7011d0851b80
9cb429d692b3
41063e9dd119




505fbcf035c2
41063e9dd119

92101b3b2e31
505fbcf035c2
92101b3b2e31
41063e9dd119

41063e9dd119

b2fb4f54ecd4

















58717686cf7c
b2fb4f54ecd4

























1da177e4c3f4





eddc9ec53be2
cf533ea53ebf
1da177e4c3f4

a86b1e301945
1da177e4c3f4




63231bddf651
1da177e4c3f4



aa8223c7bb0b
1da177e4c3f4







caa20d9abe81
1da177e4c3f4
604763722c65
6a5dc9e598fe
1da177e4c3f4
aa8223c7bb0b
eddc9ec53be2
1da177e4c3f4




b82d1bb4fd20
1da177e4c3f4

9a1f27c48065
1da177e4c3f4


bb134d5d9580



6cce09f87a04

d218d11133d8
6cce09f87a04
d218d11133d8
1da177e4c3f4

b59c270104f0
1da177e4c3f4
fda9ef5d679b
1da177e4c3f4

8b80cda536ea
1da177e4c3f4

c63661848581
1da177e4c3f4

1a2449a87bb7


a2bd1140a264
1a2449a87bb7
1da177e4c3f4
1a2449a87bb7



ae8d7f884a24
1a2449a87bb7
da882c1f2eca

6b03a53a5ab7
6cce09f87a04
6b03a53a5ab7

1da177e4c3f4










6a5dc9e598fe

1da177e4c3f4
63231bddf651
1da177e4c3f4
cfb6eeb4c860
1da177e4c3f4




e905a9edab7f
1da177e4c3f4






9469c7b4aa21
1da177e4c3f4


6a5dc9e598fe
9469c7b4aa21
6a5dc9e598fe




1da177e4c3f4
9469c7b4aa21
1da177e4c3f4
c346dca10840
c67499c0e772
da5e36308d9f
eddc9ec53be2
463c84b97f24
1da177e4c3f4
9469c7b4aa21

1da177e4c3f4














ccb7c410ddc0



ccb7c410ddc0
1da177e4c3f4
63d02d157ec4
5d299f3d3c8a






63d02d157ec4
5d299f3d3c8a
3b401a81c0d5
543d9cfeec4d


5d299f3d3c8a
543d9cfeec4d

543d9cfeec4d




ab1e0a13d702
3fdadf7d27e3
543d9cfeec4d

3fdadf7d27e3
1da177e4c3f4
4bc2f18ba4f2
1da177e4c3f4
cfb6eeb4c860
b2e4b3debc32
cfb6eeb4c860
49a72dfb8814
cfb6eeb4c860
cfb6eeb4c860
b6332e6cf9c9
cfb6eeb4c860
1da177e4c3f4




6687e988d9ae
1da177e4c3f4
900f65d361d3
1da177e4c3f4
8292a17a399f
900f65d361d3
cfb6eeb4c860
ac807fa8e625
cfb6eeb4c860
1da177e4c3f4
1da177e4c3f4


7d06b2e053d2
1da177e4c3f4




6687e988d9ae
317a76f9a44b
1da177e4c3f4
fe067e8ab5e0
1da177e4c3f4

e905a9edab7f
1da177e4c3f4
cfb6eeb4c860


a915da9b6927
a8afca032998
cfb6eeb4c860



1a2449a87bb7

e905a9edab7f
1a2449a87bb7

1da177e4c3f4



463c84b97f24
ab1e0a13d702
1da177e4c3f4
168a8f58059a
435cf559f02e
cf60af03ca4e


180d8cd942ce
d1a4c0b37c29
1da177e4c3f4
1da177e4c3f4




a8b690f98baf




1da177e4c3f4

463c84b97f24
c25eb3bfb972
1da177e4c3f4
5caea4ea7088
5799de0b12c7
a4146b1b2c6b
1da177e4c3f4

a8b690f98baf
5caea4ea7088
c25eb3bfb972
a8b690f98baf
1da177e4c3f4

5caea4ea7088
1da177e4c3f4
a8b690f98baf
1da177e4c3f4

60236fdd08b2
1da177e4c3f4
72a3effaf633
1da177e4c3f4


bdccc4ca13a6
1da177e4c3f4




72a3effaf633
1da177e4c3f4

463c84b97f24
1da177e4c3f4
1bde5ac49398
1da177e4c3f4
463c84b97f24
1da177e4c3f4
e905a9edab7f
463c84b97f24

1da177e4c3f4
463c84b97f24
1bde5ac49398
1da177e4c3f4

c25eb3bfb972
8475ef9fd16c


1da177e4c3f4


e905a9edab7f
463c84b97f24

1da177e4c3f4






463c84b97f24
1da177e4c3f4
5caea4ea7088
a8b690f98baf
0f7ff9274e72
5caea4ea7088

c25eb3bfb972
1da177e4c3f4








a8b690f98baf





1da177e4c3f4







05dbc7b59481
6eac56040787
05dbc7b59481
6eac56040787

a8b690f98baf



1da177e4c3f4

5799de0b12c7
a4146b1b2c6b
1da177e4c3f4

a8b690f98baf

1da177e4c3f4
3ab5aee7fe84
9db66bdcc837
1da177e4c3f4
6eac56040787



9db66bdcc837
3ab5aee7fe84
f40c8174d3c2
878628fbf258
1da177e4c3f4




9db66bdcc837
1da177e4c3f4







3ab5aee7fe84
5799de0b12c7
a4146b1b2c6b
1da177e4c3f4

a8b690f98baf
1da177e4c3f4
05dbc7b59481
1da177e4c3f4
3ab5aee7fe84
878628fbf258
05dbc7b59481
1da177e4c3f4

05dbc7b59481


1da177e4c3f4



a8b690f98baf




1da177e4c3f4



7174259e6ced
1da177e4c3f4





5799de0b12c7
1da177e4c3f4
1da177e4c3f4



1da177e4c3f4






a8b690f98baf


















05dbc7b59481
a8b690f98baf

a8b690f98baf











1da177e4c3f4

5799de0b12c7
a8b690f98baf







1da177e4c3f4

a8b690f98baf






1da177e4c3f4



a8b690f98baf
1da177e4c3f4
1da177e4c3f4




1da177e4c3f4





1da177e4c3f4
a8b690f98baf

1da177e4c3f4



1da177e4c3f4




a8b690f98baf
1da177e4c3f4




5799de0b12c7
1da177e4c3f4



463c84b97f24

1da177e4c3f4


5caea4ea7088
1da177e4c3f4
1da177e4c3f4

9db66bdcc837
1da177e4c3f4



73cb88ecb950
1da177e4c3f4
d9dda78bad87
1da177e4c3f4
52d6f3f11bdb
1da177e4c3f4
52d6f3f11bdb



f40c8174d3c2
52d6f3f11bdb
1da177e4c3f4
a8b690f98baf
f40c8174d3c2

73cb88ecb950
f40c8174d3c2
6f8b13bcb336
1da177e4c3f4



9427c4b36b8f



84841c3c6cf2
73cb88ecb950
84841c3c6cf2
1da177e4c3f4


4bc2f18ba4f2
1da177e4c3f4
6f8b13bcb336
1da177e4c3f4
ece31ffd539e
1da177e4c3f4
4bc2f18ba4f2
1da177e4c3f4
cf533ea53ebf
a7cb5a49bf64
1da177e4c3f4
2e6599cb899b
a399a8053164
1da177e4c3f4
5e659e4cb0ee
d14c5ab6bef6
1da177e4c3f4
634fb979e8f3
c720c7e8383a
634fb979e8f3

1da177e4c3f4


a399a8053164
e6c022a4fa2d
a7cb5a49bf64
1da177e4c3f4


5e659e4cb0ee

1da177e4c3f4

5e659e4cb0ee
1da177e4c3f4


cf533ea53ebf
cf4c6bf83d0f
cf533ea53ebf
168a8f58059a
c720c7e8383a



49d09007879c
1da177e4c3f4
6ba8a3b19e76


1da177e4c3f4
463c84b97f24

1da177e4c3f4
463c84b97f24
cf4c6bf83d0f
1da177e4c3f4
cf4c6bf83d0f
1da177e4c3f4




49d09007879c







5e659e4cb0ee
d14c5ab6bef6
cf4c6bf83d0f
47da8ee681d0
49d09007879c
1da177e4c3f4
a399a8053164
463c84b97f24
a7cb5a49bf64
6687e988d9ae
cf4c6bf83d0f

7be87351a1f6

463c84b97f24
1da177e4c3f4
168a8f58059a


5e659e4cb0ee
1da177e4c3f4

cf533ea53ebf
5e659e4cb0ee
1da177e4c3f4
23f33c2d4fd5
1da177e4c3f4
a399a8053164
1da177e4c3f4





5e659e4cb0ee
71338aa7d050
1da177e4c3f4
a399a8053164
5e659e4cb0ee
1da177e4c3f4





5799de0b12c7
05dbc7b59481
5e659e4cb0ee
1da177e4c3f4












05dbc7b59481



1da177e4c3f4

5e659e4cb0ee
1da177e4c3f4

5e659e4cb0ee
1da177e4c3f4



73cb88ecb950







1da177e4c3f4
1da177e4c3f4

73cb88ecb950
9427c4b36b8f


1da177e4c3f4

2c8c1e7297e1
757764f61d07



2c8c1e7297e1
757764f61d07








1da177e4c3f4

757764f61d07
1da177e4c3f4



757764f61d07
1da177e4c3f4








463c84b97f24
1da177e4c3f4





1da177e4c3f4
7ba42910073f

1da177e4c3f4
46d3ceabd8d9
563d34d05786
ab1e0a13d702


1da177e4c3f4
c9bee3b7fdec
1da177e4c3f4
0a5578cf8e5e
1da177e4c3f4

a4fe34bf902b
1da177e4c3f4



3ab5aee7fe84
6d6ee43e0b8b
60236fdd08b2
39d8cda76cfb
7ba42910073f
543d9cfeec4d



c255a458055e
d1a4c0b37c29



1da177e4c3f4
4bc2f18ba4f2
1da177e4c3f4
046ee902357a

5d134f1c1f36
be9f4a44e7d4
046ee902357a



b099ce2602d8




046ee902357a


b099ce2602d8


046ee902357a

9b0f976f27f0
1da177e4c3f4
5caea4ea7088
6a1b3054d9fd
1da177e4c3f4
1da177e4c3f4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801






                                                                            




























                                                                               
                                                                       

                                                                                
                                                                   











                                                                                
                               
 
                              







                         
                       
 
                              
                     
                                
                    
                          

                            
                              
                     
                       
                           
                               
                          






                           


                              

                                         
                                      
 
 
                        
                                                                                
                                                                                    

      
                                  
                            
 
                                                                   
 

                                                             

                                                                

 

















                                                                              
                                                                               










                                                                       

                                   


                                                                         
                                                               

                                             
                                      
                              
                           
                          
                
                                        







                                                  


                                                                     

                                       
                                              

         

                                      

                                                             





                                                                     
                                                                               
                           
         





                                                               
                                            
                                   
 
                              
                                              
                                                
 
                                                                      


                                               

                                               

         
                                              

                                                               
 

                                          
 
                                           

                                                                      
 
                                               






                                                                            
                                                    


                             
                                                               



                                                                       
                             
         
                                                    
                                        
                                    
 
                                                  


                                                                            

                                                                           
                                                
 
                              
 






                             



                                                                


                                     
                             

                   
                              
 
  


                                                                                 
   
                                               


                                             
                                       
 

                                            

                       








                                                                     
                                    
                                                   










                                                             



                                                             
                
                                                 

 















                                                                 
                                                   
 
                                                                       
                                                                                
                                          

                               

                                                  
                        
                            
                                 
                  
                        
                
                                                 
 
                                                  
                                                          


                       
                                                                  
                                                                    
                  
                                                          


                                            
                                             





                                                       

                                                                               
           



                                                                             


                                      




                                                               
                            
                        
                               

                                         


                                                                      
                                                                  



                         


                                          










                                                                              






                                                                                
                                            
                                                      
                                                       



                                                                                                



                                                   







                                                                          

                                                                     


                                           
                                     

                                                                        










                                                                          





                                                                 







                                   







                                                                            
                               
                                                 



                                           

                                                                  





                                                                
                                 
 
                                                   
                                                                          








                                                                      
                                                         
                                                                      



                                             

                                                           

                                              







































                                                                              
                                                                         
 
                                         
 
                                                 
                                                                     
                                                                        
                                                                  
                
                                                                
                                                         




                                                                    
                                                 
                                                            
 
                                                   


                                                                     
                                 
 












                                                                            
                                                                   
 
                                               


                                 
                                                          

              
                                

                                   



                                         
      
                        




                                                        
                                                  


                                            




                                                  

                      
                                         
                


                                                                           

         
                                     



                                                    









                                                                               

                                                                               


















                                                                               








                                                                           
                                                         

                                                                  

         

                                                                   
                                                                          
                                                            
                                                                                   
                                                                

                                                                                 
           

                                                       
 
                                         
                                   
                                                           
                                                                            
 

                                               







                                  





                                                                         
                                                                  
                                                                   
                                                       
                                                    
 
                                               

                                 
                                                        
                        
                                                          

                          

                                
                                                     

                                                  
                                     


                                                    
                    


                                                                            

                                          
                                                             










                                                
                        
                  
                                             







                                                                
                                                              

                                                                 

         
                                

                                                                   

                                                                          

                                       
                      
                                                           
                                                                            
 
                                               



                                                                     
                                                      
                                                       
 
                                                                  
                                                               
                                                             

                                            
                                                

                                                                         
                          
 
                          

 
                                                                       
                                                           
 





                                                                        
                                       

                                       

                                                                                        

                                                                                 

 
  
                                                   
                                                                

               

                                                                     
                                                
 
                                                             
                          



                                  
                                                                      
                          
 
                                                  

                  
                                                                               
 
                                                          

                                                                       
                                                       
                                         

                                                                  

         


                   
                                                                       
 
                                                       



                                                                    

 
  
                                     
   
                                                             
 
                                  

 
  
                                            
   
                                          

                                                   
 
                                             
                                 


                                 
 
                         
                                    
                                        
                                   

                                                                               
      


                                                                          
                                                                   
                                          
                                                                                            


                                                               
 
                                    

  
                                                                 
   
                                                                      
 

                                                         

                                 

                                                           

                                                     
                                                               







                                            







                                                 


                                                                        

                                         
                                   
                                                   
                                       
 

                                                                

                                                                            
                    
                            



                                               
                                                            



                                                    


                    
                                 



                                                              



                                                                   
 

                                 

                                                                               
 

                                 
                                                                 
                                                    


                                                                    

                                                                         

                                 
                                   
                                         
                                       
 
                                                  

                                                                
                                                    
                                        

                         
 

                                                                   


                                                       
                                       
 

                                                    
                                                            
         
 
                                                  

                               
                                       
                                                    
                               
         







                                                               

                 
                              
 
                                                                               
 

                                   
                                                  


                                  
                                                     
                            
                 
 
                              
 
                                               

                                         
                                   
                             
                                       
 

                                                               
                                                                
                                          
                                                             
                                    


         

                                                                      


                                                                       



                                 
                                                      




                                       
                                              

                                                                                      



                                                   


                                                                              

 

                                                                               
 
                                  
                              

                              

          
                                                                     





                                                                   
                                   
                                      
 



                                                                   
                                                                                
                                                                                   

















                                                                          

                                
                              
                 
 



                                
                 

 
                                                                   

                                                                              
 

                                   
                                               


                            

                                                
                         

                                                   
                


                                                      
         



























                                                                     
 
                                   
 
                                                                               








                                                             
                                         
                                             
                                              
                                               
                    

                                  

                                                                                
                                                    
 

                                                           
                             

                                              
                                                                         
                            


                                              
                                                                           
                            




                                                             


                                                       

                                                                 




                                                                                      
                            
         
                     



      
                                                              
                                        
                                                                
                                                  

                                                        
                                                  
                                                    

  
                        
                                                                      
                                                        
                                                    
  
      
 























































                                                                            
 

                                                                               

                                                                               









                                                                           

                                                                       





                                                                 

                                                                       






                                                               
                                                             




                                                                            
                
 

                             








                                                                             

                                                                      


                                                          






































                                                                          
                                
                                     


















                                                                        
                                       







                                 


                                                             
                                 
                                       
                                         
                                     

                                          
                                          
                                 




                                                             

                                                                 
                                                                          





                                                            

                                                         


                                                                   






                                                                         

                                                                           
                          
         
 
                                                      


                          



                                                               
                                    
                                            
                                                
                                                                       
 
                                               
                                            
 
                                               

                                             
                             

                                  
                                                     
                                             
 
                                                     
                                   
 
                                              
                                                               

                          
                                                                  
                                                   
                          









                                                                      
                                                      
                                                                        

                                                                  
                                                                                              
                                                      



                                                                         
                                                                                 
                                                           
                                                                






                                                                   
                                                                                             
                                                                            
                                              

                 
                                                
         
                                    
 


















                                                                         


                                                                     
                                                                                      





                                                                              

                                                                              



                                           
                                                          





                                                                         
                                                                      

                                   

                 

                         
              
                        
     
                                                              

                 
                                   






                                                                       
                                                           

                                                        
                                       


                                  


                                   
                                        



                                   

                                                       
                                  
 
                                           
                                       


                                               
                                              


                                                          

                                                        
                                     
                                              
                                                 
                                                 
                                              

                                                                         
                                                      
 






                                                                   

                                  
                             
                                          
                                               



                                                            

                                      

                                                            

                                                                               
                          





                                                             

                                                                                 
                                                       


         

                                               
                                          



                     
                                                                  

                         
     
                                                              
                    
             

                                             
                  
 
                                    


                                                                        
                                         
                                              
                         
                                   
                                                

                                                                               
                
                                                                
 
                                                                              
                                                                         





                                                     
                                              



                            
                     




                                                                 
                                                        
 

                                              
                                                  

                                                           
                                                              
                                 
                 
         
 
                                                              

                                                                 
                             
                                                    














                                                             







                                                                           
                                             


                             
                                                              

                                                      
                                              
                          

                                                                          



                                                     
                                                                     


                         
                                                                     







                                                           
                                                       

                                                              
                                           
                         

                                 
              
                                              
 
                                                                     
                         
                           
         


                 
                                    









                                                                            
                                                           
                                                       

                     
                             
 
                                            
 


                                
 
                                         
                       
 
                                                                                   
                       

                          
                          

                                                 
                       
 
                                                                        
                                                              
                                                                   
                                                     




                                                              
 

                                                        
                                  
                                                                        
                                                            

                 

 

















                                                                       
                           

























                                                                             





                                   
                                
                                

                        
                                            




                                         
                                              



                                                       
                          







                                                                     
                                                      
                                      
                                                                    
                                
 
                          
                          




                                                                              
                                                            

                                     
                                                                         


                                   



                                          

                                                               
                                       
         
 

                                                         
                      
 
                               

                                       
                                 

                        
                                

                                      


                                                                 
                                                                    
                                       
                                                     



                                                   
                                                             
                 

                                                                             
                                   
                                                                

                                       










                                                                       

                                                          
           
                                                      
                
                                             




                            
                 






                                                             
                                             


                                
                                         
                                             




                                             
         
                                                                     
                          
                                                                          
                                                                      
                                                                               
                                                                             
                                                                       
                          

                                                                            














                                             



                                                           
  
 
                                                                   






                                                   
                                  
 
                                                          


                                                    
                                                

                                                  




                                                        
                                                    
                    

                                                  
      
  
                             
 
                        
                                                              
                                                    
                                                      
                                                        
  
      
 




                                                          
                                                         
 
                          
 
                                           
 
                        
                                                          
      
 


                 
                                         




                                         
                                           
 
                                          
                                  

                                                                 
                                                   
 


                                               
                                       
                                                



                                       

                                               
                                                    

      



                                                     
                                         
                                  
 
                                         
 


                                                           
                                     
                               
 




                                            




                                                                         

                                                                
                                          
                                      
                              
                                           
                                                 
                                            

                  
                                                               
                                         
                                               
                               

                            
                                                       
                  
                     

                                                 
                                               
 
                                                 


                                     
                                                                         




                                                   
                                                                                                  

                                      
                                                                                         
                 
                                                           
                                                    
                                                                       
                
                                    

                                                                     
                                       
                                                                       
                                       

         
                                          


                                                  


                                 
                                    

                                                                     






                                                                
                                                                       
         
                                   
                       
                                               

                                                               
                                               








                                                                 





                                                 







                                                 
                                                                
 
                                                                        

 



                                                                         

                                                        
                                                 
                                            

                        

                                                                     
                                
                                              
                                                                               
 



                                                                             
                                   
                                                                                    
                                                          
                                                         




                                         
                                     







                                                                  
                                      
                                                 
                                            

                  
                     
 
                               
 
                                          
                                                                             
                                  

         


                                                                    



                                                                  




                                                 



                                                   
         





                                                          
                                                 
 



                                                 






                                                          


















                                                         
                                                      

                                       











                                                           

                                                             
                                                 







                                            

                                            






                                                                 



                                                                     
                                                 
                        




                                         





                                                
                                                              

                                       



                                                               




                                                  
                            




                                                       
                                                 



                                   

                                                                                      


                                         
                                                                                      
                      

                                       
                                                                                    



                      
                                                        
 
                                                        
                                 
                
 



                                                         
 
                                                             
                                                 
                                    

                 
                            
 
                                                                     



                                 



                                                        
                                                                  
                                                       
               


                             
                                 
 
                                                                        
 
                                                       
 
                                   
 
                                                                               
                                                                         
 
                                                             
                                            
 
                                                
                                                                      
                  
                                  
                                               

                                         


                                                                              
                                                
                                 
                                                      


                                                    

                     

 
                                                                               


                                    
                                               
                                                               
                                                   
                                                                             



                                              
                     
 


                                                            
                                    

                                                            
                                    
                                                     
                                                  
                                    
                                                       




                                        







                                                                                        
                                                                           
                                                                     
                                                        
                                            
                         
                             
                                                                  
                                       
                                                                 
                                      

                                                

                                                       
                                                                      
                             


                                                                           
                     

 
                                                                   
                                                                   
 
                         
                          
                                          





                                    
                                                
                                                                      
                                                                 
                                                               
                                                      





                                                       
                                  
                            
                












                                                                           



                                                                  

                                   
                                                                              

                      
                                                      



                 







                                                           
                                                

                                  
                                               


                                                

  
                                                         



                                                        
                                                          








                                                   

                               
                                                     



                         
                                                








                                                 
                                                  





                                                      
                                              

                                               
                                                
                                                 
                                                     


                                                    
                                                            
                                                         
                                                         
                                                    

                                                        
                                                 



                                                          
                                                      
                                                         
                                                        
                                                
                                       



                                                        
                        



                                                     
  
                        
 

                                                  
                                     
                 



                                                   




                                                                         


                                                             


                                       

  
                             
 
                                          
                                                
                                                                    
 
/*
 * INET		An implementation of the TCP/IP protocol suite for the LINUX
 *		operating system.  INET is implemented using the  BSD Socket
 *		interface as the means of communication with the user level.
 *
 *		Implementation of the Transmission Control Protocol(TCP).
 *
 *		IPv4 specific functions
 *
 *
 *		code split from:
 *		linux/ipv4/tcp.c
 *		linux/ipv4/tcp_input.c
 *		linux/ipv4/tcp_output.c
 *
 *		See tcp.c for author information
 *
 *	This program is free software; you can redistribute it and/or
 *      modify it under the terms of the GNU General Public License
 *      as published by the Free Software Foundation; either version
 *      2 of the License, or (at your option) any later version.
 */

/*
 * Changes:
 *		David S. Miller	:	New socket lookup architecture.
 *					This code is dedicated to John Dyson.
 *		David S. Miller :	Change semantics of established hash,
 *					half is devoted to TIME_WAIT sockets
 *					and the rest go in the other half.
 *		Andi Kleen :		Add support for syncookies and fixed
 *					some bugs: ip options weren't passed to
 *					the TCP layer, missed a check for an
 *					ACK bit.
 *		Andi Kleen :		Implemented fast path mtu discovery.
 *	     				Fixed many serious bugs in the
 *					request_sock handling and moved
 *					most of it into the af independent code.
 *					Added tail drop and some other bugfixes.
 *					Added new listen semantics.
 *		Mike McLagan	:	Routing by source
 *	Juan Jose Ciarlante:		ip_dynaddr bits
 *		Andi Kleen:		various fixes.
 *	Vitaly E. Lavrov	:	Transparent proxy revived after year
 *					coma.
 *	Andi Kleen		:	Fix new listen.
 *	Andi Kleen		:	Fix accept error reporting.
 *	YOSHIFUJI Hideaki @USAGI and:	Support IPV6_V6ONLY socket option, which
 *	Alexey Kuznetsov		allow both IPv4 and IPv6 sockets to bind
 *					a single port at the same time.
 */

#define pr_fmt(fmt) "TCP: " fmt

#include <linux/bottom_half.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/module.h>
#include <linux/random.h>
#include <linux/cache.h>
#include <linux/jhash.h>
#include <linux/init.h>
#include <linux/times.h>
#include <linux/slab.h>

#include <net/net_namespace.h>
#include <net/icmp.h>
#include <net/inet_hashtables.h>
#include <net/tcp.h>
#include <net/transp_v6.h>
#include <net/ipv6.h>
#include <net/inet_common.h>
#include <net/timewait_sock.h>
#include <net/xfrm.h>
#include <net/netdma.h>
#include <net/secure_seq.h>
#include <net/tcp_memcontrol.h>
#include <net/busy_poll.h>

#include <linux/inet.h>
#include <linux/ipv6.h>
#include <linux/stddef.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>

#include <linux/crypto.h>
#include <linux/scatterlist.h>

int sysctl_tcp_tw_reuse __read_mostly;
int sysctl_tcp_low_latency __read_mostly;
EXPORT_SYMBOL(sysctl_tcp_low_latency);


#ifdef CONFIG_TCP_MD5SIG
static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key,
			       __be32 daddr, __be32 saddr, const struct tcphdr *th);
#endif

struct inet_hashinfo tcp_hashinfo;
EXPORT_SYMBOL(tcp_hashinfo);

static inline __u32 tcp_v4_init_sequence(const struct sk_buff *skb)
{
	return secure_tcp_sequence_number(ip_hdr(skb)->daddr,
					  ip_hdr(skb)->saddr,
					  tcp_hdr(skb)->dest,
					  tcp_hdr(skb)->source);
}

int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
{
	const struct tcp_timewait_sock *tcptw = tcp_twsk(sktw);
	struct tcp_sock *tp = tcp_sk(sk);

	/* With PAWS, it is safe from the viewpoint
	   of data integrity. Even without PAWS it is safe provided sequence
	   spaces do not overlap i.e. at data rates <= 80Mbit/sec.

	   Actually, the idea is close to VJ's one, only timestamp cache is
	   held not per host, but per port pair and TW bucket is used as state
	   holder.

	   If TW bucket has been already destroyed we fall back to VJ's scheme
	   and use initial timestamp retrieved from peer table.
	 */
	if (tcptw->tw_ts_recent_stamp &&
	    (twp == NULL || (sysctl_tcp_tw_reuse &&
			     get_seconds() - tcptw->tw_ts_recent_stamp > 1))) {
		tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2;
		if (tp->write_seq == 0)
			tp->write_seq = 1;
		tp->rx_opt.ts_recent	   = tcptw->tw_ts_recent;
		tp->rx_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp;
		sock_hold(sktw);
		return 1;
	}

	return 0;
}
EXPORT_SYMBOL_GPL(tcp_twsk_unique);

/* This will initiate an outgoing connection. */
int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
{
	struct sockaddr_in *usin = (struct sockaddr_in *)uaddr;
	struct inet_sock *inet = inet_sk(sk);
	struct tcp_sock *tp = tcp_sk(sk);
	__be16 orig_sport, orig_dport;
	__be32 daddr, nexthop;
	struct flowi4 *fl4;
	struct rtable *rt;
	int err;
	struct ip_options_rcu *inet_opt;

	if (addr_len < sizeof(struct sockaddr_in))
		return -EINVAL;

	if (usin->sin_family != AF_INET)
		return -EAFNOSUPPORT;

	nexthop = daddr = usin->sin_addr.s_addr;
	inet_opt = rcu_dereference_protected(inet->inet_opt,
					     sock_owned_by_user(sk));
	if (inet_opt && inet_opt->opt.srr) {
		if (!daddr)
			return -EINVAL;
		nexthop = inet_opt->opt.faddr;
	}

	orig_sport = inet->inet_sport;
	orig_dport = usin->sin_port;
	fl4 = &inet->cork.fl.u.ip4;
	rt = ip_route_connect(fl4, nexthop, inet->inet_saddr,
			      RT_CONN_FLAGS(sk), sk->sk_bound_dev_if,
			      IPPROTO_TCP,
			      orig_sport, orig_dport, sk, true);
	if (IS_ERR(rt)) {
		err = PTR_ERR(rt);
		if (err == -ENETUNREACH)
			IP_INC_STATS_BH(sock_net(sk), IPSTATS_MIB_OUTNOROUTES);
		return err;
	}

	if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) {
		ip_rt_put(rt);
		return -ENETUNREACH;
	}

	if (!inet_opt || !inet_opt->opt.srr)
		daddr = fl4->daddr;

	if (!inet->inet_saddr)
		inet->inet_saddr = fl4->saddr;
	inet->inet_rcv_saddr = inet->inet_saddr;

	if (tp->rx_opt.ts_recent_stamp && inet->inet_daddr != daddr) {
		/* Reset inherited state */
		tp->rx_opt.ts_recent	   = 0;
		tp->rx_opt.ts_recent_stamp = 0;
		if (likely(!tp->repair))
			tp->write_seq	   = 0;
	}

	if (tcp_death_row.sysctl_tw_recycle &&
	    !tp->rx_opt.ts_recent_stamp && fl4->daddr == daddr)
		tcp_fetch_timewait_stamp(sk, &rt->dst);

	inet->inet_dport = usin->sin_port;
	inet->inet_daddr = daddr;

	inet_csk(sk)->icsk_ext_hdr_len = 0;
	if (inet_opt)
		inet_csk(sk)->icsk_ext_hdr_len = inet_opt->opt.optlen;

	tp->rx_opt.mss_clamp = TCP_MSS_DEFAULT;

	/* Socket identity is still unknown (sport may be zero).
	 * However we set state to SYN-SENT and not releasing socket
	 * lock select source port, enter ourselves into the hash tables and
	 * complete initialization after this.
	 */
	tcp_set_state(sk, TCP_SYN_SENT);
	err = inet_hash_connect(&tcp_death_row, sk);
	if (err)
		goto failure;

	rt = ip_route_newports(fl4, rt, orig_sport, orig_dport,
			       inet->inet_sport, inet->inet_dport, sk);
	if (IS_ERR(rt)) {
		err = PTR_ERR(rt);
		rt = NULL;
		goto failure;
	}
	/* OK, now commit destination to socket.  */
	sk->sk_gso_type = SKB_GSO_TCPV4;
	sk_setup_caps(sk, &rt->dst);

	if (!tp->write_seq && likely(!tp->repair))
		tp->write_seq = secure_tcp_sequence_number(inet->inet_saddr,
							   inet->inet_daddr,
							   inet->inet_sport,
							   usin->sin_port);

	inet->inet_id = tp->write_seq ^ jiffies;

	err = tcp_connect(sk);

	rt = NULL;
	if (err)
		goto failure;

	return 0;

failure:
	/*
	 * This unhashes the socket and releases the local port,
	 * if necessary.
	 */
	tcp_set_state(sk, TCP_CLOSE);
	ip_rt_put(rt);
	sk->sk_route_caps = 0;
	inet->inet_dport = 0;
	return err;
}
EXPORT_SYMBOL(tcp_v4_connect);

/*
 * This routine reacts to ICMP_FRAG_NEEDED mtu indications as defined in RFC1191.
 * It can be called through tcp_release_cb() if socket was owned by user
 * at the time tcp_v4_err() was called to handle ICMP message.
 */
static void tcp_v4_mtu_reduced(struct sock *sk)
{
	struct dst_entry *dst;
	struct inet_sock *inet = inet_sk(sk);
	u32 mtu = tcp_sk(sk)->mtu_info;

	dst = inet_csk_update_pmtu(sk, mtu);
	if (!dst)
		return;

	/* Something is about to be wrong... Remember soft error
	 * for the case, if this connection will not able to recover.
	 */
	if (mtu < dst_mtu(dst) && ip_dont_fragment(sk, dst))
		sk->sk_err_soft = EMSGSIZE;

	mtu = dst_mtu(dst);

	if (inet->pmtudisc != IP_PMTUDISC_DONT &&
	    ip_sk_accept_pmtu(sk) &&
	    inet_csk(sk)->icsk_pmtu_cookie > mtu) {
		tcp_sync_mss(sk, mtu);

		/* Resend the TCP packet because it's
		 * clear that the old packet has been
		 * dropped. This is the new "fast" path mtu
		 * discovery.
		 */
		tcp_simple_retransmit(sk);
	} /* else let the usual retransmit timer handle it */
}

static void do_redirect(struct sk_buff *skb, struct sock *sk)
{
	struct dst_entry *dst = __sk_dst_check(sk, 0);

	if (dst)
		dst->ops->redirect(dst, sk, skb);
}

/*
 * This routine is called by the ICMP module when it gets some
 * sort of error condition.  If err < 0 then the socket should
 * be closed and the error returned to the user.  If err > 0
 * it's just the icmp type << 8 | icmp code.  After adjustment
 * header points to the first 8 bytes of the tcp header.  We need
 * to find the appropriate port.
 *
 * The locking strategy used here is very "optimistic". When
 * someone else accesses the socket the ICMP is just dropped
 * and for some paths there is no check at all.
 * A more general error queue to queue errors for later handling
 * is probably better.
 *
 */

void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
{
	const struct iphdr *iph = (const struct iphdr *)icmp_skb->data;
	struct tcphdr *th = (struct tcphdr *)(icmp_skb->data + (iph->ihl << 2));
	struct inet_connection_sock *icsk;
	struct tcp_sock *tp;
	struct inet_sock *inet;
	const int type = icmp_hdr(icmp_skb)->type;
	const int code = icmp_hdr(icmp_skb)->code;
	struct sock *sk;
	struct sk_buff *skb;
	struct request_sock *req;
	__u32 seq;
	__u32 remaining;
	int err;
	struct net *net = dev_net(icmp_skb->dev);

	if (icmp_skb->len < (iph->ihl << 2) + 8) {
		ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
		return;
	}

	sk = inet_lookup(net, &tcp_hashinfo, iph->daddr, th->dest,
			iph->saddr, th->source, inet_iif(icmp_skb));
	if (!sk) {
		ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
		return;
	}
	if (sk->sk_state == TCP_TIME_WAIT) {
		inet_twsk_put(inet_twsk(sk));
		return;
	}

	bh_lock_sock(sk);
	/* If too many ICMPs get dropped on busy
	 * servers this needs to be solved differently.
	 * We do take care of PMTU discovery (RFC1191) special case :
	 * we can receive locally generated ICMP messages while socket is held.
	 */
	if (sock_owned_by_user(sk)) {
		if (!(type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED))
			NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS);
	}
	if (sk->sk_state == TCP_CLOSE)
		goto out;

	if (unlikely(iph->ttl < inet_sk(sk)->min_ttl)) {
		NET_INC_STATS_BH(net, LINUX_MIB_TCPMINTTLDROP);
		goto out;
	}

	icsk = inet_csk(sk);
	tp = tcp_sk(sk);
	req = tp->fastopen_rsk;
	seq = ntohl(th->seq);
	if (sk->sk_state != TCP_LISTEN &&
	    !between(seq, tp->snd_una, tp->snd_nxt) &&
	    (req == NULL || seq != tcp_rsk(req)->snt_isn)) {
		/* For a Fast Open socket, allow seq to be snt_isn. */
		NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
		goto out;
	}

	switch (type) {
	case ICMP_REDIRECT:
		do_redirect(icmp_skb, sk);
		goto out;
	case ICMP_SOURCE_QUENCH:
		/* Just silently ignore these. */
		goto out;
	case ICMP_PARAMETERPROB:
		err = EPROTO;
		break;
	case ICMP_DEST_UNREACH:
		if (code > NR_ICMP_UNREACH)
			goto out;

		if (code == ICMP_FRAG_NEEDED) { /* PMTU discovery (RFC1191) */
			/* We are not interested in TCP_LISTEN and open_requests
			 * (SYN-ACKs send out by Linux are always <576bytes so
			 * they should go through unfragmented).
			 */
			if (sk->sk_state == TCP_LISTEN)
				goto out;

			tp->mtu_info = info;
			if (!sock_owned_by_user(sk)) {
				tcp_v4_mtu_reduced(sk);
			} else {
				if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED, &tp->tsq_flags))
					sock_hold(sk);
			}
			goto out;
		}

		err = icmp_err_convert[code].errno;
		/* check if icmp_skb allows revert of backoff
		 * (see draft-zimmermann-tcp-lcd) */
		if (code != ICMP_NET_UNREACH && code != ICMP_HOST_UNREACH)
			break;
		if (seq != tp->snd_una  || !icsk->icsk_retransmits ||
		    !icsk->icsk_backoff)
			break;

		/* XXX (TFO) - revisit the following logic for TFO */

		if (sock_owned_by_user(sk))
			break;

		icsk->icsk_backoff--;
		inet_csk(sk)->icsk_rto = (tp->srtt ? __tcp_set_rto(tp) :
			TCP_TIMEOUT_INIT) << icsk->icsk_backoff;
		tcp_bound_rto(sk);

		skb = tcp_write_queue_head(sk);
		BUG_ON(!skb);

		remaining = icsk->icsk_rto - min(icsk->icsk_rto,
				tcp_time_stamp - TCP_SKB_CB(skb)->when);

		if (remaining) {
			inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
						  remaining, TCP_RTO_MAX);
		} else {
			/* RTO revert clocked out retransmission.
			 * Will retransmit now */
			tcp_retransmit_timer(sk);
		}

		break;
	case ICMP_TIME_EXCEEDED:
		err = EHOSTUNREACH;
		break;
	default:
		goto out;
	}

	/* XXX (TFO) - if it's a TFO socket and has been accepted, rather
	 * than following the TCP_SYN_RECV case and closing the socket,
	 * we ignore the ICMP error and keep trying like a fully established
	 * socket. Is this the right thing to do?
	 */
	if (req && req->sk == NULL)
		goto out;

	switch (sk->sk_state) {
		struct request_sock *req, **prev;
	case TCP_LISTEN:
		if (sock_owned_by_user(sk))
			goto out;

		req = inet_csk_search_req(sk, &prev, th->dest,
					  iph->daddr, iph->saddr);
		if (!req)
			goto out;

		/* ICMPs are not backlogged, hence we cannot get
		   an established socket here.
		 */
		WARN_ON(req->sk);

		if (seq != tcp_rsk(req)->snt_isn) {
			NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
			goto out;
		}

		/*
		 * Still in SYN_RECV, just remove it silently.
		 * There is no good way to pass the error to the newly
		 * created socket, and POSIX does not want network
		 * errors returned from accept().
		 */
		inet_csk_reqsk_queue_drop(sk, req, prev);
		NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
		goto out;

	case TCP_SYN_SENT:
	case TCP_SYN_RECV:  /* Cannot happen.
			       It can f.e. if SYNs crossed,
			       or Fast Open.
			     */
		if (!sock_owned_by_user(sk)) {
			sk->sk_err = err;

			sk->sk_error_report(sk);

			tcp_done(sk);
		} else {
			sk->sk_err_soft = err;
		}
		goto out;
	}

	/* If we've already connected we will keep trying
	 * until we time out, or the user gives up.
	 *
	 * rfc1122 4.2.3.9 allows to consider as hard errors
	 * only PROTO_UNREACH and PORT_UNREACH (well, FRAG_FAILED too,
	 * but it is obsoleted by pmtu discovery).
	 *
	 * Note, that in modern internet, where routing is unreliable
	 * and in each dark corner broken firewalls sit, sending random
	 * errors ordered by their masters even this two messages finally lose
	 * their original sense (even Linux sends invalid PORT_UNREACHs)
	 *
	 * Now we are in compliance with RFCs.
	 *							--ANK (980905)
	 */

	inet = inet_sk(sk);
	if (!sock_owned_by_user(sk) && inet->recverr) {
		sk->sk_err = err;
		sk->sk_error_report(sk);
	} else	{ /* Only an error on timeout */
		sk->sk_err_soft = err;
	}

out:
	bh_unlock_sock(sk);
	sock_put(sk);
}

void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr)
{
	struct tcphdr *th = tcp_hdr(skb);

	if (skb->ip_summed == CHECKSUM_PARTIAL) {
		th->check = ~tcp_v4_check(skb->len, saddr, daddr, 0);
		skb->csum_start = skb_transport_header(skb) - skb->head;
		skb->csum_offset = offsetof(struct tcphdr, check);
	} else {
		th->check = tcp_v4_check(skb->len, saddr, daddr,
					 csum_partial(th,
						      th->doff << 2,
						      skb->csum));
	}
}

/* This routine computes an IPv4 TCP checksum. */
void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb)
{
	const struct inet_sock *inet = inet_sk(sk);

	__tcp_v4_send_check(skb, inet->inet_saddr, inet->inet_daddr);
}
EXPORT_SYMBOL(tcp_v4_send_check);

/*
 *	This routine will send an RST to the other tcp.
 *
 *	Someone asks: why I NEVER use socket parameters (TOS, TTL etc.)
 *		      for reset.
 *	Answer: if a packet caused RST, it is not for a socket
 *		existing in our system, if it is matched to a socket,
 *		it is just duplicate segment or bug in other side's TCP.
 *		So that we build reply only basing on parameters
 *		arrived with segment.
 *	Exception: precedence violation. We do not implement it in any case.
 */

static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
{
	const struct tcphdr *th = tcp_hdr(skb);
	struct {
		struct tcphdr th;
#ifdef CONFIG_TCP_MD5SIG
		__be32 opt[(TCPOLEN_MD5SIG_ALIGNED >> 2)];
#endif
	} rep;
	struct ip_reply_arg arg;
#ifdef CONFIG_TCP_MD5SIG
	struct tcp_md5sig_key *key;
	const __u8 *hash_location = NULL;
	unsigned char newhash[16];
	int genhash;
	struct sock *sk1 = NULL;
#endif
	struct net *net;

	/* Never send a reset in response to a reset. */
	if (th->rst)
		return;

	if (skb_rtable(skb)->rt_type != RTN_LOCAL)
		return;

	/* Swap the send and the receive. */
	memset(&rep, 0, sizeof(rep));
	rep.th.dest   = th->source;
	rep.th.source = th->dest;
	rep.th.doff   = sizeof(struct tcphdr) / 4;
	rep.th.rst    = 1;

	if (th->ack) {
		rep.th.seq = th->ack_seq;
	} else {
		rep.th.ack = 1;
		rep.th.ack_seq = htonl(ntohl(th->seq) + th->syn + th->fin +
				       skb->len - (th->doff << 2));
	}

	memset(&arg, 0, sizeof(arg));
	arg.iov[0].iov_base = (unsigned char *)&rep;
	arg.iov[0].iov_len  = sizeof(rep.th);

#ifdef CONFIG_TCP_MD5SIG
	hash_location = tcp_parse_md5sig_option(th);
	if (!sk && hash_location) {
		/*
		 * active side is lost. Try to find listening socket through
		 * source port, and then find md5 key through listening socket.
		 * we are not loose security here:
		 * Incoming packet is checked with md5 hash with finding key,
		 * no RST generated if md5 hash doesn't match.
		 */
		sk1 = __inet_lookup_listener(dev_net(skb_dst(skb)->dev),
					     &tcp_hashinfo, ip_hdr(skb)->saddr,
					     th->source, ip_hdr(skb)->daddr,
					     ntohs(th->source), inet_iif(skb));
		/* don't send rst if it can't find key */
		if (!sk1)
			return;
		rcu_read_lock();
		key = tcp_md5_do_lookup(sk1, (union tcp_md5_addr *)
					&ip_hdr(skb)->saddr, AF_INET);
		if (!key)
			goto release_sk1;

		genhash = tcp_v4_md5_hash_skb(newhash, key, NULL, NULL, skb);
		if (genhash || memcmp(hash_location, newhash, 16) != 0)
			goto release_sk1;
	} else {
		key = sk ? tcp_md5_do_lookup(sk, (union tcp_md5_addr *)
					     &ip_hdr(skb)->saddr,
					     AF_INET) : NULL;
	}

	if (key) {
		rep.opt[0] = htonl((TCPOPT_NOP << 24) |
				   (TCPOPT_NOP << 16) |
				   (TCPOPT_MD5SIG << 8) |
				   TCPOLEN_MD5SIG);
		/* Update length and the length the header thinks exists */
		arg.iov[0].iov_len += TCPOLEN_MD5SIG_ALIGNED;
		rep.th.doff = arg.iov[0].iov_len / 4;

		tcp_v4_md5_hash_hdr((__u8 *) &rep.opt[1],
				     key, ip_hdr(skb)->saddr,
				     ip_hdr(skb)->daddr, &rep.th);
	}
#endif
	arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr,
				      ip_hdr(skb)->saddr, /* XXX */
				      arg.iov[0].iov_len, IPPROTO_TCP, 0);
	arg.csumoffset = offsetof(struct tcphdr, check) / 2;
	arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0;
	/* When socket is gone, all binding information is lost.
	 * routing might fail in this case. No choice here, if we choose to force
	 * input interface, we will misroute in case of asymmetric route.
	 */
	if (sk)
		arg.bound_dev_if = sk->sk_bound_dev_if;

	net = dev_net(skb_dst(skb)->dev);
	arg.tos = ip_hdr(skb)->tos;
	ip_send_unicast_reply(net, skb, ip_hdr(skb)->saddr,
			      ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);

	TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
	TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS);

#ifdef CONFIG_TCP_MD5SIG
release_sk1:
	if (sk1) {
		rcu_read_unlock();
		sock_put(sk1);
	}
#endif
}

/* The code following below sending ACKs in SYN-RECV and TIME-WAIT states
   outside socket context is ugly, certainly. What can I do?
 */

static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
			    u32 win, u32 tsval, u32 tsecr, int oif,
			    struct tcp_md5sig_key *key,
			    int reply_flags, u8 tos)
{
	const struct tcphdr *th = tcp_hdr(skb);
	struct {
		struct tcphdr th;
		__be32 opt[(TCPOLEN_TSTAMP_ALIGNED >> 2)
#ifdef CONFIG_TCP_MD5SIG
			   + (TCPOLEN_MD5SIG_ALIGNED >> 2)
#endif
			];
	} rep;
	struct ip_reply_arg arg;
	struct net *net = dev_net(skb_dst(skb)->dev);

	memset(&rep.th, 0, sizeof(struct tcphdr));
	memset(&arg, 0, sizeof(arg));

	arg.iov[0].iov_base = (unsigned char *)&rep;
	arg.iov[0].iov_len  = sizeof(rep.th);
	if (tsecr) {
		rep.opt[0] = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
				   (TCPOPT_TIMESTAMP << 8) |
				   TCPOLEN_TIMESTAMP);
		rep.opt[1] = htonl(tsval);
		rep.opt[2] = htonl(tsecr);
		arg.iov[0].iov_len += TCPOLEN_TSTAMP_ALIGNED;
	}

	/* Swap the send and the receive. */
	rep.th.dest    = th->source;
	rep.th.source  = th->dest;
	rep.th.doff    = arg.iov[0].iov_len / 4;
	rep.th.seq     = htonl(seq);
	rep.th.ack_seq = htonl(ack);
	rep.th.ack     = 1;
	rep.th.window  = htons(win);

#ifdef CONFIG_TCP_MD5SIG
	if (key) {
		int offset = (tsecr) ? 3 : 0;

		rep.opt[offset++] = htonl((TCPOPT_NOP << 24) |
					  (TCPOPT_NOP << 16) |
					  (TCPOPT_MD5SIG << 8) |
					  TCPOLEN_MD5SIG);
		arg.iov[0].iov_len += TCPOLEN_MD5SIG_ALIGNED;
		rep.th.doff = arg.iov[0].iov_len/4;

		tcp_v4_md5_hash_hdr((__u8 *) &rep.opt[offset],
				    key, ip_hdr(skb)->saddr,
				    ip_hdr(skb)->daddr, &rep.th);
	}
#endif
	arg.flags = reply_flags;
	arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr,
				      ip_hdr(skb)->saddr, /* XXX */
				      arg.iov[0].iov_len, IPPROTO_TCP, 0);
	arg.csumoffset = offsetof(struct tcphdr, check) / 2;
	if (oif)
		arg.bound_dev_if = oif;
	arg.tos = tos;
	ip_send_unicast_reply(net, skb, ip_hdr(skb)->saddr,
			      ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);

	TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
}

static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb)
{
	struct inet_timewait_sock *tw = inet_twsk(sk);
	struct tcp_timewait_sock *tcptw = tcp_twsk(sk);

	tcp_v4_send_ack(skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt,
			tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale,
			tcp_time_stamp + tcptw->tw_ts_offset,
			tcptw->tw_ts_recent,
			tw->tw_bound_dev_if,
			tcp_twsk_md5_key(tcptw),
			tw->tw_transparent ? IP_REPLY_ARG_NOSRCCHECK : 0,
			tw->tw_tos
			);

	inet_twsk_put(tw);
}

static void tcp_v4_reqsk_send_ack(struct sock *sk, struct sk_buff *skb,
				  struct request_sock *req)
{
	/* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV
	 * sk->sk_state == TCP_SYN_RECV -> for Fast Open.
	 */
	tcp_v4_send_ack(skb, (sk->sk_state == TCP_LISTEN) ?
			tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt,
			tcp_rsk(req)->rcv_nxt, req->rcv_wnd,
			tcp_time_stamp,
			req->ts_recent,
			0,
			tcp_md5_do_lookup(sk, (union tcp_md5_addr *)&ip_hdr(skb)->daddr,
					  AF_INET),
			inet_rsk(req)->no_srccheck ? IP_REPLY_ARG_NOSRCCHECK : 0,
			ip_hdr(skb)->tos);
}

/*
 *	Send a SYN-ACK after having received a SYN.
 *	This still operates on a request_sock only, not on a big
 *	socket.
 */
static int tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst,
			      struct request_sock *req,
			      u16 queue_mapping)
{
	const struct inet_request_sock *ireq = inet_rsk(req);
	struct flowi4 fl4;
	int err = -1;
	struct sk_buff * skb;

	/* First, grab a route. */
	if (!dst && (dst = inet_csk_route_req(sk, &fl4, req)) == NULL)
		return -1;

	skb = tcp_make_synack(sk, dst, req, NULL);

	if (skb) {
		__tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr);

		skb_set_queue_mapping(skb, queue_mapping);
		err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr,
					    ireq->ir_rmt_addr,
					    ireq->opt);
		err = net_xmit_eval(err);
		if (!tcp_rsk(req)->snt_synack && !err)
			tcp_rsk(req)->snt_synack = tcp_time_stamp;
	}

	return err;
}

static int tcp_v4_rtx_synack(struct sock *sk, struct request_sock *req)
{
	int res = tcp_v4_send_synack(sk, NULL, req, 0);

	if (!res)
		TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_RETRANSSEGS);
	return res;
}

/*
 *	IPv4 request_sock destructor.
 */
static void tcp_v4_reqsk_destructor(struct request_sock *req)
{
	kfree(inet_rsk(req)->opt);
}

/*
 * Return true if a syncookie should be sent
 */
bool tcp_syn_flood_action(struct sock *sk,
			 const struct sk_buff *skb,
			 const char *proto)
{
	const char *msg = "Dropping request";
	bool want_cookie = false;
	struct listen_sock *lopt;



#ifdef CONFIG_SYN_COOKIES
	if (sysctl_tcp_syncookies) {
		msg = "Sending cookies";
		want_cookie = true;
		NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDOCOOKIES);
	} else
#endif
		NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDROP);

	lopt = inet_csk(sk)->icsk_accept_queue.listen_opt;
	if (!lopt->synflood_warned && sysctl_tcp_syncookies != 2) {
		lopt->synflood_warned = 1;
		pr_info("%s: Possible SYN flooding on port %d. %s.  Check SNMP counters.\n",
			proto, ntohs(tcp_hdr(skb)->dest), msg);
	}
	return want_cookie;
}
EXPORT_SYMBOL(tcp_syn_flood_action);

/*
 * Save and compile IPv4 options into the request_sock if needed.
 */
static struct ip_options_rcu *tcp_v4_save_options(struct sk_buff *skb)
{
	const struct ip_options *opt = &(IPCB(skb)->opt);
	struct ip_options_rcu *dopt = NULL;

	if (opt && opt->optlen) {
		int opt_size = sizeof(*dopt) + opt->optlen;

		dopt = kmalloc(opt_size, GFP_ATOMIC);
		if (dopt) {
			if (ip_options_echo(&dopt->opt, skb)) {
				kfree(dopt);
				dopt = NULL;
			}
		}
	}
	return dopt;
}

#ifdef CONFIG_TCP_MD5SIG
/*
 * RFC2385 MD5 checksumming requires a mapping of
 * IP address->MD5 Key.
 * We need to maintain these in the sk structure.
 */

/* Find the Key structure for an address.  */
struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
					 const union tcp_md5_addr *addr,
					 int family)
{
	struct tcp_sock *tp = tcp_sk(sk);
	struct tcp_md5sig_key *key;
	unsigned int size = sizeof(struct in_addr);
	struct tcp_md5sig_info *md5sig;

	/* caller either holds rcu_read_lock() or socket lock */
	md5sig = rcu_dereference_check(tp->md5sig_info,
				       sock_owned_by_user(sk) ||
				       lockdep_is_held(&sk->sk_lock.slock));
	if (!md5sig)
		return NULL;
#if IS_ENABLED(CONFIG_IPV6)
	if (family == AF_INET6)
		size = sizeof(struct in6_addr);
#endif
	hlist_for_each_entry_rcu(key, &md5sig->head, node) {
		if (key->family != family)
			continue;
		if (!memcmp(&key->addr, addr, size))
			return key;
	}
	return NULL;
}
EXPORT_SYMBOL(tcp_md5_do_lookup);

struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
					 struct sock *addr_sk)
{
	union tcp_md5_addr *addr;

	addr = (union tcp_md5_addr *)&inet_sk(addr_sk)->inet_daddr;
	return tcp_md5_do_lookup(sk, addr, AF_INET);
}
EXPORT_SYMBOL(tcp_v4_md5_lookup);

static struct tcp_md5sig_key *tcp_v4_reqsk_md5_lookup(struct sock *sk,
						      struct request_sock *req)
{
	union tcp_md5_addr *addr;

	addr = (union tcp_md5_addr *)&inet_rsk(req)->ir_rmt_addr;
	return tcp_md5_do_lookup(sk, addr, AF_INET);
}

/* This can be called on a newly created socket, from other files */
int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
		   int family, const u8 *newkey, u8 newkeylen, gfp_t gfp)
{
	/* Add Key to the list */
	struct tcp_md5sig_key *key;
	struct tcp_sock *tp = tcp_sk(sk);
	struct tcp_md5sig_info *md5sig;

	key = tcp_md5_do_lookup(sk, addr, family);
	if (key) {
		/* Pre-existing entry - just update that one. */
		memcpy(key->key, newkey, newkeylen);
		key->keylen = newkeylen;
		return 0;
	}

	md5sig = rcu_dereference_protected(tp->md5sig_info,
					   sock_owned_by_user(sk));
	if (!md5sig) {
		md5sig = kmalloc(sizeof(*md5sig), gfp);
		if (!md5sig)
			return -ENOMEM;

		sk_nocaps_add(sk, NETIF_F_GSO_MASK);
		INIT_HLIST_HEAD(&md5sig->head);
		rcu_assign_pointer(tp->md5sig_info, md5sig);
	}

	key = sock_kmalloc(sk, sizeof(*key), gfp);
	if (!key)
		return -ENOMEM;
	if (!tcp_alloc_md5sig_pool()) {
		sock_kfree_s(sk, key, sizeof(*key));
		return -ENOMEM;
	}

	memcpy(key->key, newkey, newkeylen);
	key->keylen = newkeylen;
	key->family = family;
	memcpy(&key->addr, addr,
	       (family == AF_INET6) ? sizeof(struct in6_addr) :
				      sizeof(struct in_addr));
	hlist_add_head_rcu(&key->node, &md5sig->head);
	return 0;
}
EXPORT_SYMBOL(tcp_md5_do_add);

int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, int family)
{
	struct tcp_md5sig_key *key;

	key = tcp_md5_do_lookup(sk, addr, family);
	if (!key)
		return -ENOENT;
	hlist_del_rcu(&key->node);
	atomic_sub(sizeof(*key), &sk->sk_omem_alloc);
	kfree_rcu(key, rcu);
	return 0;
}
EXPORT_SYMBOL(tcp_md5_do_del);

static void tcp_clear_md5_list(struct sock *sk)
{
	struct tcp_sock *tp = tcp_sk(sk);
	struct tcp_md5sig_key *key;
	struct hlist_node *n;
	struct tcp_md5sig_info *md5sig;

	md5sig = rcu_dereference_protected(tp->md5sig_info, 1);

	hlist_for_each_entry_safe(key, n, &md5sig->head, node) {
		hlist_del_rcu(&key->node);
		atomic_sub(sizeof(*key), &sk->sk_omem_alloc);
		kfree_rcu(key, rcu);
	}
}

static int tcp_v4_parse_md5_keys(struct sock *sk, char __user *optval,
				 int optlen)
{
	struct tcp_md5sig cmd;
	struct sockaddr_in *sin = (struct sockaddr_in *)&cmd.tcpm_addr;

	if (optlen < sizeof(cmd))
		return -EINVAL;

	if (copy_from_user(&cmd, optval, sizeof(cmd)))
		return -EFAULT;

	if (sin->sin_family != AF_INET)
		return -EINVAL;

	if (!cmd.tcpm_key || !cmd.tcpm_keylen)
		return tcp_md5_do_del(sk, (union tcp_md5_addr *)&sin->sin_addr.s_addr,
				      AF_INET);

	if (cmd.tcpm_keylen > TCP_MD5SIG_MAXKEYLEN)
		return -EINVAL;

	return tcp_md5_do_add(sk, (union tcp_md5_addr *)&sin->sin_addr.s_addr,
			      AF_INET, cmd.tcpm_key, cmd.tcpm_keylen,
			      GFP_KERNEL);
}

static int tcp_v4_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp,
					__be32 daddr, __be32 saddr, int nbytes)
{
	struct tcp4_pseudohdr *bp;
	struct scatterlist sg;

	bp = &hp->md5_blk.ip4;

	/*
	 * 1. the TCP pseudo-header (in the order: source IP address,
	 * destination IP address, zero-padded protocol number, and
	 * segment length)
	 */
	bp->saddr = saddr;
	bp->daddr = daddr;
	bp->pad = 0;
	bp->protocol = IPPROTO_TCP;
	bp->len = cpu_to_be16(nbytes);

	sg_init_one(&sg, bp, sizeof(*bp));
	return crypto_hash_update(&hp->md5_desc, &sg, sizeof(*bp));
}

static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key,
			       __be32 daddr, __be32 saddr, const struct tcphdr *th)
{
	struct tcp_md5sig_pool *hp;
	struct hash_desc *desc;

	hp = tcp_get_md5sig_pool();
	if (!hp)
		goto clear_hash_noput;
	desc = &hp->md5_desc;

	if (crypto_hash_init(desc))
		goto clear_hash;
	if (tcp_v4_md5_hash_pseudoheader(hp, daddr, saddr, th->doff << 2))
		goto clear_hash;
	if (tcp_md5_hash_header(hp, th))
		goto clear_hash;
	if (tcp_md5_hash_key(hp, key))
		goto clear_hash;
	if (crypto_hash_final(desc, md5_hash))
		goto clear_hash;

	tcp_put_md5sig_pool();
	return 0;

clear_hash:
	tcp_put_md5sig_pool();
clear_hash_noput:
	memset(md5_hash, 0, 16);
	return 1;
}

int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
			const struct sock *sk, const struct request_sock *req,
			const struct sk_buff *skb)
{
	struct tcp_md5sig_pool *hp;
	struct hash_desc *desc;
	const struct tcphdr *th = tcp_hdr(skb);
	__be32 saddr, daddr;

	if (sk) {
		saddr = inet_sk(sk)->inet_saddr;
		daddr = inet_sk(sk)->inet_daddr;
	} else if (req) {
		saddr = inet_rsk(req)->ir_loc_addr;
		daddr = inet_rsk(req)->ir_rmt_addr;
	} else {
		const struct iphdr *iph = ip_hdr(skb);
		saddr = iph->saddr;
		daddr = iph->daddr;
	}

	hp = tcp_get_md5sig_pool();
	if (!hp)
		goto clear_hash_noput;
	desc = &hp->md5_desc;

	if (crypto_hash_init(desc))
		goto clear_hash;

	if (tcp_v4_md5_hash_pseudoheader(hp, daddr, saddr, skb->len))
		goto clear_hash;
	if (tcp_md5_hash_header(hp, th))
		goto clear_hash;
	if (tcp_md5_hash_skb_data(hp, skb, th->doff << 2))
		goto clear_hash;
	if (tcp_md5_hash_key(hp, key))
		goto clear_hash;
	if (crypto_hash_final(desc, md5_hash))
		goto clear_hash;

	tcp_put_md5sig_pool();
	return 0;

clear_hash:
	tcp_put_md5sig_pool();
clear_hash_noput:
	memset(md5_hash, 0, 16);
	return 1;
}
EXPORT_SYMBOL(tcp_v4_md5_hash_skb);

static bool tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
{
	/*
	 * This gets called for each TCP segment that arrives
	 * so we want to be efficient.
	 * We have 3 drop cases:
	 * o No MD5 hash and one expected.
	 * o MD5 hash and we're not expecting one.
	 * o MD5 hash and its wrong.
	 */
	const __u8 *hash_location = NULL;
	struct tcp_md5sig_key *hash_expected;
	const struct iphdr *iph = ip_hdr(skb);
	const struct tcphdr *th = tcp_hdr(skb);
	int genhash;
	unsigned char newhash[16];

	hash_expected = tcp_md5_do_lookup(sk, (union tcp_md5_addr *)&iph->saddr,
					  AF_INET);
	hash_location = tcp_parse_md5sig_option(th);

	/* We've parsed the options - do we have a hash? */
	if (!hash_expected && !hash_location)
		return false;

	if (hash_expected && !hash_location) {
		NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
		return true;
	}

	if (!hash_expected && hash_location) {
		NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
		return true;
	}

	/* Okay, so this is hash_expected and hash_location -
	 * so we need to calculate the checksum.
	 */
	genhash = tcp_v4_md5_hash_skb(newhash,
				      hash_expected,
				      NULL, NULL, skb);

	if (genhash || memcmp(hash_location, newhash, 16) != 0) {
		net_info_ratelimited("MD5 Hash failed for (%pI4, %d)->(%pI4, %d)%s\n",
				     &iph->saddr, ntohs(th->source),
				     &iph->daddr, ntohs(th->dest),
				     genhash ? " tcp_v4_calc_md5_hash failed"
				     : "");
		return true;
	}
	return false;
}

#endif

struct request_sock_ops tcp_request_sock_ops __read_mostly = {
	.family		=	PF_INET,
	.obj_size	=	sizeof(struct tcp_request_sock),
	.rtx_syn_ack	=	tcp_v4_rtx_synack,
	.send_ack	=	tcp_v4_reqsk_send_ack,
	.destructor	=	tcp_v4_reqsk_destructor,
	.send_reset	=	tcp_v4_send_reset,
	.syn_ack_timeout = 	tcp_syn_ack_timeout,
};

#ifdef CONFIG_TCP_MD5SIG
static const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = {
	.md5_lookup	=	tcp_v4_reqsk_md5_lookup,
	.calc_md5_hash	=	tcp_v4_md5_hash_skb,
};
#endif

static bool tcp_fastopen_check(struct sock *sk, struct sk_buff *skb,
			       struct request_sock *req,
			       struct tcp_fastopen_cookie *foc,
			       struct tcp_fastopen_cookie *valid_foc)
{
	bool skip_cookie = false;
	struct fastopen_queue *fastopenq;

	if (likely(!fastopen_cookie_present(foc))) {
		/* See include/net/tcp.h for the meaning of these knobs */
		if ((sysctl_tcp_fastopen & TFO_SERVER_ALWAYS) ||
		    ((sysctl_tcp_fastopen & TFO_SERVER_COOKIE_NOT_REQD) &&
		    (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq + 1)))
			skip_cookie = true; /* no cookie to validate */
		else
			return false;
	}
	fastopenq = inet_csk(sk)->icsk_accept_queue.fastopenq;
	/* A FO option is present; bump the counter. */
	NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPFASTOPENPASSIVE);

	/* Make sure the listener has enabled fastopen, and we don't
	 * exceed the max # of pending TFO requests allowed before trying
	 * to validating the cookie in order to avoid burning CPU cycles
	 * unnecessarily.
	 *
	 * XXX (TFO) - The implication of checking the max_qlen before
	 * processing a cookie request is that clients can't differentiate
	 * between qlen overflow causing Fast Open to be disabled
	 * temporarily vs a server not supporting Fast Open at all.
	 */
	if ((sysctl_tcp_fastopen & TFO_SERVER_ENABLE) == 0 ||
	    fastopenq == NULL || fastopenq->max_qlen == 0)
		return false;

	if (fastopenq->qlen >= fastopenq->max_qlen) {
		struct request_sock *req1;
		spin_lock(&fastopenq->lock);
		req1 = fastopenq->rskq_rst_head;
		if ((req1 == NULL) || time_after(req1->expires, jiffies)) {
			spin_unlock(&fastopenq->lock);
			NET_INC_STATS_BH(sock_net(sk),
			    LINUX_MIB_TCPFASTOPENLISTENOVERFLOW);
			/* Avoid bumping LINUX_MIB_TCPFASTOPENPASSIVEFAIL*/
			foc->len = -1;
			return false;
		}
		fastopenq->rskq_rst_head = req1->dl_next;
		fastopenq->qlen--;
		spin_unlock(&fastopenq->lock);
		reqsk_free(req1);
	}
	if (skip_cookie) {
		tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
		return true;
	}

	if (foc->len == TCP_FASTOPEN_COOKIE_SIZE) {
		if ((sysctl_tcp_fastopen & TFO_SERVER_COOKIE_NOT_CHKED) == 0) {
			tcp_fastopen_cookie_gen(ip_hdr(skb)->saddr,
						ip_hdr(skb)->daddr, valid_foc);
			if ((valid_foc->len != TCP_FASTOPEN_COOKIE_SIZE) ||
			    memcmp(&foc->val[0], &valid_foc->val[0],
			    TCP_FASTOPEN_COOKIE_SIZE) != 0)
				return false;
			valid_foc->len = -1;
		}
		/* Acknowledge the data received from the peer. */
		tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
		return true;
	} else if (foc->len == 0) { /* Client requesting a cookie */
		tcp_fastopen_cookie_gen(ip_hdr(skb)->saddr,
					ip_hdr(skb)->daddr, valid_foc);
		NET_INC_STATS_BH(sock_net(sk),
		    LINUX_MIB_TCPFASTOPENCOOKIEREQD);
	} else {
		/* Client sent a cookie with wrong size. Treat it
		 * the same as invalid and return a valid one.
		 */
		tcp_fastopen_cookie_gen(ip_hdr(skb)->saddr,
					ip_hdr(skb)->daddr, valid_foc);
	}
	return false;
}

static int tcp_v4_conn_req_fastopen(struct sock *sk,
				    struct sk_buff *skb,
				    struct sk_buff *skb_synack,
				    struct request_sock *req)
{
	struct tcp_sock *tp = tcp_sk(sk);
	struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue;
	const struct inet_request_sock *ireq = inet_rsk(req);
	struct sock *child;
	int err;

	req->num_retrans = 0;
	req->num_timeout = 0;
	req->sk = NULL;

	child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb, req, NULL);
	if (child == NULL) {
		NET_INC_STATS_BH(sock_net(sk),
				 LINUX_MIB_TCPFASTOPENPASSIVEFAIL);
		kfree_skb(skb_synack);
		return -1;
	}
	err = ip_build_and_send_pkt(skb_synack, sk, ireq->ir_loc_addr,
				    ireq->ir_rmt_addr, ireq->opt);
	err = net_xmit_eval(err);
	if (!err)
		tcp_rsk(req)->snt_synack = tcp_time_stamp;
	/* XXX (TFO) - is it ok to ignore error and continue? */

	spin_lock(&queue->fastopenq->lock);
	queue->fastopenq->qlen++;
	spin_unlock(&queue->fastopenq->lock);

	/* Initialize the child socket. Have to fix some values to take
	 * into account the child is a Fast Open socket and is created
	 * only out of the bits carried in the SYN packet.
	 */
	tp = tcp_sk(child);

	tp->fastopen_rsk = req;
	/* Do a hold on the listner sk so that if the listener is being
	 * closed, the child that has been accepted can live on and still
	 * access listen_lock.
	 */
	sock_hold(sk);
	tcp_rsk(req)->listener = sk;

	/* RFC1323: The window in SYN & SYN/ACK segments is never
	 * scaled. So correct it appropriately.
	 */
	tp->snd_wnd = ntohs(tcp_hdr(skb)->window);

	/* Activate the retrans timer so that SYNACK can be retransmitted.
	 * The request socket is not added to the SYN table of the parent
	 * because it's been added to the accept queue directly.
	 */
	inet_csk_reset_xmit_timer(child, ICSK_TIME_RETRANS,
	    TCP_TIMEOUT_INIT, TCP_RTO_MAX);

	/* Add the child socket directly into the accept queue */
	inet_csk_reqsk_queue_add(sk, req, child);

	/* Now finish processing the fastopen child socket. */
	inet_csk(child)->icsk_af_ops->rebuild_header(child);
	tcp_init_congestion_control(child);
	tcp_mtup_init(child);
	tcp_init_metrics(child);
	tcp_init_buffer_space(child);

	/* Queue the data carried in the SYN packet. We need to first
	 * bump skb's refcnt because the caller will attempt to free it.
	 *
	 * XXX (TFO) - we honor a zero-payload TFO request for now.
	 * (Any reason not to?)
	 */
	if (TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq + 1) {
		/* Don't queue the skb if there is no payload in SYN.
		 * XXX (TFO) - How about SYN+FIN?
		 */
		tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
	} else {
		skb = skb_get(skb);
		skb_dst_drop(skb);
		__skb_pull(skb, tcp_hdr(skb)->doff * 4);
		skb_set_owner_r(skb, child);
		__skb_queue_tail(&child->sk_receive_queue, skb);
		tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
		tp->syn_data_acked = 1;
	}
	sk->sk_data_ready(sk, 0);
	bh_unlock_sock(child);
	sock_put(child);
	WARN_ON(req->sk == NULL);
	return 0;
}

int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
{
	struct tcp_options_received tmp_opt;
	struct request_sock *req;
	struct inet_request_sock *ireq;
	struct tcp_sock *tp = tcp_sk(sk);
	struct dst_entry *dst = NULL;
	__be32 saddr = ip_hdr(skb)->saddr;
	__be32 daddr = ip_hdr(skb)->daddr;
	__u32 isn = TCP_SKB_CB(skb)->when;
	bool want_cookie = false;
	struct flowi4 fl4;
	struct tcp_fastopen_cookie foc = { .len = -1 };
	struct tcp_fastopen_cookie valid_foc = { .len = -1 };
	struct sk_buff *skb_synack;
	int do_fastopen;

	/* Never answer to SYNs send to broadcast or multicast */
	if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
		goto drop;

	/* TW buckets are converted to open requests without
	 * limitations, they conserve resources and peer is
	 * evidently real one.
	 */
	if ((sysctl_tcp_syncookies == 2 ||
	     inet_csk_reqsk_queue_is_full(sk)) && !isn) {
		want_cookie = tcp_syn_flood_action(sk, skb, "TCP");
		if (!want_cookie)
			goto drop;
	}

	/* Accept backlog is full. If we have already queued enough
	 * of warm entries in syn queue, drop request. It is better than
	 * clogging syn queue with openreqs with exponentially increasing
	 * timeout.
	 */
	if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) {
		NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS);
		goto drop;
	}

	req = inet_reqsk_alloc(&tcp_request_sock_ops);
	if (!req)
		goto drop;

#ifdef CONFIG_TCP_MD5SIG
	tcp_rsk(req)->af_specific = &tcp_request_sock_ipv4_ops;
#endif

	tcp_clear_options(&tmp_opt);
	tmp_opt.mss_clamp = TCP_MSS_DEFAULT;
	tmp_opt.user_mss  = tp->rx_opt.user_mss;
	tcp_parse_options(skb, &tmp_opt, 0, want_cookie ? NULL : &foc);

	if (want_cookie && !tmp_opt.saw_tstamp)
		tcp_clear_options(&tmp_opt);

	tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
	tcp_openreq_init(req, &tmp_opt, skb);

	ireq = inet_rsk(req);
	ireq->ir_loc_addr = daddr;
	ireq->ir_rmt_addr = saddr;
	ireq->no_srccheck = inet_sk(sk)->transparent;
	ireq->opt = tcp_v4_save_options(skb);

	if (security_inet_conn_request(sk, skb, req))
		goto drop_and_free;

	if (!want_cookie || tmp_opt.tstamp_ok)
		TCP_ECN_create_request(req, skb, sock_net(sk));

	if (want_cookie) {
		isn = cookie_v4_init_sequence(sk, skb, &req->mss);
		req->cookie_ts = tmp_opt.tstamp_ok;
	} else if (!isn) {
		/* VJ's idea. We save last timestamp seen
		 * from the destination in peer table, when entering
		 * state TIME-WAIT, and check against it before
		 * accepting new connection request.
		 *
		 * If "isn" is not zero, this request hit alive
		 * timewait bucket, so that all the necessary checks
		 * are made in the function processing timewait state.
		 */
		if (tmp_opt.saw_tstamp &&
		    tcp_death_row.sysctl_tw_recycle &&
		    (dst = inet_csk_route_req(sk, &fl4, req)) != NULL &&
		    fl4.daddr == saddr) {
			if (!tcp_peer_is_proven(req, dst, true)) {
				NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSPASSIVEREJECTED);
				goto drop_and_release;
			}
		}
		/* Kill the following clause, if you dislike this way. */
		else if (!sysctl_tcp_syncookies &&
			 (sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) <
			  (sysctl_max_syn_backlog >> 2)) &&
			 !tcp_peer_is_proven(req, dst, false)) {
			/* Without syncookies last quarter of
			 * backlog is filled with destinations,
			 * proven to be alive.
			 * It means that we continue to communicate
			 * to destinations, already remembered
			 * to the moment of synflood.
			 */
			LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("drop open request from %pI4/%u\n"),
				       &saddr, ntohs(tcp_hdr(skb)->source));
			goto drop_and_release;
		}

		isn = tcp_v4_init_sequence(skb);
	}
	tcp_rsk(req)->snt_isn = isn;

	if (dst == NULL) {
		dst = inet_csk_route_req(sk, &fl4, req);
		if (dst == NULL)
			goto drop_and_free;
	}
	do_fastopen = tcp_fastopen_check(sk, skb, req, &foc, &valid_foc);

	/* We don't call tcp_v4_send_synack() directly because we need
	 * to make sure a child socket can be created successfully before
	 * sending back synack!
	 *
	 * XXX (TFO) - Ideally one would simply call tcp_v4_send_synack()
	 * (or better yet, call tcp_send_synack() in the child context
	 * directly, but will have to fix bunch of other code first)
	 * after syn_recv_sock() except one will need to first fix the
	 * latter to remove its dependency on the current implementation
	 * of tcp_v4_send_synack()->tcp_select_initial_window().
	 */
	skb_synack = tcp_make_synack(sk, dst, req,
	    fastopen_cookie_present(&valid_foc) ? &valid_foc : NULL);

	if (skb_synack) {
		__tcp_v4_send_check(skb_synack, ireq->ir_loc_addr, ireq->ir_rmt_addr);
		skb_set_queue_mapping(skb_synack, skb_get_queue_mapping(skb));