Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2219024rwd; Fri, 19 May 2023 02:38:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7QvfIbnBtETTrljKqI5Bbe19QHuSNG+Gt9oHqAjzfLEMf6qrCcO4Dy/t6HpW6jzVH1ctNI X-Received: by 2002:a17:90a:fe96:b0:253:3b17:de90 with SMTP id co22-20020a17090afe9600b002533b17de90mr1615708pjb.21.1684489124098; Fri, 19 May 2023 02:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684489124; cv=none; d=google.com; s=arc-20160816; b=OPJePGnDmbOPlT+Ty34UHypOKGKmyK/ocQkFo+YLTADTSrYl/QUXZA6/GfnED+0/41 lDXhwyAhzLL+I93pTECIr473wVNVUFeSzg62dF75NhvE5QXrnOY5Hudgq/+UFvCcfaDn oENRSLkqvQocy9nvWYrAtxgMcF6lPH3K2WApNRzUqQGj99U6Bkz7soOabkf21wnbn7dH 6jZmelTwN5X6tN1LyJ7mFi+5faNoPZfJiejrpcEJAuoNDG9N5SZgXahRmO6Kjitb+F3j c7VrmepuwBzOw6HV/pVjuf+5ApAJt88drMXaCsQu1dAEalinKLiDGzJlFF9UCIoxsBp2 UY0A== 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=XcYWfCebI4c2wHjl2VTt/v++678oQs8qU/FjGxpuSm4=; b=KDUQrBmauVzIojGFERGQXhQkomvagvD/ZE2NCisbpp92vy89rfbvuJnGRR8osZwJdL fu8Zll8klXvRARyhBxgh9wih+M7mWGq+EDWcJHXJxBW8Ev0GIAySlEV9GxCvvBmpAsVA SoFxWgzcxszH8VEAlhXnrE0akiH7pZ26GRQhQ+njrWEd3PXFh8CkIx/UFfmocTuaONCu ZXR5uWjBVrV3XSj3ZsKP3slQTvTBRQqWBptCwKii+WILDYq4hIibtz4D0entqqdbUpYK AiVI7wvEjnHeeIMTEftNMNAizXg8KDnNgtgF/oAzyBnE7jgZYWA/c/m2OdMISUYufOeW e1FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=W3C6C6OG; dkim=neutral (no key) header.i=@suse.de header.b=sMn72hTd; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a17090a3b0100b00252b6276bc2si1421797pjc.109.2023.05.19.02.38.30; Fri, 19 May 2023 02:38:44 -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=W3C6C6OG; dkim=neutral (no key) header.i=@suse.de header.b=sMn72hTd; 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 S231682AbjESJcp (ORCPT + 99 others); Fri, 19 May 2023 05:32:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231563AbjESJb6 (ORCPT ); Fri, 19 May 2023 05:31:58 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D0C31723 for ; Fri, 19 May 2023 02:31:44 -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-out1.suse.de (Postfix) with ESMTPS id 22B0722245; Fri, 19 May 2023 09:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684488703; 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=XcYWfCebI4c2wHjl2VTt/v++678oQs8qU/FjGxpuSm4=; b=W3C6C6OG5DriJnuaTCyomVC3SHuvO6pJhZua9PXCvkf9TCrwUghZsas80WNInQ/UdWZ6gZ Dl0WY5bcDa7/iJN6IwCxDAUVRS5rZd6PB5L6/b6M3XaRTDB65NL3TQv/XWHUzHdrcj3SaL fF1kQOMWSWMhN1i3lOFnUi+K10wUU5M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684488703; 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=XcYWfCebI4c2wHjl2VTt/v++678oQs8qU/FjGxpuSm4=; b=sMn72hTdvb7ZFG7r7IREHwUPk5KvgFKSUYeWzHEmUKmRu+DsIrAmZ40TLfzuXYSxDKQvua y19tf5JNmqYvhMAw== 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 ECF3413A12; 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 gIEBOf5BZ2RXJAAAMHmgww (envelope-from ); Fri, 19 May 2023 09:31:42 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 22/36] ALSA: seq: Prohibit creating ports with special numbers Date: Fri, 19 May 2023 11:31:00 +0200 Message-Id: <20230519093114.28813-23-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: X-Mailing-List: linux-kernel@vger.kernel.org Some port numbers are special, such as 254 for subscribers and 255 for broadcast. Return error if application tries to create such a port. Signed-off-by: Takashi Iwai --- sound/core/seq/seq_clientmgr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 2dac8c3355fd..0f26f20596d7 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -1206,6 +1206,8 @@ static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg) port_idx = info->addr.port; else port_idx = -1; + if (port_idx >= SNDRV_SEQ_ADDRESS_UNKNOWN) + return -EINVAL; err = snd_seq_create_port(client, port_idx, &port); if (err < 0) return err; -- 2.35.3