aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/raw.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 66b42f547bf9..e7050f8eabeb 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -271,6 +271,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
271 int hh_len; 271 int hh_len;
272 struct iphdr *iph; 272 struct iphdr *iph;
273 struct sk_buff *skb; 273 struct sk_buff *skb;
274 unsigned int iphlen;
274 int err; 275 int err;
275 276
276 if (length > rt->u.dst.dev->mtu) { 277 if (length > rt->u.dst.dev->mtu) {
@@ -304,7 +305,8 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
304 goto error_fault; 305 goto error_fault;
305 306
306 /* We don't modify invalid header */ 307 /* We don't modify invalid header */
307 if (length >= sizeof(*iph) && iph->ihl * 4U <= length) { 308 iphlen = iph->ihl * 4;
309 if (iphlen >= sizeof(*iph) && iphlen <= length) {
308 if (!iph->saddr) 310 if (!iph->saddr)
309 iph->saddr = rt->rt_src; 311 iph->saddr = rt->rt_src;
310 iph->check = 0; 312 iph->check = 0;