From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp85.iad3a.emailsrvr.com (smtp85.iad3a.emailsrvr.com [173.203.187.85]) (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 9401729B8E1 for ; Thu, 4 Dec 2025 19:06:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=173.203.187.85 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764875215; cv=none; b=WPw4hTq99xps7lqGgMCWyC+1gs1URSC0mN+cEBOLdbYpV9hio1rg61CtvghcGv/WMA2NpiEG9BFYODliOXN/WL3YJ7v2OUrqIEV32I8C7gaA9I3n27Ny4gaqa477h0RgrO+eiFxIdCiwYGSNmYZivMHl2SBDe+epqzRFKWxPtBs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764875215; c=relaxed/simple; bh=SeOOl3E2NjbOkbZa1q6U43DuL5tN9fmZ7KDL7QWunIA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XWu5f/anj/s7K4cfRPIOQxENTt57z0EJB3Ezwn63k5bu27Emois7nCuJCwOS53qLoba1UE+23LbpjLL+OWXuyKBtGydNwU4zmuyoQu3SZydsO6xlCgbiMBYRkMp4ZKN+0m8Rg2/Q8Hd0FwJjDy39sh8iZI26QzmuyPMGxSrZ2Dc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mev.co.uk; spf=pass smtp.mailfrom=mev.co.uk; dkim=pass (1024-bit key) header.d=mev.co.uk header.i=@mev.co.uk header.b=xykqXRt9; arc=none smtp.client-ip=173.203.187.85 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mev.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mev.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mev.co.uk header.i=@mev.co.uk header.b="xykqXRt9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1764866361; bh=SeOOl3E2NjbOkbZa1q6U43DuL5tN9fmZ7KDL7QWunIA=; h=Date:Subject:To:From:From; b=xykqXRt98er56gYfG5ZmAvRyCTbdqpsHHReQWjg9ozDZ+I1xRZSurzMEbUmqCcf69 0RYUUgIGBF5jJ4krKJhnbzC3FwVwMuYgmUbZDA4rAGOhZXLzCpg5NxQEYzzxpbjttL T3iXRO1ZlDcyT/lwBcHcbor3O4gojAcT0izm5KEA= X-Auth-ID: abbotti@mev.co.uk Received: by smtp35.relay.iad3a.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 702EB65FD; Thu, 4 Dec 2025 11:39:20 -0500 (EST) Message-ID: Date: Thu, 4 Dec 2025 16:39:18 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [BUG] WARN "Unexpected driver unregister!" when configuring c6xdigio via COMEDI_DEVCONFIG To: =?UTF-8?B?5p2O5aSp5a6H?= <2200013188@stu.pku.edu.cn>, linux-kernel Cc: gregkh , rafael , dakr , hsweeten , xujiakai2025 , "zhaoruilin22@mails.ucas.ac.cn" References: Content-Language: en-GB From: Ian Abbott Organization: MEV Ltd. In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Classification-ID: 870635c2-fa4e-466e-9a80-78310e314bcb-1-1 On 04/12/2025 15:00, 李天宇 wrote: > Hello maintainers, > > I encountered a WARN in driver_unregister (drivers/base/driver.c:273) when configuring the c6xdigio COMEDI driver via ioctl(COMEDI_DEVCONFIG). This issue is first found on Linux 6.18-rc6 via a fuzzing framework and later confirmed reproducible on Linux v6.18. > > Based on the call trace and source review, the path appears to be: > > - drivers/comedi/drivers.c:207: dev->driver->detach(dev) (detach is set as c6xdigio_detach in c6xdigio.c:290) > - drivers/comedi/drivers/c6xdigio.c:283: pnp_unregister_driver() > - drivers/pnp/driver.c:286: driver_unregister() > - drivers/base/driver.c:273: WARN triggered > > The WARN occurs because driver_unregister() finds drv->p == NULL and prints: > WARN(1, "Unexpected driver unregister!\n"); > > It seems the attach process fails early (e.g. due to a request-region conflict), but the detach path still calls pnp_unregister_driver() unconditionally. If pnp_register_driver() was never successful, calling unregister on an unregistered driver results in driver_unregister() being invoked with drv->p == NULL, which leads to the warning. > > Related information is listed below: > > Kernel source: https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.18.tar.xz > Kernel configuration: https://github.com/j1akai/KConfigFuzz_bug/raw/refs/heads/main/x86/mainline-config > Kernel log: https://github.com/Wxm-233/KConfigFuzz_crashes/raw/refs/heads/main/b42a57a980ac99dba76418f8daaa80e2a90831a1/report0 > Reproduction C code: https://github.com/Wxm-233/KConfigFuzz_crashes/raw/refs/heads/main/b42a57a980ac99dba76418f8daaa80e2a90831a1/repro.cprog > Syscall sequence for reproduction (more precise): https://github.com/Wxm-233/KConfigFuzz_crashes/raw/refs/heads/main/b42a57a980ac99dba76418f8daaa80e2a90831a1/repro.prog > GCC info: https://github.com/Wxm-233/KConfigFuzz_crashes/raw/refs/heads/main/b42a57a980ac99dba76418f8daaa80e2a90831a1/gccinfo > > I hope this report helps in identifying and resolving the issue. Thanks for your time and attention. > > Best regards. > Thanks for the report, but I think that one is already fixed in "linux-next": https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/comedi/drivers/c6xdigio.c?id=72262330f7b3ad2130e800cecf02adcce3c32c77 -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-