Message ID | 20230519093114.28813-22-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 b10csp1104089vqo; Fri, 19 May 2023 02:39:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5OBNeReyNUHkRf3WBvI6WY88wm9K7ubhZ250PKlx1vblFPPaUX/HPAT+1Ns3a+6CSTYvlm X-Received: by 2002:a05:6a00:23cc:b0:63f:ffd:5360 with SMTP id g12-20020a056a0023cc00b0063f0ffd5360mr2740884pfc.21.1684489163157; Fri, 19 May 2023 02:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684489163; cv=none; d=google.com; s=arc-20160816; b=Sfvj7ay8+KqxD5g2EndDte299O59/C1a2tcZAn4SSWTYHLZjm4HrksepnEEucEjZzp GxZD8aHwN+X8ebZdkO5AE2o0AOH+79elO6BVDDIqEUii2yJRw3J6tJOZYNiAYaz7UbUM vFPPBDBF4WlypDpCQEnait/wWTmO3TWhXl09us3DQxyxRCmS/h5kJmue9KK2eiLZEvnd HK7DLDKY8oN1yPo4vNv6o9u09EJfMl9Zs+5x3ieTwuPlhkCjDvMgpU6b+qkzkbnX9rD5 sBADDj2o3Wa8sk8Y4F0x/emKWZVfyzpQ6IpkkSsxsoCvK3WIC/jI5iVDbITURfoPpRQx O33A== 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=8MgnbPU5OxNR58kbXTDxnCalMNCAoR86IpQnF9YZNg4=; b=BYFSikGMMAvHFv97WZ7XYGsiT+Nah/qo7TuB4DU2TIVjDiUf/qT0/22Ox/PxqLjjJH pZlCq9wVFiT+Azm9Y3EX6un5yN/xL33kJm3vci6qLT4OyLZjBcNGj9FsGPX9iAUPgHi5 C//vvQrSyEhgcAKzruqHRA36u1DW4zjd7kI1SSHjxh1YGrN94cSLPH61JG/0RMly4eTG 7Pjh2Mx2jyy71Pb3tm8wdkfIYNxxwjYDqADqTZrL96DXUDsdBdYFYCIIY7c8QMzydkjj uHicyiKLSFOog7fMGA+ZPwQ1TD6GnnEDXs4vd2CSAr966/rBQT4zEWKnKfvAu487iSt+ p5uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=JQbHU5G+; dkim=neutral (no key) header.i=@suse.de; 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 n127-20020a632785000000b005343e03b044si2351182pgn.697.2023.05.19.02.39.10; Fri, 19 May 2023 02:39:23 -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=JQbHU5G+; dkim=neutral (no key) header.i=@suse.de; 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 S231668AbjESJcl (ORCPT <rfc822;wlfightup@gmail.com> + 99 others); Fri, 19 May 2023 05:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231556AbjESJb5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 19 May 2023 05:31:57 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7B111711 for <linux-kernel@vger.kernel.org>; Fri, 19 May 2023 02:31:43 -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 7FF391FE3D; Fri, 19 May 2023 09:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684488702; 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=8MgnbPU5OxNR58kbXTDxnCalMNCAoR86IpQnF9YZNg4=; b=JQbHU5G+rVXX4eGX0w/eykC0meoBaVIsGgo47/Mcj8tcNQU33V2s1S9nmk4yvAl49bFCdo rHfOTmNDW1LM3NgjV6ek+4MQjIGPKEu1ogJZOW47mFnAjriZdPRj6nBjqnQORIolCafvu/ HSzcNl8YMSc3iNgiddYSYmIKYyJd/yM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684488702; 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=8MgnbPU5OxNR58kbXTDxnCalMNCAoR86IpQnF9YZNg4=; b=96UAUeALXMUPrN1d6Jb9j234WJCU/S1hHfsSziVYbn2j2Mc3KF3DGKWcThV8482jplLcTn XEfrqHY4GDKwCpBA== 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 60D8113A12; Fri, 19 May 2023 09:31:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yJq4Fv5BZ2RXJAAAMHmgww (envelope-from <tiwai@suse.de>); Fri, 19 May 2023 09:31:42 +0000 From: Takashi Iwai <tiwai@suse.de> To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 21/36] ALSA: seq: Check validity before creating a port object Date: Fri, 19 May 2023 11:30:59 +0200 Message-Id: <20230519093114.28813-22-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?1766314908684337953?= X-GMAIL-MSGID: =?utf-8?q?1766314908684337953?= |
Series |
ALSA: Add MIDI 2.0 support
|
|
Commit Message
Takashi Iwai
May 19, 2023, 9:30 a.m. UTC
The client type and the port info validity check should be done before
actually creating a port, instead of unnecessary create-and-scratch.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/core/seq/seq_clientmgr.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 06743114cabf..2dac8c3355fd 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -1199,6 +1199,8 @@ static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg) /* it is not allowed to create the port for an another client */ if (info->addr.client != client->number) return -EPERM; + if (client->type == USER_CLIENT && info->kernel) + return -EINVAL; if (info->flags & SNDRV_SEQ_PORT_FLG_GIVEN_PORT) port_idx = info->addr.port; @@ -1208,12 +1210,6 @@ static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg) if (err < 0) return err; - if (client->type == USER_CLIENT && info->kernel) { - port_idx = port->addr.port; - snd_seq_port_unlock(port); - snd_seq_delete_port(client, port_idx); - return -EINVAL; - } if (client->type == KERNEL_CLIENT) { callback = info->kernel; if (callback) {