Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3af8e31cf57646284b5f77f9d57d2c22fa77485a
Commit:     3af8e31cf57646284b5f77f9d57d2c22fa77485a
Parent:     864c5a4d37b1f25e3c36dd00a09158eae455a8fd
Author:     Jesper Juhl <[EMAIL PROTECTED]>
AuthorDate: Tue Aug 7 18:10:54 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Tue Aug 7 18:10:54 2007 -0700

    [NETFILTER]: ipt_recent: avoid a possible NULL pointer deref in 
recent_seq_open()
    
    If the call to seq_open() returns != 0 then the code calls
    kfree(st) but then on the very next line proceeds to
    dereference the pointer - not good.
    
    Problem spotted by the Coverity checker.
    
    Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]>
    Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/netfilter/ipt_recent.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
index 3218043..6d0c0f7 100644
--- a/net/ipv4/netfilter/ipt_recent.c
+++ b/net/ipv4/netfilter/ipt_recent.c
@@ -387,12 +387,17 @@ static int recent_seq_open(struct inode *inode, struct 
file *file)
        st = kzalloc(sizeof(*st), GFP_KERNEL);
        if (st == NULL)
                return -ENOMEM;
+
        ret = seq_open(file, &recent_seq_ops);
-       if (ret)
+       if (ret) {
                kfree(st);
+               goto out;
+       }
+
        st->table    = pde->data;
        seq          = file->private_data;
        seq->private = st;
+out:
        return ret;
 }
 
-
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