From: James Antill <jantill@redhat.com>
To: "Christopher J. PeBenito" <cpebenito@tresys.com>
Cc: sds@tycho.nsa.gov, jmorris@redhat.com, eparis@redhat.com,
selinux@tycho.nsa.gov
Subject: Re: [PATCH 1/4] selinux: add support for querying object classes and permissions from the running policy
Date: Wed, 23 May 2007 11:42:07 -0400 [thread overview]
Message-ID: <1179934928.23650.65.camel@code.and.org> (raw)
In-Reply-To: <11799259343624-git-send-email-cpebenito@tresys.com>
[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]
On Wed, 2007-05-23 at 09:12 -0400, Christopher J. PeBenito wrote:
>
> +static int get_permissions_callback(void *k, void *d, void *args)
> +{
> + struct perm_datum *datum = d;
> + char *name = k, **perms = args;
> + int value = datum->value - 1;
> +
> + perms[value] = kstrdup(name, GFP_ATOMIC);
> + if (!perms[value])
> + return -ENOMEM;
> +
> + return 0;
> +}
> +
> +int security_get_permissions(char *class, char ***perms, int *nperms)
> +{
[...]
> + *nperms = match->permissions.nprim;
> + *perms = kcalloc(*nperms, sizeof(*perms), GFP_ATOMIC);
> + if (!*perms)
> + goto out;
> +
> + if (match->comdatum) {
> + rc = hashtab_map(match->comdatum->permissions.table,
> + get_permissions_callback, *perms);
> + if (rc < 0)
> + goto err;
> + }
> +
> + rc = hashtab_map(match->permissions.table, get_permissions_callback,
> + *perms);
So I'm probably just wasting your time out of ignorance here, but this
looks really suspicious to me. Why don't you need to add in
match->comdatum->permissions.nprim for the allocation? Also how is it
guaranteed that one "datum->value - 1" won't be the same in both
hashtabs? (if it isn't you've leaked memory).
--
James Antill <jantill@redhat.com>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-05-23 15:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-23 13:12 selinux: add object class discovery v2 Christopher J. PeBenito
2007-05-23 13:12 ` [PATCH 1/4] selinux: add support for querying object classes and permissions from the running policy Christopher J. PeBenito
2007-05-23 13:12 ` [PATCH 2/4] selinux: rename sel_remove_bools() for more general usage Christopher J. PeBenito
2007-05-23 13:12 ` [PATCH 3/4] selinux: change sel_make_dir() to specify inode counter Christopher J. PeBenito
2007-05-23 13:12 ` [PATCH 4/4] selinux: add selinuxfs structure for object class discovery Christopher J. PeBenito
2007-05-30 15:06 ` Stephen Smalley
2007-05-23 15:42 ` James Antill [this message]
2007-05-23 17:25 ` [PATCH 1/4] selinux: add support for querying object classes and permissions from the running policy Christopher J. PeBenito
2007-05-23 13:24 ` selinux: add object class discovery v2 James Morris
-- strict thread matches above, loose matches on Subject: below --
2007-05-21 15:38 [PATCH 0/4] selinux: add object class discovery Christopher J. PeBenito
2007-05-21 15:38 ` [PATCH 1/4] selinux: add support for querying object classes and permissions from the running policy Christopher J. PeBenito
2007-05-21 17:02 ` James Morris
2007-05-21 18:44 ` Christopher J. PeBenito
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1179934928.23650.65.camel@code.and.org \
--to=jantill@redhat.com \
--cc=cpebenito@tresys.com \
--cc=eparis@redhat.com \
--cc=jmorris@redhat.com \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.