linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: S3C2410: Remove section mismatch warning
Date: Mon, 3 Oct 2011 10:59:33 +0100	[thread overview]
Message-ID: <20111003095933.GC11710@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1317634841-23339-1-git-send-email-tushar.behera@linaro.org>

On Mon, Oct 03, 2011 at 03:10:41PM +0530, Tushar Behera wrote:
> Some of the functions and structures did not have _init or __initdata
> attributes, even though they were referenced from functions / structures
> with those attribute, resulting in section mismatches.

Firstly - it's a good idea to include the warnings which you're fixing
in the commit log text, so that people know exactly what is being fixed.

> diff --git a/arch/arm/mach-s3c2410/usb-simtec.c b/arch/arm/mach-s3c2410/usb-simtec.c
> index 29bd3d9..3a1028c 100644
> --- a/arch/arm/mach-s3c2410/usb-simtec.c
> +++ b/arch/arm/mach-s3c2410/usb-simtec.c
> @@ -104,7 +104,7 @@ static struct s3c2410_hcd_info usb_simtec_info __initdata = {
>  };
>  
>  
> -int usb_simtec_init(void)
> +int __init usb_simtec_init(void)
>  {
>  	int ret;
>  

This one looks fine.

> diff --git a/arch/arm/mach-s3c2416/irq.c b/arch/arm/mach-s3c2416/irq.c
> index 28ad20d..153cb2f 100644
> --- a/arch/arm/mach-s3c2416/irq.c
> +++ b/arch/arm/mach-s3c2416/irq.c
> @@ -234,7 +234,7 @@ static int __init s3c2416_irq_add(struct sys_device *sysdev)
>  	return 0;
>  }
>  
> -static struct sysdev_driver s3c2416_irq_driver = {
> +static struct sysdev_driver s3c2416_irq_driver __initdata = {
>  	.add		= s3c2416_irq_add,
>  };
>  

I remain entirely unconvinced that this is correct.  As a result of
the "sysdev_driver_register(&s3c2416_sysclass, &s3c2416_irq_driver);"
call, this structure is placed on a list.

If this structure is marked __initdata, then the memory behind the
structure will be freed and overwritten - however, it's still on a
list which might be walked.  Such a walk would cause a kernel oops
or might even be an exploitable security hole if that page ends up
in userspace - especially as said structure contains function calls
which would be called in privileged mode.

The same comment applies to the other sysdev driver structures you're
marking __initdata too.

  reply	other threads:[~2011-10-03  9:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03  9:40 [PATCH] ARM: S3C2410: Remove section mismatch warning Tushar Behera
2011-10-03  9:59 ` Russell King - ARM Linux [this message]
2011-10-03 11:34   ` Tushar Behera

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=20111003095933.GC11710@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).