lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 18 Apr 2009 22:27:04 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Yinghai Lu <yinghai@...nel.org>
Cc:	Greg KH <gregkh@...e.de>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	linux-pci@...r.kernel.org
Subject: Re: [PATCH] driver: dont update dev_name if it is not changed


* Yinghai Lu <yinghai@...nel.org> wrote:

> Ingo Molnar wrote:
> > * Yinghai Lu <yinghai@...nel.org> wrote:
> > 
> >> notice one system /proc/iomem some entries missed the name for pci_devices
> >>
> >> it turns that dev->dev.kobj name is changed after device_add.
> >>
> >> [Impact: fix corrupted names in /proc/iomem ]
> >>
> >> Signed-off-by: Yinghai Lu <yinghai@...nel.org>
> >>
> >> ---
> >>  lib/kobject.c |   13 +++++++++++--
> >>  1 file changed, 11 insertions(+), 2 deletions(-)
> >>
> >> Index: linux-2.6/lib/kobject.c
> >> ===================================================================
> >> --- linux-2.6.orig/lib/kobject.c
> >> +++ linux-2.6/lib/kobject.c
> >> @@ -216,12 +216,21 @@ int kobject_set_name_vargs(struct kobjec
> >>  				  va_list vargs)
> >>  {
> >>  	const char *old_name = kobj->name;
> >> +	char *new_name;
> >>  	char *s;
> >>  
> >> -	kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
> >> -	if (!kobj->name)
> >> +	new_name = kvasprintf(GFP_KERNEL, fmt, vargs);
> >> +	if (!new_name)
> >>  		return -ENOMEM;
> >>  
> >> +	/* different ? */
> >> +	if (!strcmp(new_name, old_name)) {
> >> +		kfree(new_name);
> >> +		return 0;
> >> +	}
> >> +
> >> +	kobj->name = new_name;
> >> +
> >>  	/* ewww... some of these buggers have '/' in the name ... */
> >>  	while ((s = strchr(kobj->name, '/')))
> >>  		s[0] = '!';
> > 
> > So we used the old name in the resource code, and the kfree() here 
> > corrupted the /proc/iomem output?
> > 
> if it is not changed, we still use old_name. and new_name get freed

I know - you are talking about your patch.

But i'm talking about the current, unpatched upstream code. It got a 
string displayed in /proc/iomem that got kfree()d? [and this is why 
the entries vanished?]

That is badness somewhere _else_ (not in the kobject core i think), 
and your patch does not solve the real badness, it works around its 
symptoms AFAICS - like the first patch.

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ