All of lore.kernel.org
 help / color / mirror / Atom feed
From: Darrel Goeddel <dgoeddel@TrustedCS.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: "'SELinux List'" <SELinux@tycho.nsa.gov>,
	Eric Paris <eparis@redhat.com>,
	Joshua Brindle <jbrindle@tresys.com>
Subject: Re: [PATCH 2/2] userland support for new range_transition	statements
Date: Mon, 31 Jul 2006 13:25:56 -0500	[thread overview]
Message-ID: <44CE4B34.8060101@trustedcs.com> (raw)
In-Reply-To: <1154364031.1447.127.camel@moss-spartans.epoch.ncsc.mil>

Stephen Smalley wrote:

>>+static int range_trans_rule_read(range_trans_rule_t **r, struct policy_file *fp)
>>+{
>>+	uint32_t *buf, nel, nclass;
>>+	unsigned int i, j;
>>+	range_trans_rule_t *rt, *lrt = NULL;
>>+	class_perm_node_t *cp, *lcp = NULL;
>>+
>>+	buf = next_entry(fp, sizeof(uint32_t));
>>+	if (!buf)
>>+		return -1;
>>+	nel = le32_to_cpu(buf[0]);
>>+	for (i = 0; i < nel; i++) {
>>+		rt = malloc(sizeof(range_trans_rule_t));
>>+		if (!rt) {
>>+			return -1;
>>+		}
>>+		range_trans_rule_init(rt);
>>+
>>+		if (type_set_read(&rt->stypes, fp))
>>+			return -1;
> 
> 
> Leaks rt.  I'd suggest linking rt into the list earlier as we do
> elsewhere, so that it can be freed upon policydb_destroy.

<snip - more error path fixups >

>>+						return -1;
>>+					}
>>+					memset(rt, 0, sizeof(range_trans_t));
>>+					rt->source_type = i + 1;
>>+					rt->target_type = j + 1;
>>+					rt->target_class = cp->class;
>>+					if (mls_range_cpy(&rt->target_range, &rule->trange)) {
>>+						ERR(state->handle, "Out of memory!");
> 
> 
> Leaks stypes, ttypes, and rt.

Thanks for catching those - I knew there was something else I needed to do ;)
I'll have to look at the code I modeled those functions after to see if they
have the same issues...  I'll post a new version of this patch (I'll wait a
bit to see if there is other feedback) later.

-- 

Darrel

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2006-07-31 18:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-28 15:13 [PATCH 2/2] userland support for new range_transition statements Darrel Goeddel
2006-07-31 16:40 ` Stephen Smalley
2006-07-31 18:25   ` Darrel Goeddel [this message]
2006-07-31 18:29 ` Karl MacMillan
2006-07-31 18:54   ` Darrel Goeddel
2006-07-31 20:52     ` Stephen Smalley
2006-08-01 13:14 ` Joshua Brindle
2006-08-02 16:38   ` Darrel Goeddel
2006-08-02 19:51     ` Karl MacMillan
2006-08-02 21:59       ` Darrel Goeddel
2006-08-03 12:01         ` Joshua Brindle
2006-08-03 15:55     ` Joshua Brindle
2006-08-04 16:13       ` Darrel Goeddel
2006-08-07 13:18         ` Joshua Brindle
2006-08-08 14:48           ` Darrel Goeddel
2006-08-08 22:45             ` Joshua Brindle
2006-08-09 15:00               ` Darrel Goeddel
2006-08-04 17:10 ` [PATCH 2/2 take 2] " Darrel Goeddel
2006-08-08 22:25   ` Joshua Brindle
2006-08-09 13:09     ` Karl MacMillan
2006-08-09 13:31       ` Joshua Brindle
2006-08-09 15:06         ` Darrel Goeddel
2006-08-09 15:13           ` Karl MacMillan
2006-08-09 15:39             ` [PATCH 2/2 take 2] userland support for new range_transitionstatements Joshua Brindle
2006-08-09 14:29     ` [PATCH 2/2 take 2] userland support for new range_transition statements Darrel Goeddel

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=44CE4B34.8060101@trustedcs.com \
    --to=dgoeddel@trustedcs.com \
    --cc=SELinux@tycho.nsa.gov \
    --cc=eparis@redhat.com \
    --cc=jbrindle@tresys.com \
    --cc=sds@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.