summaryrefslogtreecommitdiff
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2018-06-05 11:52:33 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2018-06-05 11:52:33 +0200
commiteca84e5091c71c7834d93f38570700420625fcf0 (patch)
tree07aefb423575a24794e2bd771dfde143e0538dab /net/ipv4/tcp_input.c
parent019b711f9e6a391e3449beccfae3b910ffe6ea14 (diff)
parent2c6025ebc7fd8e0a8ca785d778dc6ae25225744b (diff)
Merge 4.14.48 into android-4.14
Changes in 4.14.48 fix io_destroy()/aio_complete() race mm: fix the NULL mapping case in __isolate_lru_page() objtool: Support GCC 8's cold subfunctions objtool: Support GCC 8 switch tables objtool: Detect RIP-relative switch table references objtool: Detect RIP-relative switch table references, part 2 objtool: Fix "noreturn" detection for recursive sibling calls x86/mce/AMD: Carve out SMCA get_block_address() code x86/MCE/AMD: Cache SMCA MISC block addresses Revert "pinctrl: msm: Use dynamic GPIO numbering" PCI: hv: Fix 2 hang issues in hv_compose_msi_msg() xfs: convert XFS_AGFL_SIZE to a helper function xfs: detect agfl count corruption and reset agfl Input: synaptics - Lenovo Carbon X1 Gen5 (2017) devices should use RMI Input: synaptics - Lenovo Thinkpad X1 Carbon G5 (2017) with Elantech trackpoints should use RMI Input: synaptics - add Intertouch support on X1 Carbon 6th and X280 Input: synaptics - add Lenovo 80 series ids to SMBus Input: elan_i2c_smbus - fix corrupted stack tracing: Fix crash when freeing instances with event triggers tracing: Make the snapshot trigger work with instances selinux: KASAN: slab-out-of-bounds in xattr_getsecurity cfg80211: further limit wiphy names to 64 bytes kbuild: clang: remove crufty HOSTCFLAGS drm/i915: Always sanity check engine state upon idling dma-buf: remove redundant initialization of sg_table drm/amd/powerplay: Fix enum mismatch rtlwifi: rtl8192cu: Remove variable self-assignment in rf.c ASoC: Intel: sst: remove redundant variable dma_dev_name platform/chrome: cros_ec_lpc: remove redundant pointer request kbuild: clang: disable unused variable warnings only when constant tcp: avoid integer overflows in tcp_rcv_space_adjust() iio: ad7793: implement IIO_CHAN_INFO_SAMP_FREQ iio:buffer: make length types match kfifo types iio:kfifo_buf: check for uint overflow iio: adc: select buffer for at91-sama5d2_adc MIPS: lantiq: gphy: Drop reboot/remove reset asserts MIPS: ptrace: Fix PTRACE_PEEKUSR requests for 64-bit FGRs MIPS: prctl: Disallow FRE without FR with PR_SET_FP_MODE requests scsi: scsi_transport_srp: Fix shost to rport translation stm class: Use vmalloc for the master map hwtracing: stm: fix build error on some arches IB/core: Fix error code for invalid GID entry mm/huge_memory.c: __split_huge_page() use atomic ClearPageDirty() Revert "rt2800: use TXOP_BACKOFF for probe frames" intel_th: Use correct device when freeing buffers drm/psr: Fix missed entry in PSR setup time table. drm/i915/lvds: Move acpi lid notification registration to registration phase drm/i915: Disable LVDS on Radiant P845 powerpc/mm/slice: Remove intermediate bitmap copy powerpc/mm/slice: create header files dedicated to slices powerpc/mm/slice: Enhance for supporting PPC32 powerpc/mm/slice: Fix hugepage allocation at hint address on 8xx Linux 4.14.48 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 1197f85c105a..ba5628689c57 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -592,8 +592,8 @@ static inline void tcp_rcv_rtt_measure_ts(struct sock *sk,
void tcp_rcv_space_adjust(struct sock *sk)
{
struct tcp_sock *tp = tcp_sk(sk);
+ u32 copied;
int time;
- int copied;
tcp_mstamp_refresh(tp);
time = tcp_stamp_us_delta(tp->tcp_mstamp, tp->rcvq_space.time);
@@ -616,12 +616,13 @@ void tcp_rcv_space_adjust(struct sock *sk)
if (sysctl_tcp_moderate_rcvbuf &&
!(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) {
- int rcvwin, rcvmem, rcvbuf;
+ int rcvmem, rcvbuf;
+ u64 rcvwin;
/* minimal window to cope with packet losses, assuming
* steady state. Add some cushion because of small variations.
*/
- rcvwin = (copied << 1) + 16 * tp->advmss;
+ rcvwin = ((u64)copied << 1) + 16 * tp->advmss;
/* If rate increased by 25%,
* assume slow start, rcvwin = 3 * copied
@@ -641,7 +642,8 @@ void tcp_rcv_space_adjust(struct sock *sk)
while (tcp_win_from_space(rcvmem) < tp->advmss)
rcvmem += 128;
- rcvbuf = min(rcvwin / tp->advmss * rcvmem, sysctl_tcp_rmem[2]);
+ do_div(rcvwin, tp->advmss);
+ rcvbuf = min_t(u64, rcvwin * rcvmem, sysctl_tcp_rmem[2]);
if (rcvbuf > sk->sk_rcvbuf) {
sk->sk_rcvbuf = rcvbuf;