ipv4: Avoid reading user iov twice after raw_probe_proto_opt
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 7 Nov 2014 13:27:09 +0000 (21:27 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 3 Mar 2018 15:50:46 +0000 (15:50 +0000)
commitb800532602c7249778ea2af0c4bcbb583eaeb705
treed8dde534a745fd274e71bbcbe35b2f39c9da2c44
parent9c9c53c5ef6ded65dfc624e3962d5e15f8cfd4c6
ipv4: Avoid reading user iov twice after raw_probe_proto_opt

commit c008ba5bdc9fa830e1a349b20b0be5a137bdef7a upstream.

Ever since raw_probe_proto_opt was added it had the problem of
causing the user iov to be read twice, once during the probe for
the protocol header and once again in ip_append_data.

This is a potential security problem since it means that whatever
we're probing may be invalid.  This patch plugs the hole by
firstly advancing the iov so we don't read the same spot again,
and secondly saving what we read the first time around for use
by ip_append_data.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/ipv4/raw.c