From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3588F39282E for ; Fri, 16 Jan 2026 14:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768574295; cv=none; b=Ki3iO0MEFZ8GYX9PAmnBz+jzqogKFf9idn+lIW4APwrYQJLme3MJiqXYsjCZF+J77jsZc/yoD7YEiUdQ85KGXykyNsNXm7H8b2+3rWkgHSKU/DBobDn1Tig0yWxkKvc8A4sROenMmeWMSAaZDi4kngbhNnJZOMqO/xdmZe4rL8c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768574295; c=relaxed/simple; bh=UD26zv4NCFBwZ57eBhOTQQCzame1dSl17yzRG5wClGQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uZ3ceDeYgCJ2KmuHCTL0HoOjlKnvqDVYBZHXC2jJivCgpJmLonPpA/ufB2d/e4o5+AZwiQ9HNY4zJmsXXvVlvGvnCnrdT4ZvW5bubQvSWMLzKDYWh1x8zPMjmGva3EaptcRacc/7A/14MffB8cP2ns0t/sIA/GBxrs3oEWgF5I4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ft1kqGwb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Ft1kqGwb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66569C116C6; Fri, 16 Jan 2026 14:38:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1768574292; bh=UD26zv4NCFBwZ57eBhOTQQCzame1dSl17yzRG5wClGQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ft1kqGwbz+iKJ1b2qQVf35IfwAYM2X/vE/tCLWPD6RaTXu4qWrAgr1Znookw6wG13 p5i5nntuOlv/lJrYph12QCK1d+gjBSz7j837Aa/uwOVSwxno/iCM0u7q49Pg2jubXc CvtyGoa7d8n1t9/60QADTbsARQwUtsZ8sRTEhxcI= Date: Fri, 16 Jan 2026 15:38:09 +0100 From: Greg KH To: Li Nan Cc: Al Viro , arnd@arndb.de, linux-kernel@vger.kernel.org, "wanghai (M)" Subject: Re: [PATCH] char: lp: Fix NULL pointer dereference of cad Message-ID: <2026011601-geometric-grading-ceb7@gregkh> References: <20251218142019.2822081-1-linan666@huaweicloud.com> <5e81851f-a7f4-5606-9e0d-b823aa5210e5@huaweicloud.com> <20251230021016.GF1712166@ZenIV> <05a36e03-a1d3-bd2e-1e95-86d71add6a8b@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <05a36e03-a1d3-bd2e-1e95-86d71add6a8b@huaweicloud.com> On Tue, Dec 30, 2025 at 10:52:02AM +0800, Li Nan wrote: > > > 在 2025/12/30 10:10, 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. > > Thank you for your patient explanation. > > Would it be acceptable to switch to mutex_lock() here? Looking at the code > and historical changes, I don't see a compelling reason for the interruptible > function here. release should not stall forever like that, so be careful. Also, do you really have this hardware to test this with? I'm sure there are loads of other cleanups / fixes needed in this driver that no one has done just because they don't have this hardware anymore. Getting a new maintainer for it would be great. thanks, greg k-h