linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: bfields@fieldses.org, neilb@suse.de, ibm-acpi@hmh.eng.br,
	len.brown@intel.com, kkeil@suse.de, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [patch 3/3] ThinkPad ACPI: fix possible NULL pointer dereference
Date: Fri, 18 Apr 2008 17:53:19 +0400	[thread overview]
Message-ID: <20080418135319.GC7674@cvg> (raw)
In-Reply-To: <20080418124111.GB4966@ucw.cz>

[Pavel Machek - Fri, Apr 18, 2008 at 02:41:12PM +0200]
| Hi!
| 
| > Fix potential NULL pointer dereference if kstrdup failed
| > 
| > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| > 
| > ---
| > 
| > Index: linux-2.6.git/drivers/misc/thinkpad_acpi.c
| > ===================================================================
| > --- linux-2.6.git.orig/drivers/misc/thinkpad_acpi.c	2008-04-16 20:35:34.000000000 +0400
| > +++ linux-2.6.git/drivers/misc/thinkpad_acpi.c	2008-04-16 20:36:38.000000000 +0400
| > @@ -5826,7 +5826,7 @@ static void __init get_thinkpad_model_da
| >  
| >  	tp->model_str = kstrdup(dmi_get_system_info(DMI_PRODUCT_VERSION),
| >  					GFP_KERNEL);
| > -	if (strnicmp(tp->model_str, "ThinkPad", 8) != 0) {
| > +	if (tp->model_str && strnicmp(tp->model_str, "ThinkPad", 8) != 0) {
| >  		kfree(tp->model_str);
| >  		tp->model_str = NULL;
| >  	}
| 
| are you sure? This seems to assume machine is thinkpad if kstrdup
| fails... which is very wrong.
| 

Actually, my patch didn't bring any new into the current driver state,
just add additional check to prevent NULL deref, that's all, so I think
it's fine (but maybe additional printk with info would had been usefull).

		- Cyrill -

      parent reply	other threads:[~2008-04-18 13:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080416174421.442716301@gmail.com>
2008-04-16 17:44 ` [patch 1/3] NFS: fix potential NULL pointer dereference Cyrill Gorcunov
2008-04-16 18:11   ` Trond Myklebust
2008-04-16 18:13     ` Cyrill Gorcunov
2008-04-16 18:55       ` Trond Myklebust
2008-04-16 20:19         ` Cyrill Gorcunov
2008-04-16 20:40           ` Trond Myklebust
2008-04-17  4:25             ` Cyrill Gorcunov
2008-04-17  7:25               ` Cyrill Gorcunov
2008-04-16 20:24         ` Cyrill Gorcunov
2008-04-16 17:44 ` [patch 2/3] CAPIFS: fix memory leak on remount Cyrill Gorcunov
2008-04-16 17:44 ` [patch 3/3] ThinkPad ACPI: fix possible NULL pointer dereference Cyrill Gorcunov
2008-04-16 20:52   ` Henrique de Moraes Holschuh
2008-04-18 12:41   ` Pavel Machek
2008-04-18 12:55     ` Cyrill Gorcunov
2008-04-18 13:07     ` Cyrill Gorcunov
2008-04-19  4:10       ` Henrique de Moraes Holschuh
2008-04-18 13:53     ` Cyrill Gorcunov [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=20080418135319.GC7674@cvg \
    --to=gorcunov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bfields@fieldses.org \
    --cc=ibm-acpi@hmh.eng.br \
    --cc=kkeil@suse.de \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=pavel@ucw.cz \
    /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).