[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFqZXNtPjzh2OPaLkMfV_b=-=uU7Z0887-sWUjSG2YJ8e1ucfg@mail.gmail.com>
Date: Fri, 12 Jun 2020 09:51:00 +0200
From: Ondrej Mosnacek <omosnace@...hat.com>
To: Tom Rix <trix@...hat.com>
Cc: Paul Moore <paul@...l-moore.com>,
Stephen Smalley <stephen.smalley.work@...il.com>,
Eric Paris <eparis@...isplace.org>,
Wei Yongjun <weiyongjun1@...wei.com>,
SElinux list <selinux@...r.kernel.org>,
Linux kernel mailing list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/1] selinux: fix another double free
On Thu, Jun 11, 2020 at 10:48 PM <trix@...hat.com> wrote:
[...]
> diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
> index da94a1b4bfda..d0d6668709f0 100644
> --- a/security/selinux/ss/conditional.c
> +++ b/security/selinux/ss/conditional.c
> @@ -392,26 +392,21 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp)
>
> rc = next_entry(buf, fp, sizeof(u32) * 2);
> if (rc)
> - goto err;
> + return rc;
>
> expr->expr_type = le32_to_cpu(buf[0]);
> expr->bool = le32_to_cpu(buf[1]);
>
> if (!expr_node_isvalid(p, expr)) {
> rc = -EINVAL;
> - goto err;
> + return rc;
> }
Sorry for more nitpicking... This can be further simplified to just
"return -EINVAL;" and the braces can be removed.
> }
>
> rc = cond_read_av_list(p, fp, &node->true_list, NULL);
> if (rc)
> - goto err;
> + return rc;
> rc = cond_read_av_list(p, fp, &node->false_list, &node->true_list);
> - if (rc)
> - goto err;
> - return 0;
> -err:
> - cond_node_destroy(node);
> return rc;
Also here you can skip the rc assignment:
return cond_read_av_list(p, fp, &node->false_list, &node->true_list);
> }
>
> --
> 2.18.1
--
Ondrej Mosnacek
Software Engineer, Platform Security - SELinux kernel
Red Hat, Inc.
Powered by blists - more mailing lists