public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Zwane Mwaikambo <zwane@linuxpower.ca>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] protect 'action' in show_interrupts
Date: Fri, 7 Mar 2003 02:28:29 -0800	[thread overview]
Message-ID: <20030307022829.7868dda2.akpm@digeo.com> (raw)
In-Reply-To: <Pine.LNX.4.50.0303070502400.18716-100000@montezuma.mastecende.com>

Zwane Mwaikambo <zwane@linuxpower.ca> wrote:
>
> This patch protects a critical section in show_interrupts against 
> removal of 'action' during traversal of the handlers. All the 
> architectures in one swoop.

Thanks for doing this.

> ...
> --- linux-2.5.64/arch/i386/kernel/irq.c	5 Mar 2003 05:08:03 -0000	1.1.1.1
> +++ linux-2.5.64/arch/i386/kernel/irq.c	7 Mar 2003 09:04:43 -0000
>  static void register_irq_proc (unsigned int irq);
> @@ -135,6 +135,7 @@
>  {
>  	int i, j;
>  	struct irqaction * action;
> +	unsigned long flags;
>  
>  	seq_printf(p, "           ");
>  	for (j=0; j<NR_CPUS; j++)
> @@ -156,11 +157,17 @@
>  					     kstat_cpu(j).irqs[i]);
>  #endif
>  		seq_printf(p, " %14s", irq_desc[i].handler->typename);
> +		spin_lock_irqsave(&irq_desc[i].lock, flags);
> +		if (!action)
> +			goto unlock;
> +		seq_printf(p, "  %s", action->name);
 
Local variable `action' could be pointing at freed memory by now.  We need to
reload it inside the lock.  Or just hold the lock across the entire loop.


  reply	other threads:[~2003-03-07 10:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-07  5:13 Oops: 2.5.64 check_obj_poison for 'size-64' Zwane Mwaikambo
2003-03-07  6:23 ` Andrew Morton
2003-03-07  7:22   ` Zwane Mwaikambo
2003-03-07  7:35     ` Andrew Morton
2003-03-07  7:40       ` Zwane Mwaikambo
2003-03-07  7:45       ` Miles Bader
2003-03-07  7:58         ` Andrew Morton
2003-03-07  8:10           ` Miles Bader
     [not found]       ` <Pine.LNX.4.50.0303070351060.18716-100000@montezuma.mastecende.com>
     [not found]         ` <20030307010539.3c0a14a3.akpm@digeo.com>
2003-03-07  9:53           ` Zwane Mwaikambo
2003-03-07 19:38           ` Manfred Spraul
2003-03-07 21:57             ` Zwane Mwaikambo
2003-03-08  2:11               ` Zwane Mwaikambo
2003-03-08  2:24                 ` Andrew Morton
2003-03-08  2:42                   ` Zwane Mwaikambo
2003-03-07 10:05       ` [PATCH] protect 'action' in show_interrupts Zwane Mwaikambo
2003-03-07 10:28         ` Andrew Morton [this message]
2003-03-07 15:32           ` Zwane Mwaikambo
2003-03-07 15:46             ` Russell King
2003-03-07 16:25               ` Zwane Mwaikambo
2003-03-07 22:01                 ` Andrew Morton

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=20030307022829.7868dda2.akpm@digeo.com \
    --to=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zwane@linuxpower.ca \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox