aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_flowlabel.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-28 18:38:35 +0200
committerDavid S. Miller <davem@davemloft.net>2020-07-28 13:43:40 -0700
commitd3c48151512922dd35f1f393b30b9138e4441d14 (patch)
treef283952cf8a17bf8ecca6c4f11aab2252aaa8b46 /net/ipv6/ip6_flowlabel.c
parentnet: make sockptr_is_null strict aliasing safe (diff)
downloadlinux-dev-d3c48151512922dd35f1f393b30b9138e4441d14.tar.xz
linux-dev-d3c48151512922dd35f1f393b30b9138e4441d14.zip
net: remove sockptr_advance
sockptr_advance never properly worked. Replace it with _offset variants of copy_from_sockptr and copy_to_sockptr. Fixes: ba423fdaa589 ("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>
Diffstat (limited to 'net/ipv6/ip6_flowlabel.c')
-rw-r--r--net/ipv6/ip6_flowlabel.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 215b6f5e733e..2d655260dedc 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -401,8 +401,8 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq,
memset(fl->opt, 0, sizeof(*fl->opt));
fl->opt->tot_len = sizeof(*fl->opt) + olen;
err = -EFAULT;
- sockptr_advance(optval, CMSG_ALIGN(sizeof(*freq)));
- if (copy_from_sockptr(fl->opt + 1, optval, olen))
+ if (copy_from_sockptr_offset(fl->opt + 1, optval,
+ CMSG_ALIGN(sizeof(*freq)), olen))
goto done;
msg.msg_controllen = olen;
@@ -703,9 +703,10 @@ release:
goto recheck;
if (!freq->flr_label) {
- sockptr_advance(optval,
- offsetof(struct in6_flowlabel_req, flr_label));
- if (copy_to_sockptr(optval, &fl->label, sizeof(fl->label))) {
+ size_t offset = offsetof(struct in6_flowlabel_req, flr_label);
+
+ if (copy_to_sockptr_offset(optval, offset, &fl->label,
+ sizeof(fl->label))) {
/* Intentionally ignore fault. */
}
}