Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f844c74fe07321953e2dd227fe35280075f18f60
Commit:     f844c74fe07321953e2dd227fe35280075f18f60
Parent:     cb77df3ec88f07c6141924dfe6fd96a2f541cc09
Author:     Herbert Xu <[EMAIL PROTECTED]>
AuthorDate: Sat Jan 5 23:14:44 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Tue Jan 8 23:29:57 2008 -0800

    [IPV4] raw: Strengthen check on validity of iph->ihl
    
    We currently check that iph->ihl is bounded by the real length and that
    the real length is greater than the minimum IP header length.  However,
    we did not check the caes where iph->ihl is less than the minimum IP
    header length.
    
    This breaks because some ip_fast_csum implementations assume that which
    is quite reasonable.
    
    Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/raw.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 66b42f5..e7050f8 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,
        int hh_len;
        struct iphdr *iph;
        struct sk_buff *skb;
+       unsigned int iphlen;
        int err;
 
        if (length > rt->u.dst.dev->mtu) {
@@ -304,7 +305,8 @@ static int raw_send_hdrinc(struct sock *sk, void *from, 
size_t length,
                goto error_fault;
 
        /* We don't modify invalid header */
-       if (length >= sizeof(*iph) && iph->ihl * 4U <= length) {
+       iphlen = iph->ihl * 4;
+       if (iphlen >= sizeof(*iph) && iphlen <= length) {
                if (!iph->saddr)
                        iph->saddr = rt->rt_src;
                iph->check   = 0;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to