From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (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 B72F73D300C for ; Tue, 20 Jan 2026 07:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768895996; cv=none; b=UJw4FW2sAuK4bM9opRBV/hbsMk4yxU8E9rqxHgoHQ4soq7MlKriVTVXAKM/dyasEt40lxWgQIYIkgG+OW0RlVX5vqeSWeXNMb8JfiTkkOpOjHdjh8DtHCGTSl20ohZpPf3oov9O3KjeRqi1xJiBXgcxomPLfxWy1knYYe6Rd8NM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768895996; c=relaxed/simple; bh=lw5eid8OmrjRfdobXsclizd4F+jIHjNJRQGkMue0f20=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=RHFuf6jeFZZicu2MbgXyWGvQMikEyDelSrVVhCp7Kp05Dbrp+dBVRgGVMPe05R6uliQRLMnMl9Mw7YMKnGJ7dWE+mE8RUlqR1ZnnRcECs/mtjOlMmN7Kl8jywU+DOBzYBFeYR0AMzzn1hm0EPtv5AXRRcoghqRGasfehnetgzy0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.177]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4dwKTQ0HxfzKHLv9 for ; Tue, 20 Jan 2026 15:58:50 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 07EBA40590 for ; Tue, 20 Jan 2026 15:59:51 +0800 (CST) Received: from [10.174.178.129] (unknown [10.174.178.129]) by APP4 (Coremail) with SMTP id gCh0CgBHp_f2NW9pdijTEQ--.33609S3; Tue, 20 Jan 2026 15:59:50 +0800 (CST) Message-ID: Date: Tue, 20 Jan 2026 15:59:50 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] char: lp: Fix NULL pointer dereference of cad To: Greg KH Cc: Al Viro , arnd@arndb.de, linux-kernel@vger.kernel.org, "wanghai (M)" , "yi.zhang@huawei.com" , "yangerkun@huawei.com" References: <20251218142019.2822081-1-linan666@huaweicloud.com> <5e81851f-a7f4-5606-9e0d-b823aa5210e5@huaweicloud.com> <20251230021016.GF1712166@ZenIV> <05a36e03-a1d3-bd2e-1e95-86d71add6a8b@huaweicloud.com> <2026011601-geometric-grading-ceb7@gregkh> From: Li Nan In-Reply-To: <2026011601-geometric-grading-ceb7@gregkh> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:gCh0CgBHp_f2NW9pdijTEQ--.33609S3 X-Coremail-Antispam: 1UD129KBjvJXoW7CF48XF1rAF13uw1UAFW5Wrg_yoW8ZrW3pF W8Ga4Ykr4kXr1xt34Dta1Yvr1Fyw1fKrW5Xrn8J3s2vFn0qry3tr13Ka909F1kWrykWrW0 qa1jqFy3XFyDAaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU92b4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x 0267AKxVW0oVCq3wAac4AC62xK8xCEY4vEwIxC4wAS0I0E0xvYzxvE52x082IY62kv0487 Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aV AFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JMxk0xIA0c2IEe2xF o4CEbIxvr21lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x 0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2 zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF 4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWU CwCI42IY6I8E87Iv67AKxVWxJVW8Jr1lIxAIcVC2z280aVCY1x0267AKxVW8Jr0_Cr1UYx BIdaVFxhVjvjDU0xZFpf9x07UG38nUUUUU= X-CM-SenderInfo: polqt0awwwqx5xdzvxpfor3voofrz/ 在 2026/1/16 22:38, Greg KH 写道: > 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 Thank you for your reply. Yes, I have the actual hardware for testing. I originally reproduced the issue in QEMU and will run more comprehensive tests on the real device. > 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. > I agree the driver needs further cleanups and fixes. I'm happy to help with testing and maintenance, and I'm willing to take on the maintainer role for this driver going forward > thanks, > > greg k-h -- Thanks, Nan