All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: "M. Koehrer" <mathias_koehrer@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Xenomai Bug: rt_intr_create with NULL-name leads to Kernel oops in /proc/xenomai/irq
Date: Wed, 10 Jan 2007 13:35:52 +0100	[thread overview]
Message-ID: <45A4DDA8.6090800@domain.hid> (raw)
In-Reply-To: <15523442.1168430357436.JavaMail.ngmail@domain.hid>


[-- Attachment #1.1: Type: text/plain, Size: 1072 bytes --]

M. Koehrer wrote:
> Hi all,
> 
> I am just trying out the interrupt mechanism of Xenomai.
> For that, I have create a kernel module that uses rt_intr_create (from the native skin) to
> create an IRQ handler. So far that looks fine.
> However, I noticed, that I have to pass a non-NULL argument  name to rt_intr_create().
> Otherwise, cat /proc/xenomai/irq crashes with a kernel oops.
> I think this is a bug as the API documentation allows the usage of a NULL name in rt_intr_create.
> Probably, the zero pointer will not be checked in the proc reading function.
> I am using 2.6.19.1 on a Pentium 4 (UP) with Xenomai 2.3.
> 
> I have enclosed a minimum kernel module that leads to a kernel oops to see the effect.
> 

Untested, but this patch should fix the issue - also for RTDM drivers
passing a NULL name to rtdm_irq_request (which was not forbidden so far
too). Nevertheless, passing a name is recommended to ease the system
diagnosis. Maybe the native doc should be changed in this regard too (I
already did so for RTDM in 2.3 and trunk).

Jan

[-- Attachment #1.2: xnintr-handle-NULL-name.patch --]
[-- Type: text/plain, Size: 1293 bytes --]

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2056)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2007-01-10  Jan Kiszka  <jan.kiszka@domain.hid>
+
+	* ksrc/nucleus/intr.c (xnintr_init): Always set xnintr::name to
+	non-NULL content.
+
 2007-01-04  Philippe Gerum  <rpm@xenomai.org>
 
 	* include/nucleus/timebase.h (xntbase_convert): Add time base
Index: ksrc/nucleus/intr.c
===================================================================
--- ksrc/nucleus/intr.c	(revision 2056)
+++ ksrc/nucleus/intr.c	(working copy)
@@ -490,7 +490,7 @@ int xnintr_mount(void) { return 0; }
  * therefore it must be allocated in permanent memory.
  *
  * @param name An ASCII string standing for the symbolic name of the
- * interrupt object.
+ * interrupt object or NULL ("<unknown>" will be applied then).
  *
  * @param irq The hardware interrupt channel associated with the
  * interrupt object. This value is architecture-dependent. An
@@ -541,7 +541,7 @@ int xnintr_init(xnintr_t *intr,
 	intr->isr = isr;
 	intr->iack = iack;
 	intr->cookie = NULL;
-	intr->name = name;
+	intr->name = name ? : "<unknown>";
 	intr->flags = flags;
 	intr->unhandled = 0;
 	memset(&intr->stat, 0, sizeof(intr->stat));

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2007-01-10 12:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-10 11:59 [Xenomai-help] Xenomai Bug: rt_intr_create with NULL-name leads to Kernel oops in /proc/xenomai/irq M. Koehrer
2007-01-10 12:35 ` Jan Kiszka [this message]
2007-01-10 13:49   ` Dmitry Adamushko
2007-01-10 14:00     ` Jan Kiszka
2007-01-10 14:19       ` Re: [Xenomai-help] Xenomai Bug: rt_intr_create with NULL-name leads M. Koehrer
2007-01-10 14:35         ` Dmitry Adamushko
2007-01-10 14:21       ` [Xenomai-help] Xenomai Bug: rt_intr_create with NULL-name leads to Kernel oops in /proc/xenomai/irq Dmitry Adamushko
2007-01-10 14:29         ` Dmitry Adamushko
2007-01-10 14:35         ` Jan Kiszka
2007-01-10 14:55           ` Dmitry Adamushko
2007-01-10 15:13             ` Jan Kiszka
2007-01-10 15:58               ` Dmitry Adamushko
2007-01-10 15:59                 ` Dmitry Adamushko
2007-01-10 16:32                   ` M. Koehrer
2007-01-11 19:19                   ` Philippe Gerum
2007-01-11 20:49                     ` Jan Kiszka
2007-01-11 21:01                       ` Philippe Gerum

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=45A4DDA8.6090800@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=mathias_koehrer@domain.hid \
    --cc=xenomai@xenomai.org \
    /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.