All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>
To: Zijun Hu <quic_zijuhu@quicinc.com>, <gregkh@linuxfoundation.org>,
	<jirislaby@kernel.org>, <quic_qiancai@quicinc.com>,
	<quic_arandive@quicinc.com>, <quic_saipraka@quicinc.com>,
	<quic_eberman@quicinc.com>
Cc: <linux-serial@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] tty: Add comments for tty-ldisc module loading logic
Date: Fri, 15 Dec 2023 19:49:34 +0530	[thread overview]
Message-ID: <de1181fe-a948-a1e2-04c8-dcd88085f1df@quicinc.com> (raw)
In-Reply-To: <1702647690-6787-1-git-send-email-quic_zijuhu@quicinc.com>

Hi,


On 12/15/2023 7:11 PM, Zijun Hu wrote:
> Current tty-ldisc module loading logic within tty_ldisc_get()
> is prone to mislead beginner that the module is able to be loaded
> by a user without capability CAP_SYS_MODULE, add comments to make
> the logic easy to undertand.
>
> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> ---
> Changes in v2:
> - Remove condition checking changes
>
>   drivers/tty/tty_ldisc.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
> index 3f68e213df1f..34526ffaccbc 100644
> --- a/drivers/tty/tty_ldisc.c
> +++ b/drivers/tty/tty_ldisc.c
> @@ -150,6 +150,10 @@ static struct tty_ldisc *tty_ldisc_get(struct tty_struct *tty, int disc)
>   	 */
>   	ldops = get_ldops(disc);
>   	if (IS_ERR(ldops)) {
> +		/*
> +		 * Always request tty-ldisc module regardless of user's
> +		 * CAP_SYS_MODULE if autoload is enabled.
> +		 */

Without much knowledge of this file...


What the if condition below accomplishes is evident, it probably doesn't 
require a comment.

A more useful comment would be why it does so?

Thank you...

-Vijay/


>   		if (!capable(CAP_SYS_MODULE) && !tty_ldisc_autoload)
>   			return ERR_PTR(-EPERM);
>   		request_module("tty-ldisc-%d", disc);

  parent reply	other threads:[~2023-12-15 14:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 11:37 [PATCH v1] tty: Make tty-ldisc module loading logic easy to understand Zijun Hu
2023-12-15 12:17 ` Greg KH
2023-12-15 13:24   ` quic_zijuhu
2023-12-15 13:41 ` [PATCH v2] tty: Add comments for tty-ldisc module loading logic Zijun Hu
2023-12-15 14:12   ` Greg KH
2023-12-15 14:58     ` quic_zijuhu
2023-12-15 14:19   ` Vijaya Krishna Nivarthi [this message]
2023-12-15 17:26     ` Jiri Slaby
2023-12-15 17:51       ` Elliot Berman
2023-12-16  4:04         ` quic_zijuhu

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=de1181fe-a948-a1e2-04c8-dcd88085f1df@quicinc.com \
    --to=quic_vnivarth@quicinc.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=quic_arandive@quicinc.com \
    --cc=quic_eberman@quicinc.com \
    --cc=quic_qiancai@quicinc.com \
    --cc=quic_saipraka@quicinc.com \
    --cc=quic_zijuhu@quicinc.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 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.