OSDN Git Service

net: always initialize pagedlen
authorWillem de Bruijn <willemb@google.com>
Sat, 24 Nov 2018 19:21:16 +0000 (14:21 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 13:50:03 +0000 (14:50 +0100)
commita03e8f192ad2b3378cc24988874726dace837616
tree871a0afa5a559c97d05f794dcd7d32067e53690e
parent23ad614cb5001fc005e85e7ecff6959380366783
net: always initialize pagedlen

[ Upstream commit aba36930a35e7f1fe1319b203f25c05d6c119936 ]

In ip packet generation, pagedlen is initialized for each skb at the
start of the loop in __ip(6)_append_data, before label alloc_new_skb.

Depending on compiler options, code can be generated that jumps to
this label, triggering use of an an uninitialized variable.

In practice, at -O2, the generated code moves the initialization below
the label. But the code should not rely on that for correctness.

Fixes: 15e36f5b8e98 ("udp: paged allocation with gso")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/ip_output.c
net/ipv6/ip6_output.c