From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEDE63BA255 for ; Tue, 24 Mar 2026 18:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774377988; cv=none; b=JrhWHF/QcKCmMKuVhJtxCL178lGOaENYA13E2H7TFKHAF7MueDfFEd7NYwc388pU8pXURxQtcdTzoEyB9Ws0RwkC7tmoYEyBLJQby30kxcrR65Wlnj6d17+TUKL8cT/CB9IMWB5zKF4AXyGH4GIqE6tsKYdiWErDZPkrxo+D6vE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774377988; c=relaxed/simple; bh=UvczzIsOMS3kXQveM0wpV/GAU7QOBQmVRRHQQKtC0Hg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Y8CqUfunqBFxlaicUM8Z39IR6OvHp2qjKHPX5QZydKO50p3EOEuAy70SOr6mvYArufReGcD5xWHanqm58PkNWx0Wk6JVJRdCUiNG/so/LWgHJmybOQqsZux07QSIRgkkjf+L2xM9wlvtPGHrKeefzZtI9bZZz+AalpUo2XMV8hg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.com; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4852a9c6309so38135525e9.0 for ; Tue, 24 Mar 2026 11:46:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774377985; x=1774982785; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:reply-to:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ojOjsKJ7l34G40EKUErpTUD3/94bIcbPZZRxSOVCdW0=; b=ZGuUrXCYPRd/L5dfij9hznK6I41JLh4bhkKsncvJa5J7ECPJO/EXz04S2Vlk4Dee0l nFyacIM8Intsl7yRk42KfYytinnflINYL3CAJJnmfXFepmBzS+LREvMVugGiy5cJuPwr 7vM0PvA4nBb+ldYzG9VHrmejZL65JzhZt4eY3EQMosExOXRMB7xjVZol8mQVLA4iG4Lv 5HkfXHwU6Z5KqiKgGmSTKdzoAK3mMKVQR16HxOUeEmHT0XGFI4Nxw/mcryMawZFKiTeq XbHKiBfhKCU+vw8y4Aqt78T6w8sX84j/D1cj3kFDMmaMnRh+pTgfQ/bWjv7gd/fET0w0 Hprw== X-Forwarded-Encrypted: i=1; AJvYcCVy4+FyMbTTHqGCuUoHptbfwfWZe+MwukWjvg0yB7R3LswEi0heAraMBjoPzq4eZ1d4A6u+EBl7tBAUPdA=@vger.kernel.org X-Gm-Message-State: AOJu0YwWGMobOcAYl3M5Qypqr+MZZJ5/63sYluzY1fFaOYNRoE5C4Vks cbRwJ+aUag8IpX8KQgJZfq87ut3uy6iTiBFQ0BoZtIsT0t2oK9tsJ84f X-Gm-Gg: ATEYQzxfFKDHHGgEDFHHfhqa9WivktzX+ZFZewJPBeCxSmaGOQHxCvwakxeOlnC9Dmy 88FSrK1aF6D5+qgBVdfyHOfkrPZpjbtlTrd44njyphTSqguJDqKxlWvuNtah2a5PROaCuX5655U G0n6X85OihNjvejo3p/rgXMXlRQP2IXeGeLPSLcOGHtAHODVOMoEfwiDhg840/aq0Ks9eCr7SNa A3IbbqgLyE5+VB0z0LKkasgpv9Nlg7g/d54ffRFbDX715clWcX14Lf+7tqW6kOjeypy4tUly4tm F0w8yoJ8AiVFZdI/8JCEUO+Pc+MJ+jMX8lt6rt3ANrzbGKMTZ9xkgkoRmL6KSdECcofD5IfNILl 2v0taSgFLMW1rAJnpkWyg1ep228c0b8YVTtSPS47/vbMjgYUJJRJHRBaAFrUowDjN+A8yvWmTJk nEBmCN00vobrGWdV3B/lgB4CsW29EP0w== X-Received: by 2002:a05:600c:45d4:b0:485:557d:9fe with SMTP id 5b1f17b1804b1-48715fd63a9mr12314225e9.12.1774377985164; Tue, 24 Mar 2026 11:46:25 -0700 (PDT) Received: from [0.0.0.0] ([94.156.174.93]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-487113c4eb3sm77639005e9.0.2026.03.24.11.46.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Mar 2026 11:46:24 -0700 (PDT) Message-ID: <1c41e408-15f2-4c83-8a0f-24b46b1ec1c1@linux.com> Date: Tue, 24 Mar 2026 21:46:20 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: alex.popov@linux.com Subject: Re: [PATCH] ethtool: don't touch the parent device of a net device being unregistered To: Jakub Kicinski Cc: Andrew Lunn , David Miller , Eric Dumazet , Paolo Abeni , Simon Horman , Maxime Chevallier , Michal Kubecek , Gal Pressman , Kory Maincent , Oleksij Rempel , Ido Schimmel , Heiner Kallweit , Greg KH , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, security@kernel.org, notify@kernel.org References: <20260322075917.254874-1-alex.popov@linux.com> <3c07c51a-421b-456f-9819-9021ddd7b22e@lunn.ch> <20260323150827.24a6259c@kernel.org> Content-Language: en-US From: Alexander Popov In-Reply-To: <20260323150827.24a6259c@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 3/24/26 01:08, Jakub Kicinski wrote: > On Mon, 23 Mar 2026 02:08:53 +0300 Alexander Popov wrote: >> Hello Andrew, let me describe the scenario that I see: >> >> - The netdev_run_todo() function handles the net devices in net_todo_list >> in a loop and moves each of them into the NETREG_UNREGISTERED state: >> netdev_lock(dev); >> WRITE_ONCE(dev->reg_state, NETREG_UNREGISTERED); >> netdev_unlock(dev); >> >> - Then netdev_run_todo() frees these net devices in another loop. >> On each iteration, it chooses a device for freeing: >> dev = netdev_wait_allrefs_any(&list); >> >> - At the same time, the ethnl_set_features() function calls >> ethnl_parse_header_dev_get() for the child net device. >> >> - If the race condition succeeds, ethnl_set_features() takes the reference >> to the child net device being unregistered. That makes netdev_run_todo() >> free the parent first. > > That's not sufficient detail. ethnl_parse_header_dev_get() is under RCU > and unregistration does an RCU sync after delisting the device. Also > not sure you're distinguishing struct net_device and struct device. > > How did you hit this issue? What are the net devices involved? I've provided additional details about the reproducer of this vulnerability to Jakub and to security@kernel.org. Best regards, Alexander