From: Al Viro <viro@zeniv.linux.org.uk>
To: Li Nan <linan666@huaweicloud.com>
Cc: arnd@arndb.de, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org,
"wanghai (M)" <wanghai38@huawei.com>
Subject: Re: [PATCH] char: lp: Fix NULL pointer dereference of cad
Date: Tue, 30 Dec 2025 02:10:16 +0000 [thread overview]
Message-ID: <20251230021016.GF1712166@ZenIV> (raw)
In-Reply-To: <5e81851f-a7f4-5606-9e0d-b823aa5210e5@huaweicloud.com>
On Tue, Dec 30, 2025 at 09:51:43AM +0800, Li Nan wrote:
> Friendly ping...
> > @@ -569,10 +579,13 @@ static int lp_release(struct inode *inode, struct file *file)
> > {
> > unsigned int minor = iminor(inode);
> > + if (mutex_lock_interruptible(&lp_table[minor].port_mutex))
> > + return -EINTR;
->release() return value is never checked, simply because there is nothing
to do with it. It will *not* leave file opened - it will simply leak,
with no way to recover from that.
If you need to report some errors on close, do that in ->flush().
If you ever see ->release() returning a non-zero value, you are very
likely looking at deeply confused code.
Don't do that. ->release() can't fail, period. It should've been
void (*release)(struct file *), but for historical reasons it returns
int and there are too many instances to change that.
next prev parent reply other threads:[~2025-12-30 2:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 14:20 [PATCH] char: lp: Fix NULL pointer dereference of cad linan666
2025-12-30 1:51 ` Li Nan
2025-12-30 2:10 ` Al Viro [this message]
2025-12-30 2:52 ` Li Nan
2026-01-16 14:38 ` Greg KH
2026-01-20 7:59 ` Li Nan
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=20251230021016.GF1712166@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linan666@huaweicloud.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wanghai38@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