From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6ABD443636A for ; Fri, 15 May 2026 11:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778845569; cv=none; b=to+7KDyOrp9mBwRM4fERpCXluzuKplyYCFTFFFeAyQ9vwB+4RP/1l6CbwT46Ng8p8FapLaYV+sC1Ynhpk4az8FDQ7V0juBb79KSfXQLGHcv1dH+c6tH0yvk8r95Nda9NqexlzNRxYooNR5vz00DzHfqtsediuPRiM40pUo5f5Ns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778845569; c=relaxed/simple; bh=6A6YYgxvuAzuWLwLMX+INgcjGcAEaXX8R8V/kbiYs8c=; h=Subject:To:From:Date:Message-ID:MIME-Version:Content-Type; b=pTmynDv5gYCh2QaxdJ5m+h7w1Ag2BUZUC+ZLiVmKEcvrL4ocTkPHya+1PHJAUZSCXHHbUUFH8U3MdehVq0DWod+h6jUHBVK2/ydGgSbwXBR+NuFXgb91mMLoC+tSIY8ce8w2iuspqh/EosqEgn5q3qQdDlumXs63AkVBrwGX+00= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TS1z+Z3j; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TS1z+Z3j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C37AC2BCB0; Fri, 15 May 2026 11:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778845569; bh=6A6YYgxvuAzuWLwLMX+INgcjGcAEaXX8R8V/kbiYs8c=; h=Subject:To:From:Date:From; b=TS1z+Z3jaA/+kvE0+l8B+CT5l+FK1oSHYKJbTFbf9dPxmQTssU5AKyFiUP/NKDLc8 KVgbT1LH7CC4JexQuWSqIkVfVpDnR0+9nJ1ScmNyt34z8SX4bfme3nXv9GoOOYt0QL A5Fl65MX3kTvajU2ZfXOdswnI32GLSvAsaHVW/1Q= Subject: patch "iio: chemical: scd30: fix division by zero in write_raw" added to char-misc-linus To: antoniu.miclaus@analog.com,Stable@vger.kernel.org,jic23@kernel.org From: Date: Fri, 15 May 2026 13:45:56 +0200 Message-ID: <2026051556-reps-tapered-22a5@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit This is a note to let you know that I've just added the patch titled iio: chemical: scd30: fix division by zero in write_raw to my char-misc git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git in the char-misc-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From 5aba4f94b225617a55fed442a70329b2ee19c0a5 Mon Sep 17 00:00:00 2001 From: Antoniu Miclaus Date: Wed, 1 Apr 2026 14:08:29 +0300 Subject: iio: chemical: scd30: fix division by zero in write_raw Add a zero check for val2 before using it as a divisor when setting the sampling frequency. A user writing a zero fractional part to the sampling_frequency sysfs attribute triggers a division by zero in the kernel. Fixes: 64b3d8b1b0f5 ("iio: chemical: scd30: add core driver") Signed-off-by: Antoniu Miclaus Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/chemical/scd30_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c index a665fcb78806..11d6bc1b63e6 100644 --- a/drivers/iio/chemical/scd30_core.c +++ b/drivers/iio/chemical/scd30_core.c @@ -256,7 +256,7 @@ static int scd30_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const guard(mutex)(&state->lock); switch (mask) { case IIO_CHAN_INFO_SAMP_FREQ: - if (val) + if (val || !val2) return -EINVAL; val = 1000000000 / val2; -- 2.54.0