net: remove sockptr_advance

sockptr_advance never properly worked.  Replace it with _offset variants
of copy_from_sockptr and copy_to_sockptr.

Fixes: ba423fdaa5 ("net: add a new sockptr_t type")
Reported-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Ido Schimmel <idosch@idosch.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tested-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christoph Hellwig
2020-07-28 18:38:35 +02:00
committed by David S. Miller
parent 035bfd051e
commit d3c4815151
10 changed files with 49 additions and 48 deletions

View File

@@ -2801,12 +2801,13 @@ static int tcp_repair_options_est(struct sock *sk, sockptr_t optbuf,
{
struct tcp_sock *tp = tcp_sk(sk);
struct tcp_repair_opt opt;
size_t offset = 0;
while (len >= sizeof(opt)) {
if (copy_from_sockptr(&opt, optbuf, sizeof(opt)))
if (copy_from_sockptr_offset(&opt, optbuf, offset, sizeof(opt)))
return -EFAULT;
sockptr_advance(optbuf, sizeof(opt));
offset += sizeof(opt);
len -= sizeof(opt);
switch (opt.opt_code) {