netfilter: xt_qtaguid: fix error exit that would keep a spinlock.
authorJP Abgrall <jpa@google.com>
Wed, 10 Oct 2012 03:38:21 +0000 (20:38 -0700)
committerGerrit Code Review <noreply-gerritcodereview@google.com>
Wed, 30 Jan 2013 03:22:36 +0000 (03:22 +0000)
qtudev_open() could return with a uid_tag_data_tree_lock held
when an kzalloc(..., GFP_ATOMIC) would fail.
Very unlikely to get triggered AND survive the mayhem of running out of mem.

Signed-off-by: JP Abgrall <jpa@google.com>
net/netfilter/xt_qtaguid.c

index ea716b31e2af0a648af578a358f1d0abd607fcc0..7efbab9b4bed92bd6ea2dbff017c7038b5b9d8e9 100644 (file)
@@ -2752,7 +2752,7 @@ static int qtudev_open(struct inode *inode, struct file *file)
        utd_entry = get_uid_data(current_fsuid(), &utd_entry_found);
        if (IS_ERR_OR_NULL(utd_entry)) {
                res = PTR_ERR(utd_entry);
-               goto err;
+               goto err_unlock;
        }
 
        /* Look for existing PID based proc_data */
@@ -2794,8 +2794,8 @@ err_unlock_free_utd:
                rb_erase(&utd_entry->node, &uid_tag_data_tree);
                kfree(utd_entry);
        }
+err_unlock:
        spin_unlock_bh(&uid_tag_data_tree_lock);
-err:
        return res;
 }