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 D107C3E2760 for ; Mon, 13 Jul 2026 11:41:03 +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=1783942866; cv=none; b=qRnNyEIX2bK5CLuAGnxO8DfkJMvDxcyWI90CZx0WpqmzCaYAMiHRq3gOx4A3WwXtjAXftkJ/eeM11wVDMPb+dz0tJ03j8Ad35cGiNZViFuJp4yG7GO9YitcOxrt/83C5LIFH2n2f/upRr+UgU9INMgpnoQYXO3/k58k7UXFlzgQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783942866; c=relaxed/simple; bh=9FrLo67VfYF3ZpnOVkaF8Rlr709oEukF8gtE+IPKx9Q=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Jf7JMImJpMPoXL00GH6XAlUDnU600jeXLaJ5XFZHPv/z3yugC8YvMrZyRLnJn9z6mQwh2YjQmmq/DqgfbIoU9q59jiqxQK2QgCtrPoJwoJjlVwfe1SfrhnrzBe8AQ9cjRgWciUjvCp5FYlm/rG0J+FcVPiVSGnyziEjcHmWNJm8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZSZZrx9Z; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZSZZrx9Z" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-493bfe9f886so15797345e9.0 for ; Mon, 13 Jul 2026 04:41:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783942862; x=1784547662; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=P/WYgW+KJeYAWgpC3kzeRPmTrBu/4muElQjvrWC1UWc=; b=ZSZZrx9Z0qsVercscfNYdU+AKk1Pe8mahzDGSsoI6Z3VdL8OqYeqnsoF/S5IIFpbjF /GuFxpbJzrcv3CgAuVJFmxVcgYp37bCYty1R/6PFqfw8rtVbrkbIA0t+M8WPgLE2twiI 0eU284Yb6xMWa16QAzx/4YucsJjVssm8673FMUZYxAKZC+as72JWi/3ztEBg9v/UcANi IlxWTJ+BkD3EAWATdngDmSw0322sisTkLmImpdpwzodFeH1PPmdFhdZ7aCQhzulQ0581 jTq/nkUTs5UClzZYY2z6YETTAk71JH0zxDud+pwXDXcJIPQiMDnnBj0p/gH3nJFSxpJE iTGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783942862; x=1784547662; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=P/WYgW+KJeYAWgpC3kzeRPmTrBu/4muElQjvrWC1UWc=; b=qbGYQm8nconRltts9g5LXf176Ed9E6ILOe4uDG1J6mPnHVel++K97beENNMXcHxywg a5Vt63rBWtnfpyQartcsw2iBjwwCWn4ACJfMoWrS1owmW2FKMw7Nc0YgoyDMCAhw5Aso AUqLCMawNVsCd0ff4I3JRk0qwnqYBdsSMl40Enh0f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7kVfanwivpbA xrNmnx6o09OaC8jJCPy6FgTsq7gtmxF7SQA== X-Received: by 2002:a05:600c:46ce:b0:493:bc92:ef45 with SMTP id 5b1f17b1804b1-493f8820951mr87046575e9.24.1783942862160; Mon, 13 Jul 2026 04:41:02 -0700 (PDT) Received: from localhost (90-182-112-124.rcp.o2.cz. [90.182.112.124]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493f49755f9sm272718035e9.8.2026.07.13.04.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 04:41:02 -0700 (PDT) Date: Mon, 13 Jul 2026 13:41:00 +0200 From: Joshua Crofts To: Andy Shevchenko Cc: Laxman Acharya Padhya , Jonathan Cameron , David Lechner , Nuno =?ISO-8859-1?Q?S=E1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v3] iio: proximity: hx9023s: validate firmware size Message-ID: <20260713134100.00006272@gmail.com> In-Reply-To: References: X-Mailer: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32) 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-Transfer-Encoding: 7bit On Mon, 13 Jul 2026 14:34:32 +0300 Andy Shevchenko wrote: > On Mon, Jul 13, 2026 at 10:31:30AM +0545, Laxman Acharya Padhya wrote: > > hx9023s_send_cfg() copies the firmware into a counted flexible array and > > then reads fixed offsets from the copied data before walking register/value > > pairs starting at FW_DATA_OFFSET. A truncated firmware image can therefore > > make the driver read past the copied buffer during probe-time configuration > > loading. > > > > Reject firmware images that cannot contain the fixed header, reject images > > too large for the u16 fw_size field, and validate that the advertised > > register count fits in the remaining payload. > > > Fixes: e9ed97be4fcc ("iio: proximity: hx9023s: Added firmware file > > parsing functionality") > > This has to be a single line. > > > Cc: stable@vger.kernel.org > > Reviewed-by: Joshua Crofts Remove my tag for the time being, I do agree with the change in principle however this patch needs a bit more work than I expected. Happy to re-review once everyone's comments have been addressed. -- Kind regards CJD