From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 7EDA22D0C62 for ; Mon, 9 Feb 2026 07:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770620949; cv=none; b=WsaNRPsM0w0Mkdierw6xxlMdJ8fFWhlbY1CPCuZGgOsVVkMILImJ3uUhd5k90Uy1TU1zLZd5XUCY4o3eeD93vKups2BbspnB9gX3e7CyCOg62kklQWEdM/HHTAQyCLQ35GjygT5IOJmeWfJiD2KiWxAz+ApZS7SmAMvHogheU4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770620949; c=relaxed/simple; bh=I1NGi+ekaGjV0E8Ubikboz6y8tPzpfia4WSzbvIpj90=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ig9z77rrxKsiO7UGBFCX9KLmOcoDGQC0I8k9J366s5Zuya4AIQhq9XWdzjoxtfLyjrA9Qxh8GZPhAruI0HBRmE3S+hH8DXrC68aysw8CSEUjUu8hgZIJUUHv3FyPBl6THyAtLAeqBFuF+M3W3HKVF7dqiKug3sH+3K1oeSJ3k/M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=PgGjAHPU; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PgGjAHPU" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4806e0f6b69so30567815e9.3 for ; Sun, 08 Feb 2026 23:09:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770620948; x=1771225748; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=H+wuaBU+jHlT/7T8bfgNNKqmz7w+AC3ayhXibObZLas=; b=PgGjAHPUGNCbWZp8KIEmQS9TfKUSg/z/OuZIVeEZuQCq9MyxCUm1qYj0mZObofCesY VVKc46buzkVTxS6MK7RuqIytyqcIvplBJoixjwnV/rdQJYiNpe2trah1AzNGsX6VMBEE AqTqpsFMWxORuaU4ST6GNw5hndiAGU8OPhkZtJEwQi95HVcBp1JrUF8/gNrbS+GJ3mnO Yay3G33oW/q9eHBpHJiCTi5UEsHWB3yTnbE4mIhh00lODoQ80f8lkUdYwcMHM0fcGMXR vgmUNYzeRVDZMOLaSwC1t8Z96G9n/OtPjf8ysIOqNUncPVTWpdBV6lbI95ezXaagfB93 1hLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770620948; x=1771225748; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H+wuaBU+jHlT/7T8bfgNNKqmz7w+AC3ayhXibObZLas=; b=GHUqK4QUMr1GXBX0cSUCHFnNL80dYyvzbi6fVjMfRqVlQUw1yaOBTYS02/UlauWISA rBmkiT959hpf6sD+JcPCGCRRYEJR9VvGZxlyuE+ohVuNXkzPgw6Dw+TnaoWO8/GyAtF+ oJIWoQxQzttKvyvC492MD0BOEfpBrNG4QpCZLAkJNiyJugne8zZvHxAunTYsfl4ubGg6 rojQ0kKun7gq1KPuSqFkmT2D/sDqFHeSikmLbUYNIDn+W0ogT7gRL+0ixVHuEhJyfS/W fWR1T788+6ClowHAsmhAxOVpUxES0SNnac6ZB6hmBErEBfBs3a/iloJPTuMVxpqbE2qd uBjg== X-Forwarded-Encrypted: i=1; AJvYcCU2sOJvf09iHGgy4qMhSpYXYYyEP4rSzNqs7wxnF1EJ0zl0kXTbcCuOKgH++gdvaLLD/NREifY++SJX82o=@vger.kernel.org X-Gm-Message-State: AOJu0YzpOrkT6OvLYqhQuwrGg5ihXlzDvXh0OEBGVCs5qJwRgRTDX1q/ aT4IEWGL67kEJ7fQwQSJaqXWd9kTQk8RztbzUETQLtyPu9rBKtZ+gnwqlGKG+ilLCBc= X-Gm-Gg: AZuq6aJ9dP6sC2UKbBoM7MWUNU8ryp0k/hIxO1/UQVqlNb8MEkvP33AZbbb+gpp8SO1 U5AKX8OadXAX9kBiQYUv/oYap+TmAtq52T4uiWJc0mNKTvtYN+CjeBxvcNr+RBN8FCEkyDNlqr4 4AeQ9N0wL7LpUyHbWqkPMPZMs3q9DwlyTQANbA8mHMC8XDWpdxm0kP234ussWqMsaR+X/BdGDnv FHK7N1AgNmmh1kmO4Wt9YkNDHkSqMktJ0fG+u045cR5eoUcbp/fA3aUoPCnDok9vUFf7gi4bvl2 M8r3F5dDBB+NfuvCUZ95l4sJ3f8PJXi+xYbkCEDduT0XjR/3WMUQJxJeyDdtfDnqWDx6xw9+CCy oVaffbGykuOrgUOcuosEM8/aJYcglIulFKG1yRrc7NNO9F+mUyE29l9gNfWJwLPTTeiOJaidIMg rCAY8EvP1T3iJaIu0n X-Received: by 2002:a05:6000:2883:b0:435:a815:dd86 with SMTP id ffacd0b85a97d-436293b28f7mr16672811f8f.62.1770620947533; Sun, 08 Feb 2026 23:09:07 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43629754c62sm22756355f8f.38.2026.02.08.23.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Feb 2026 23:09:06 -0800 (PST) Date: Mon, 9 Feb 2026 10:09:03 +0300 From: Dan Carpenter To: Maxime Chevallier Cc: Simon Horman , netdev@vger.kernel.org, linux-kernel Subject: Re: [bug report] net: ethtool: Introduce per-PHY DUMP operations Message-ID: References: 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: On Fri, Feb 06, 2026 at 06:04:36PM +0100, Maxime Chevallier wrote: > > net/ethtool/netlink.c > > 700 static int ethnl_perphy_start(struct netlink_callback *cb) > > 701 { > > 702 struct ethnl_perphy_dump_ctx *phy_ctx = ethnl_perphy_dump_context(cb); > > 703 const struct genl_dumpit_info *info = genl_dumpit_info(cb); > > 704 struct ethnl_dump_ctx *ctx = &phy_ctx->ethnl_ctx; > > 705 struct ethnl_reply_data *reply_data; > > 706 const struct ethnl_request_ops *ops; > > 707 struct ethnl_req_info *req_info; > > 708 struct genlmsghdr *ghdr; > > 709 int ret; > > 710 > > 711 BUILD_BUG_ON(sizeof(*ctx) > sizeof(cb->ctx)); > > 712 > > 713 ghdr = nlmsg_data(cb->nlh); > > --> 714 ops = ethnl_default_requests[ghdr->cmd]; > > > > Smatch thinks nlmsg_data() is untrusted data, so it could be out of bounds. > > It's a u8, but there are only 52 elements in the ethnl_default_requests[] > > array. > > I see, then we also have the same problem in ethnl_default_start(). > > I'd expect the genl part to validate cmd (I haven't checked yet), but we > do have a WARN_ONCE just below for the case 'cmd' is wrong, so we could > definitely add some more sanity checks before accessing > ethnl_default_requests[]. The WARN_ONCE() doesn't doesn't work as bounds checking since there is no guarantee that the array will be followed by NULL pointers. I didn't see a bounds check for this, but I'm not an expert. netlink_rcv_skb() <- receives untrusted data nlh = nlmsg_hdr(skb); -> nfnetlink_rcv_msg() <- calls nc->call() -> ip_set_dump() -> netlink_dump_start() -> __netlink_dump_start() <- calls control->start(cb); -> genl_start() <- this is where the validation would be when we call genl_family_rcv_msg_attrs_parse() -> ethnl_perphy_start() Also the WARN_ONCE() warns if we try to do a cmd which doesn't have a matching operation in ethnl_default_requests[]. Every time we check for missing commands it triggers a WARN_ONCE(). There are quite a few which don't have a handler so I'm surprised that syzbot doesn't trigger the warning and complain. Here is a list of commands without a handler: ETHTOOL_MSG_USER_NONE, ETHTOOL_MSG_FEATURES_SET, ETHTOOL_MSG_CABLE_TEST_ACT, ETHTOOL_MSG_CABLE_TEST_TDR_ACT, ETHTOOL_MSG_TUNNEL_INFO_GET, ETHTOOL_MSG_MODULE_FW_FLASH_ACT, ETHTOOL_MSG_RSS_CREATE_ACT, ETHTOOL_MSG_RSS_DELETE_ACT, regards, dan carpenter