linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Len Brown <lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Henrique de Moraes Holschuh
	<hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org>
Cc: ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] ACPI: thinkpad-acpi: fix oops when a module parameter has no value
Date: Mon, 19 Nov 2007 16:10:19 -0500	[thread overview]
Message-ID: <200711191610.19493.lenb@kernel.org> (raw)
In-Reply-To: <20071118111829.GA19189-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>

applied

thanks,
-len

On Sunday 18 November 2007 06:18, Henrique de Moraes Holschuh wrote:
> set_ibm_param() could OOPS with a NULL pointer derreference if one did not give
> any values for a module parameter it handles.  This would, of course, cause all
> sort of trouble for future modprobing and require a reboot to clean up
> properly.
> 
> Fix it by returning -EINVAL if no values are given for the parameter, and also
> avoid any nastyness from BUG_ON while at it.
> 
> How to reproduce: modprobe thinkpad-acpi brightness
> 
> Error report by Mike Kershaw.
> 
> Signed-off-by: Henrique de Moraes Holschuh <hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org>
> Tested-by: Mike Kershaw <dragorn-8I8a9W+rkIX1ZkIrOfZKgqxOck334EZe@public.gmane.org>
> ---
>  drivers/misc/thinkpad_acpi.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> Len,
> 
> This one is also needed for 2.6.24-rc.  As soon as it hits mainline, I will
> also send it to -stable (for 2.6.22.y and 2.6.23.y).  It fixes a really,
> really annoying OOPS.
> 
> Please send it to Linus along with the other patches for 2.6.24-rc.
> 
> diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
> index 8c94307..ab23a32 100644
> --- a/drivers/misc/thinkpad_acpi.c
> +++ b/drivers/misc/thinkpad_acpi.c
> @@ -4817,9 +4817,15 @@ static int __init set_ibm_param(const char *val, struct kernel_param *kp)
>  	unsigned int i;
>  	struct ibm_struct *ibm;
>  
> +	if (!kp || !kp->name || !val)
> +		return -EINVAL;
> +
>  	for (i = 0; i < ARRAY_SIZE(ibms_init); i++) {
>  		ibm = ibms_init[i].data;
> -		BUG_ON(ibm == NULL);
> +		WARN_ON(ibm == NULL);
> +
> +		if (!ibm || !ibm->name)
> +			continue;
>  
>  		if (strcmp(ibm->name, kp->name) == 0 && ibm->write) {
>  			if (strlen(val) > sizeof(ibms_init[i].param) - 2)
> -- 
> 1.5.3.4
> 
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

      parent reply	other threads:[~2007-11-19 21:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30 19:46 [GIT PATCH] thinkpad-acpi patches for 2.6.24-rc Henrique de Moraes Holschuh
2007-10-30 19:46 ` [PATCH 1/7] ACPI: thinkpad-acpi: revert keymap changes Henrique de Moraes Holschuh
2007-10-30 19:46 ` [PATCH 2/7] ACPI: thinkpad-acpi: support 16 levels of brightness (v3) Henrique de Moraes Holschuh
2007-10-30 19:46 ` [PATCH 3/7] ACPI: thinkpad-acpi: add brightness_force parameter Henrique de Moraes Holschuh
2007-10-30 19:55   ` Henrique de Moraes Holschuh
2007-10-30 20:02     ` [PATCH 3/7 v2] " Henrique de Moraes Holschuh
2007-10-30 19:46 ` [PATCH 4/7] ACPI: thinkpad-acpi: prefer standard ACPI backlight level control Henrique de Moraes Holschuh
2007-10-30 19:46 ` [PATCH 5/7] ACPI: thinkpad-acpi: bump up version to 0.17 Henrique de Moraes Holschuh
2007-10-30 19:46 ` [PATCH 6/7] ACPI: thinkpad-acpi: allow for syscall restart in sysfs handlers Henrique de Moraes Holschuh
2007-10-30 19:46 ` [PATCH 7/7] ACPI: thinkpad-acpi: fix brightness_set error paths Henrique de Moraes Holschuh
     [not found] ` <1193773585-17202-1-git-send-email-hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org>
2007-11-05 19:32   ` [GIT PATCH] thinkpad-acpi patches for 2.6.24-rc Len Brown
     [not found]     ` <200711051432.27840.lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2007-11-18 11:18       ` [PATCH] ACPI: thinkpad-acpi: fix oops when a module parameter has no value Henrique de Moraes Holschuh
     [not found]         ` <20071118111829.GA19189-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
2007-11-19 21:10           ` Len Brown [this message]

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=200711191610.19493.lenb@kernel.org \
    --to=lenb-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org \
    --cc=ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).