Message ID | 20230519093114.28813-17-tiwai@suse.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1103088vqo; Fri, 19 May 2023 02:37:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7OfR2rkxzFIogLfSD5A9lLQJgMG9wpar4yJ2+m0Empi2tH+dxMV9X5MNuStqP+bQt5doqf X-Received: by 2002:a05:6a21:78b:b0:f2:13cc:2914 with SMTP id mg11-20020a056a21078b00b000f213cc2914mr1492451pzb.16.1684489022642; Fri, 19 May 2023 02:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684489022; cv=none; d=google.com; s=arc-20160816; b=b77Kn3imKftR1fFB0D1453507DgoMftaZEqL2lUmy6boDyBmcELaLoMrHK6CG9cBKg /qt308f7WDtmLroBDHmOKWk4Xx2nsNAK3QnhdTKON8lfrcX/+7miVGoxavyjGVBnFoX1 JtWyM2n2dRO+P8vhBDHHwdL03iv0lqHLAPheZpzItuhANm8QLvsrfiBnXJ/C/xpdHBku cNQ+udxBL+0/1JTyy98816IihbYJwnZiO2z4FGRnFg+aIleyFGXpClNA/sZrwfILWRaP cTJzKk52AGc5V0ygjZ76jcZ40+4GWAyjl1CT6/Nil56zoQ+TUL664AWErfyAimYc7ZGm a3NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=NcafucgcxTqZeZeiPExPE8Xrdw3TdNFdLqfYPg++GvE=; b=nj9y+EdHLf8K8aYIP4xhSqGqnK8b89iB/l90pVEcOSSk5SVb7uu6J8TRFPXGUemTJJ zRcVn+YLGaqh7fIlge8l6jrRz/e8e9lMylWuYhG9pgMCPtguQM3ylqKjuqmatIYYbWdI fYcqAKn4n4B600f5/LARhsJqEQsMQjYxsJiB3H0THPyvn0JLyWWJI3Bo0n5w9BbZnM29 cCkSNfNMDv1I0rUl55t1lXl8zphdZajDi1DPGcxpV4uL1/PGp0tizXiiqjYwWIiipbN9 /Vx7tRPeKuAZYnIvCBLijcu7RPVg/VHwnbUpIJgyT1y6ud2Lvw4bcMcVEWUFIyKsk9PD sz0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="oxtSs/AL"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=cIMkAkUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 140-20020a630192000000b005306389dbeesi3298515pgb.612.2023.05.19.02.36.49; Fri, 19 May 2023 02:37:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="oxtSs/AL"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=cIMkAkUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231626AbjESJcY (ORCPT <rfc822;wlfightup@gmail.com> + 99 others); Fri, 19 May 2023 05:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231500AbjESJbm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 19 May 2023 05:31:42 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09E1010C6 for <linux-kernel@vger.kernel.org>; Fri, 19 May 2023 02:31:41 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B53F31FE3F; Fri, 19 May 2023 09:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684488699; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NcafucgcxTqZeZeiPExPE8Xrdw3TdNFdLqfYPg++GvE=; b=oxtSs/ALtpLVgWEWNJuz2y20qkf0gtOtYz7XyvX3qPIIpPP3AOfGyL1+s0PKmKZcTFKrKk yqGtk5N9sW2qKKpAZ+1KYTINr4sSY1oOiZwCLVcKTVl+aD3baa9ORRGT47ItXTgk022Pyl +WI3vjzfgYprHuGdpcu50HpnvOaycUU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684488699; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NcafucgcxTqZeZeiPExPE8Xrdw3TdNFdLqfYPg++GvE=; b=cIMkAkUHAE0x/CPu6ovTjm4Z2Q9mv6qQEw/bLMwiPzgnuuU+hck8W+P74ITEqoo2UjxaO7 PkM6owc0jQY6VUBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 956B213A12; Fri, 19 May 2023 09:31:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ELyhI/tBZ2RXJAAAMHmgww (envelope-from <tiwai@suse.de>); Fri, 19 May 2023 09:31:39 +0000 From: Takashi Iwai <tiwai@suse.de> To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 16/36] ALSA: seq: Clear padded bytes at expanding events Date: Fri, 19 May 2023 11:30:54 +0200 Message-Id: <20230519093114.28813-17-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230519093114.28813-1-tiwai@suse.de> References: <20230519093114.28813-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766314761354187638?= X-GMAIL-MSGID: =?utf-8?q?1766314761354187638?= |
Series |
ALSA: Add MIDI 2.0 support
|
|
Commit Message
Takashi Iwai
May 19, 2023, 9:30 a.m. UTC
There can be a small memory hole that may not be cleared at expanding
an event with the variable length type. Make sure to clear it.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/core/seq/seq_memory.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index 47ef6bc30c0e..c8d26bce69ff 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c @@ -152,12 +152,16 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char return -EINVAL; if (copy_from_user(buf, (void __force __user *)event->data.ext.ptr, len)) return -EFAULT; - return newlen; + } else { + err = snd_seq_dump_var_event(event, + in_kernel ? seq_copy_in_kernel : seq_copy_in_user, + &buf); + if (err < 0) + return err; } - err = snd_seq_dump_var_event(event, - in_kernel ? seq_copy_in_kernel : seq_copy_in_user, - &buf); - return err < 0 ? err : newlen; + if (len != newlen) + memset(buf + len, 0, newlen - len); + return newlen; } EXPORT_SYMBOL(snd_seq_expand_var_event);