mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuangpeng <shuangpeng.kernel@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, edumazet@google.com,
	linux-kernel@vger.kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, horms@kernel.org,
	jiayuan.chen@shopee.com, jirislaby@kernel.org,
	andrew+netdev@lunn.ch, gregkh@linuxfoundation.org,
	shaojijie@huawei.com
Subject: Re: [net,v4] serial: caif: hold tty->link reference in ldisc_open and ser_release
Date: Thu, 5 Mar 2026 11:48:59 -0500	[thread overview]
Message-ID: <951CE2C2-6B03-4EA2-B4AE-D78A47EFC75E@gmail.com> (raw)
In-Reply-To: <20260304173956.0081d8ea@kernel.org>



> On Mar 4, 2026, at 20:39, Jakub Kicinski <kuba@kernel.org> wrote:
> 
> On Wed, 4 Mar 2026 20:23:20 -0500 Shuangpeng wrote:
>>> Can this dereference NULL? The tty->link field is only set for PTY
>>> (pseudo-terminal) pairs. For regular serial ports and other non-PTY
>>> devices, tty->link is NULL.
>>> 
>>> The CAIF line discipline can be attached to any TTY device via the
>>> TIOCSETD ioctl. When ser_release() is called to clean up a ser_device
>>> that was created for a non-PTY TTY device, tty->link would be NULL.
>>> 
>>> Should this check for NULL before calling tty_kref_put()?
>>> 
>> 
>> tty_kref_get() / tty_kref_put() are NULL-safe, so calling them with
>> tty->link == NULL is not a functional issue.
>> 
>> I can add explicit if (tty->link) guards to improve readability if you prefer.
> 
> Sorry, I should have checked, I'm surprised the AI agent got something
> this basic wrong. Just the Fixes tag, then..

Thanks for confirming. If there are no other concerns, I'll update the Fixes 
tag and send the final version.

      reply	other threads:[~2026-03-05 16:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-01 22:05 [PATCH net v4] " Shuangpeng Bai
2026-03-04  1:26 ` [net,v4] " Jakub Kicinski
2026-03-05  1:23   ` Shuangpeng
2026-03-05  1:39     ` Jakub Kicinski
2026-03-05 16:48       ` Shuangpeng [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=951CE2C2-6B03-4EA2-B4AE-D78A47EFC75E@gmail.com \
    --to=shuangpeng.kernel@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=horms@kernel.org \
    --cc=jiayuan.chen@shopee.com \
    --cc=jirislaby@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shaojijie@huawei.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

all inboxes | Powered by JetHome®