diff options
| author | Willem de Bruijn <willemb@google.com> | 2018-11-24 14:21:16 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2018-11-24 20:42:57 -0500 |
| commit | aba36930a35e7f1fe1319b203f25c05d6c119936 (patch) | |
| tree | dc960b49f6616419375e9fec056022c0e8e14338 /net/ipv4/ip_output.c | |
| parent | 9efdda4e3abed13f0903b7b6e4d4c2102019440a (diff) | |
net: always initialize pagedlen
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>
Diffstat (limited to 'net/ipv4/ip_output.c')
| -rw-r--r-- | net/ipv4/ip_output.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index c09219e7f230..5dbec21856f4 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
| @@ -939,7 +939,7 @@ static int __ip_append_data(struct sock *sk, | |||
| 939 | unsigned int fraglen; | 939 | unsigned int fraglen; |
| 940 | unsigned int fraggap; | 940 | unsigned int fraggap; |
| 941 | unsigned int alloclen; | 941 | unsigned int alloclen; |
| 942 | unsigned int pagedlen = 0; | 942 | unsigned int pagedlen; |
| 943 | struct sk_buff *skb_prev; | 943 | struct sk_buff *skb_prev; |
| 944 | alloc_new_skb: | 944 | alloc_new_skb: |
| 945 | skb_prev = skb; | 945 | skb_prev = skb; |
| @@ -956,6 +956,7 @@ alloc_new_skb: | |||
| 956 | if (datalen > mtu - fragheaderlen) | 956 | if (datalen > mtu - fragheaderlen) |
| 957 | datalen = maxfraglen - fragheaderlen; | 957 | datalen = maxfraglen - fragheaderlen; |
| 958 | fraglen = datalen + fragheaderlen; | 958 | fraglen = datalen + fragheaderlen; |
| 959 | pagedlen = 0; | ||
| 959 | 960 | ||
| 960 | if ((flags & MSG_MORE) && | 961 | if ((flags & MSG_MORE) && |
| 961 | !(rt->dst.dev->features&NETIF_F_SG)) | 962 | !(rt->dst.dev->features&NETIF_F_SG)) |
