net: ipv4: fix for a race condition in raw_sendmsg
authorMohamed Ghannam <simo.ghannam@gmail.com>
Sun, 10 Dec 2017 03:50:58 +0000 (03:50 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 23 Dec 2017 00:39:51 +0000 (00:39 +0000)
commit01839e5bf925cc0d375dda5f7792a472a8deadda
treea91fe9cdad8619696c0d4197a23c0d4fd57e673b
parent6fc81ba10a36b2f16fa6e68759c52b9ee5e5afa3
net: ipv4: fix for a race condition in raw_sendmsg

inet->hdrincl is racy, and could lead to uninitialized stack pointer
usage, so its value should be read only once.

Fixes: c008ba5bdc9f ("ipv4: Avoid reading user iov twice after raw_probe_proto_opt")
Signed-off-by: Mohamed Ghannam <simo.ghannam@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 4.9: adjust context]

Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name net-ipv4-fix-for-a-race-condition-in-raw_sendmsg.patch
net/ipv4/raw.c