From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: Xenomai core <Xenomai-core@domain.hid>
Subject: Re: [Xenomai-core] [PATCH 2/2] native: Fix error cleanup of rt_task_create
Date: Thu, 30 Jun 2011 13:09:45 +0200 [thread overview]
Message-ID: <4E0C5979.7020202@domain.hid> (raw)
In-Reply-To: <4E0C439D.2030602@domain.hid>
On 06/30/2011 11:36 AM, Jan Kiszka wrote:
> When creating of a shadow task fails, rt_task_create has to free the
> task object consistently, not only on registry errors. Then we need to
> delete the core thread when fastlock allocation failed. Moreover, fix a
> double free of the fastlock object which is now released via the delete
> hook. Finally, avoid a use-after-release of the fastlock object in
> __task_delete_hook.
>
> This fixes heap corruptions when running out of resources.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
> ---
> (...)
> +
> + fail:
> + if (xnthread_test_state(&task->thread_base, XNSHADOW))
> + xnfree(task);
> +
> + return err;
> }
>
> /**
Is this needed? I mean, shadows are created in syscall.c, function
__rt_task_create, and when rt_task_create returns an error, that
function calls rt_task_delete. So, there should be no leak. And worse,
here rt_task_delete will use an invalid pointer if we apply that patch.
--
Gilles.
next prev parent reply other threads:[~2011-06-30 11:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-30 9:36 [Xenomai-core] [PATCH 2/2] native: Fix error cleanup of rt_task_create Jan Kiszka
2011-06-30 11:09 ` Gilles Chanteperdrix [this message]
2011-06-30 11:32 ` Jan Kiszka
2011-07-04 19:29 ` Gilles Chanteperdrix
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=4E0C5979.7020202@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=Xenomai-core@domain.hid \
--cc=jan.kiszka@domain.hid \
/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.