From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB6E178F3A for ; Tue, 30 Dec 2025 02:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767060562; cv=none; b=hQUniEw7TLqzYhF2fDg/bP01Ve63lKXHbYb0ScdJu+i4USZrDE4wOUSCXQ5nccWzblX5GdG98drxv2a8JGJ3LVdmhq0aAMvYaqF78dxN7a164GEy5AU36HvRJse8a1iGOOd9tAPTlYCXglYjYYOcbhFYrkmBoTAUKxQLK9UVvWE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767060562; c=relaxed/simple; bh=cOX04FSXdNUmBEsIGEcGclXEpgBhnp7zBSM7kBWlZQA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eNwmHIWsOmut2Mx3mXlRZFD27EEWZNkhwZA8vd/VbeyJcV4vO10w5RKEnKi11XjJE4K6AydcdpgvvK1mXKLQAZt/aG6GN1QABK73udMNgg0Q+bdv2VTP/beQK+vFCC9Ah2rSJbiA9YVZ1YC67zYmqYcW434i58smHaNltXy/yW4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=tV+QMFis; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="tV+QMFis" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=tuhkoJu8yRfe4QFGayL7SZ1dCg/+PfLxsqL9rxsAO/w=; b=tV+QMFis0aSqNoGK8Vl8tONuef fpiD6dsZG4fMzDXSvIoCUHyFwnZcqyB3tIb2K+X8jl0lsO7JAZWO/YhHCjeO4IqeMBugW+ifernCv Xa2b35QtVt5nr3faV1bD+k9lIoa6OC13T8B3hwJeeX11bLfpHB6gYyFs0ID86uInMqWOQV4VDb/iR QRJo6jpxgqxZ4yo0MQFetFLgXQCQ1IF1KP/mwDjjpZLNYjgtvSB/8NxKcfACOH8UoZRRVu0eiSV0C Md47tOcVsZuz6d7X0DXZe42a9jefsnGqtq/2RXbAmCUI39nain3kYy91vjwQDgF8RQW/QBqGIrec2 o+2oSIsA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.99 #2 (Red Hat Linux)) id 1vaPBg-00000004J7y-3egq; Tue, 30 Dec 2025 02:10:16 +0000 Date: Tue, 30 Dec 2025 02:10:16 +0000 From: Al Viro To: Li Nan Cc: arnd@arndb.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, "wanghai (M)" Subject: Re: [PATCH] char: lp: Fix NULL pointer dereference of cad Message-ID: <20251230021016.GF1712166@ZenIV> References: <20251218142019.2822081-1-linan666@huaweicloud.com> <5e81851f-a7f4-5606-9e0d-b823aa5210e5@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5e81851f-a7f4-5606-9e0d-b823aa5210e5@huaweicloud.com> Sender: Al Viro 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.