stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: cgxu519 <cgxu519@gmx.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 2/2] chardev: showing minor range for chardev in the output of /proc/devices
Date: Tue, 12 Feb 2019 23:41:35 +0800	[thread overview]
Message-ID: <f6f02cb9-79ad-aeb0-a911-89dfb1f90aae@gmx.com> (raw)
In-Reply-To: <20190212152053.GA25804@kroah.com>

On 2/12/19 11:20 PM, Greg KH wrote:
> On Tue, Feb 12, 2019 at 11:18:22PM +0800, cgxu519 wrote:
>> On 2/12/19 5:02 PM, Greg KH wrote:
>>> On Tue, Feb 12, 2019 at 04:47:39PM +0800, Chengguang Xu wrote:
>>>> Currently chardev allows to share major, showing
>>>> major with minor range for chardev will be more
>>>> helpful.
>>>>
>>>> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
>>>> ---
>>>>    fs/char_dev.c | 4 +++-
>>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/fs/char_dev.c b/fs/char_dev.c
>>>> index b25b1da097d5..6f00acdeb308 100644
>>>> --- a/fs/char_dev.c
>>>> +++ b/fs/char_dev.c
>>>> @@ -55,7 +55,9 @@ void chrdev_show(struct seq_file *f, off_t offset)
>>>>    	mutex_lock(&chrdevs_lock);
>>>>    	for (cd = chrdevs[major_to_index(offset)]; cd; cd = cd->next) {
>>>>    		if (cd->major == offset)
>>>> -			seq_printf(f, "%3d %s\n", cd->major, cd->name);
>>>> +			seq_printf(f, "%3d %s (%u-%u)\n", cd->major, cd->name,
>>>> +				   cd->baseminor,
>>>> +				   cd->baseminor + cd->minorct - 1);
>>> You are changing the format of a userspace file, what tools are going to
>>> break when you do this?
>> I'll remove this part in V2. Do you have any idea how to get the minor
>> range info for particular major? Or adding a similar file to somewhere
>> under /sys is acceptable?
> Why do you need to know the minor range?  What can userspace do with
> this that actually matters?

Assume that when we try to load a driver module and fail with -EBUSY
because of minor range overlapping, then what can we do for this case?
we even don't know what range has occupied and what range is available.

Also, I think we can obviously notice range overlapping bugs by showing
all registered minor ranges.

Thanks,
Chengguang.


  reply	other threads:[~2019-02-12 15:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12  8:47 [PATCH 1/2] chardev: fix an overlap misjudgement case in __register_chrdev_region() Chengguang Xu
2019-02-12  8:47 ` [PATCH 2/2] chardev: showing minor range for chardev in the output of /proc/devices Chengguang Xu
2019-02-12  9:02   ` Greg KH
2019-02-12 15:18     ` cgxu519
2019-02-12 15:20       ` Greg KH
2019-02-12 15:41         ` cgxu519 [this message]
2019-02-12 18:32           ` Greg KH
2019-02-12  9:01 ` [PATCH 1/2] chardev: fix an overlap misjudgement case in __register_chrdev_region() Greg KH

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=f6f02cb9-79ad-aeb0-a911-89dfb1f90aae@gmx.com \
    --to=cgxu519@gmx.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).