From: Greg KH <gregkh@linuxfoundation.org>
To: Rohan <rohankollambalath@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sysfs:Addresses null pointer dereference in sysfs_merge_group and sysfs_unmerge_group.
Date: Sun, 11 Feb 2024 11:09:10 +0000 [thread overview]
Message-ID: <2024021154-roundworm-census-3e6e@gregkh> (raw)
In-Reply-To: <CA+a0dEjp2ExRTDZjN9z_Z12pNqHiiGkqsuTjh40TKN=W81+FWw@mail.gmail.com>
On Sat, Feb 10, 2024 at 08:43:14PM +1000, Rohan wrote:
> Hey,
Please don't top-post, or send html email, as they get dropped from the
mailing lists.
> I found this bug when writing my own kernel driver. I believed the function
> wasn't explicit in stating its the requirement for the name field and made
> it easy for developers to mistake it with sysfs_create_group and cause a
> crash. I wanted to change the code for robustness purposes. Other functions
> in the same file already do this check such as sysfs_group_change_owner.
Adding documentation is great, but don't add checks that are not needed,
we require callers to set up things properly, otherwise the kernel would
be nothing but a constant set of checks for things that can never
happen.
> As for why I chose -ENOENT, I did this because it was the same error code
> returned if the group cannot be found by kernfs_find_and_get but I
> understand if this should be changed.
Yes, that is a different type of error entirely. Just do the
documentation update, I'll gladly take that.
thanks,
greg k-h
prev parent reply other threads:[~2024-02-11 11:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 23:36 [PATCH] sysfs:Addresses null pointer dereference in sysfs_merge_group and sysfs_unmerge_group Rohan Kollambalath
2024-02-09 10:27 ` Greg KH
[not found] ` <CA+a0dEiZzZgsjhVRDMTyYgFWk9TwjAHeTjFphZQwvFctE9Zosg@mail.gmail.com>
[not found] ` <2024021007-casually-supernova-329f@gregkh>
[not found] ` <CA+a0dEjp2ExRTDZjN9z_Z12pNqHiiGkqsuTjh40TKN=W81+FWw@mail.gmail.com>
2024-02-11 11:09 ` Greg KH [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=2024021154-roundworm-census-3e6e@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rohankollambalath@gmail.com \
/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