From nobody Wed Dec 31 12:27:29 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97F06C4332F for ; Thu, 2 Nov 2023 19:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377400AbjKBTF0 (ORCPT ); Thu, 2 Nov 2023 15:05:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235149AbjKBTFW (ORCPT ); Thu, 2 Nov 2023 15:05:22 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BEA6D49 for ; Thu, 2 Nov 2023 12:03:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698951807; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=m+72lU2is0RjPg3Ej03EzBiDP42Tb65So4vdSCepZ9s=; b=Ch61Hwf+63FZ0uv71dadk5okntx1YM1TBwO1p0oOHQB7NsJq+ar+tLHmrpi/volKR6Bxvo 3ko+gNCZSrdwvyd7wpC3uVpF3hO2V1G+MxjFKvfDBo5a7bWOeaCEYNfB+1EEOVph/28Jmr 5MwWFrFD8zEPDR/9M0gCq8arLFZPLBI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-60-9hev12-tPWWLUP4VRjnSZg-1; Thu, 02 Nov 2023 15:03:24 -0400 X-MC-Unique: 9hev12-tPWWLUP4VRjnSZg-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4083a0fb583so1464155e9.1 for ; Thu, 02 Nov 2023 12:03:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698951802; x=1699556602; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=m+72lU2is0RjPg3Ej03EzBiDP42Tb65So4vdSCepZ9s=; b=grMiJ3mPofeUocBirSY8sQFXlU4+1zd9EPIOWpCUWrGYNuq4yie0nYB2yhx/t6Q5vI AdekKWiueU9JOwbZoCqXs36mTL17GJ3pnOf0VTIk8NwjCA2fmWje4wkWCgSac4q8XsKJ JuyVtinz9kks8KsMS91xUF/1r2mnmBS5aLuXVikH4o6Z5LED+y014jXrchp6Uagcb66I Iy5U0FQbZoL60H8PnIOQB9pVch/NdhJwp1DM31YrYwZhAyDnObycVZuPamgZ1+WNB7At UNb3Y+zt5pVZpkURwA2iLxsOWtO0Yy1WzCNtbrgCXkWi8FQri1L0Rw+t0y9i6R04qd1p wzEg== X-Gm-Message-State: AOJu0YyUcqDFOi19wTyG4VVFvHaRdXgigQ+SiueL8wYbnRzrtDmrCXns ietUtOf96qkxCprGwT3dZ3MT8Vs+nWZEa5t/l4sXCAMUKt2WBFD5ZLRCLvbrLLdJ/dv0BfJzS1O zhwB1zqGAHVh/F+W2agCGtMm/9xiSplAS7MQ= X-Received: by 2002:a5d:5c11:0:b0:32f:8a45:93a7 with SMTP id cc17-20020a5d5c11000000b0032f8a4593a7mr9124225wrb.0.1698951802590; Thu, 02 Nov 2023 12:03:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUPZRT8I8iw/CcEcUptKDDx7966nYE1/uugb6+QE4ZoKiWbmft1KG9gyqtzE1rFEHqmKpeCw== X-Received: by 2002:a5d:5c11:0:b0:32f:8a45:93a7 with SMTP id cc17-20020a5d5c11000000b0032f8a4593a7mr9124209wrb.0.1698951802240; Thu, 02 Nov 2023 12:03:22 -0700 (PDT) Received: from pstanner-thinkpadt14sgen1.remote.csb ([2001:9e8:32c5:d600:227b:d2ff:fe26:2a7a]) by smtp.gmail.com with ESMTPSA id l22-20020adfa396000000b0032f7d1e2c7csm62660wrb.95.2023.11.02.12.03.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 12:03:21 -0700 (PDT) From: Philipp Stanner To: Jaroslav Kysela , Takashi Iwai Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Philipp Stanner , Dave Airlie Subject: [PATCH] sound/isa/wavefront: copy userspace array safely Date: Thu, 2 Nov 2023 20:03:10 +0100 Message-ID: <20231102190309.50891-2-pstanner@redhat.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" wavefront_fx.c utilizes memdup_user() to copy a userspace array. This does not check for an overflow. Use the new wrapper memdup_array_user() to copy the array more safely. Suggested-by: Dave Airlie Signed-off-by: Philipp Stanner --- sound/isa/wavefront/wavefront_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavef= ront_fx.c index 3c21324b2a0e..0273b7dfaf12 100644 --- a/sound/isa/wavefront/wavefront_fx.c +++ b/sound/isa/wavefront/wavefront_fx.c @@ -191,9 +191,9 @@ snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct = file *file, "> 512 bytes to FX\n"); return -EIO; } - page_data =3D memdup_user((unsigned char __user *) - r.data[3], - r.data[2] * sizeof(short)); + page_data =3D memdup_array_user((unsigned char __user *) + r.data[3], + r.data[2], sizeof(short)); if (IS_ERR(page_data)) return PTR_ERR(page_data); pd =3D page_data; --=20 2.41.0