From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: potential NULL dereference in sysfs_merge_group()
Date: Sun, 24 Oct 2010 21:55:04 +0000 [thread overview]
Message-ID: <20101024215504.GV5985@bicker> (raw)
Hi Alan,
There is a bug in sysfs_merge_group() where it doesn't handle a NULL
grp parameter properly. The only caller in the kernel passes in a valid
grp pointer so it doesn't affect anything yet.
fs/sysfs/group.c +175 sysfs_merge_group(15)
error: we previously assumed 'grp' could be null.
168 if (grp)
^^^
assumes that grp can be NULL.
169 dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name);
170 else
171 dir_sd = sysfs_get(kobj->sd);
172 if (!dir_sd)
173 return -ENOENT;
174
175 for ((i = 0, attr = grp->attrs); *attr && !error; (++i, ++attr))
^^^^^
grp is dereferenced here.
176 error = sysfs_add_file(dir_sd, *attr, SYSFS_KOBJ_ATTR);
I'm not sure how you want to handle this.
regards,
dan carpenter
next reply other threads:[~2010-10-24 21:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-24 21:55 Dan Carpenter [this message]
2010-10-25 1:43 ` potential NULL dereference in sysfs_merge_group() Alan Stern
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=20101024215504.GV5985@bicker \
--to=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.