From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 952E7212564; Sun, 7 Jun 2026 10:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780828763; cv=none; b=GFTYWKHezSpTrb/rySW4+BRP+z4KwqV48QA0XDAXcKLLKlj/LTRIApPw7poln4EEXqRiU9tI/obJMimhdp0VLKJ8qMopRgwBWg9PBxq3Kdq5ef9AVfCzrWIZB1zDcsHTUBNxGAVZrwcLVTbumo8z6f9BYo93bObZMvnqmEAenpc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780828763; c=relaxed/simple; bh=JF+cXNKAHCX/YahfjfRxv8K/HjPhOqmSMTMeNzzGXIo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WD7PB/lJNOTIgxt0N5sP399n48JxxQJlgkxzilPZIi7EpC7nFitj4ZXPCF1+qTi/brxs4CxAgschNove99wsMTqgV42ZbEGvkRdG7YMsJg7uSP+sW/Pu7wlR0klltQtdaJ4oOJxaFVEsQU5o26GzlTrMjF8JOUlJsSVM+bCXRI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=p9vNYr90; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="p9vNYr90" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D67E11F00893; Sun, 7 Jun 2026 10:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780828762; bh=cEzTWsnFBGObOg2Asbr4JHOuDW3mRkoyTgyFFB1/jl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=p9vNYr90gfWAzPiYVGwR0pkWrev9JZTN2qIKTFjj0TfR7RLkzOWk8YLhhEF7VpWpj T6Awd2Evsq6kWVVqCp1QqcYF3GLzFZDYGPKmiYtqlNOY4gl0Sv24C/cymiUyW665mn yu6bkdPKL6fMg9tdW1qb5qCa5RGcEmjwnyJuDPaE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Antoniu Miclaus , =?UTF-8?q?Nuno=20S=C3=A1?= , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 6.18 165/315] iio: gyro: adis16260: fix division by zero in write_raw Date: Sun, 7 Jun 2026 11:59:12 +0200 Message-ID: <20260607095733.654115017@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095727.528828913@linuxfoundation.org> References: <20260607095727.528828913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Antoniu Miclaus commit 761e8b489e6cf166c574034b70637f8a7eadd0ee upstream. Add a validation check for the sampling frequency value before using it as a divisor. A user writing zero to the sampling_frequency sysfs attribute triggers a division by zero in the kernel. Fixes: 089a41985c6c ("staging: iio: adis16260 digital gyro driver") Signed-off-by: Antoniu Miclaus Reviewed-by: Nuno Sá Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/gyro/adis16260.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/iio/gyro/adis16260.c +++ b/drivers/iio/gyro/adis16260.c @@ -287,6 +287,9 @@ static int adis16260_write_raw(struct ii addr = adis16260_addresses[chan->scan_index][1]; return adis_write_reg_16(adis, addr, val); case IIO_CHAN_INFO_SAMP_FREQ: + if (val <= 0) + return -EINVAL; + if (spi_get_device_id(adis->spi)->driver_data) t = 256 / val; else