]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
tcp: Protect accesses to .ts_recent_stamp with {READ,WRITE}_ONCE()
authorGuillaume Nault <gnault@redhat.com>
Fri, 6 Dec 2019 11:38:49 +0000 (12:38 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 04:45:21 +0000 (23:45 -0500)
commit062737f7ee7a9ac52241e23a82c2da7f57b53b96
treed608abeea387a08b053780d8c47a659ca7b695e4
parentf138854aaddcc177b06035ec2755017cfb9ea5f6
tcp: Protect accesses to .ts_recent_stamp with {READ,WRITE}_ONCE()

BugLink: https://bugs.launchpad.net/bugs/1859249
[ Upstream commit 721c8dafad26ccfa90ff659ee19755e3377b829d ]

Syncookies borrow the ->rx_opt.ts_recent_stamp field to store the
timestamp of the last synflood. Protect them with READ_ONCE() and
WRITE_ONCE() since reads and writes aren't serialised.

Use of .rx_opt.ts_recent_stamp for storing the synflood timestamp was
introduced by a0f82f64e269 ("syncookies: remove last_synq_overflow from
struct tcp_sock"). But unprotected accesses were already there when
timestamp was stored in .last_synq_overflow.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
include/net/tcp.h