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-next>] [day] [month] [year] [list]
Date:	Sat, 21 Apr 2012 18:17:49 +0800
From:	yan <clouds.yan@...il.com>
To:	greg <gregkh@...uxfoundation.org>
Cc:	kernel <linux-kernel@...r.kernel.org>,
	message <message.get@...il.com>
Subject: [PATCH 4/4][Trivial] lib/kobject.c : check parameter in
 kobject_init_and_add

If user turns to the simple interface kobject_init_and_add 
and gives a null kobject, kobject_init can detect it but 
just dumps the stack. Then there is:
  -->kobject_add_varg
   -->kobject_set_name_vargs
In the end, it will reference kobj->name and we have an oops.

Check whether we have a valid kobject in kobject_init_and_add.

Signed-off-by: Yan Hong <clouds.yan@...il.com>
---
 lib/kobject.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/kobject.c b/lib/kobject.c
index dd67855..bc05922 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -380,6 +380,9 @@ int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype,
 	va_list args;
 	int retval;
 
+	if (!kobj)
+		return -EINVAL;
+
 	kobject_init(kobj, ktype);
 
 	va_start(args, fmt);
-- 
1.7.5.1



--
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