Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3988000rwd; Tue, 23 May 2023 01:09:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6IsLCpu3RjQSEqW5dqMcpBjWFvQm4kYGpigngLJdJGOIz3p8JpO2/rTzqS0QRnFPrcSBBi X-Received: by 2002:a17:903:230b:b0:1af:b97c:2353 with SMTP id d11-20020a170903230b00b001afb97c2353mr6268841plh.15.1684829355796; Tue, 23 May 2023 01:09:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684829355; cv=none; d=google.com; s=arc-20160816; b=fI5HnXorJ+IWZEBmwcxxFa8DD4sO7zGrRHjgHAUTUyOkbq29+ufartKH8gYYU5DoC7 TUHomM1egg8JpFfPoLIl8sW9Z5QVg9Ul1zsx/sstviUhPDBEIt1BaIfEUtRtYSzpcLe5 Eaql78pX16vgriwTB+iU/WAw+EJ5BrF4mTDLDAliJgNswWnN7IUXPakxgm24I3WHzrNz vVsknPJGKP17BQXGpgS4pL6s4QYbfL04duvbUQjQQPJeTBeB4XeBs11hWJbjVKBsjpxO T4f7iqKfbyM856NBL63kGvef/pp1j14FeTb9mDCLthmEMVcfGhxyt/NKmtfV9wKNLZzi QxXw== 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=oMJMbFQgcCvHbmJa9OEy6qWd09vQvN9bjPxXemze1cA=; b=SrLAJ2Vq8Hn/552Rh0DacyqiMI83nqWCfGFrJI2ZcLNScrYJQh5peuOXXUbV++EiA4 8NUvJXp8+taOS3DPK0OS/qlsYj5T+wbfdAbjc+M6gdaufS8YB2OdBL7ZdgBrTt1Lx0zK CmQ7oxvKA0iet0kU/J8QmpO4qK8Ea4W0mquG6uN61F7+n7T0aaH0BUx2e/Iyae7y6dux qwIyhuQudj9S2LscCR3Tx0+hosZxtX84YcB7Q5Mchl+NttrZsRBT7yeq+rHgBJSmGJBC ZCW9hSEKaSRy2YyRc1JGCq4uIkjWGCM5i5rX+3cbJYoX45wBPlAuD/Qn/zK8thpoqnjq qU2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=AA5gc7cz; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a170903244a00b001afaa1f6a9fsi4436477pls.616.2023.05.23.01.09.03; Tue, 23 May 2023 01:09:15 -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=AA5gc7cz; 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 S236006AbjEWH5I (ORCPT + 99 others); Tue, 23 May 2023 03:57:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235892AbjEWHz7 (ORCPT ); Tue, 23 May 2023 03:55:59 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB0DE1BC for ; Tue, 23 May 2023 00:55:20 -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 71D79219FA; Tue, 23 May 2023 07:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684828449; 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=oMJMbFQgcCvHbmJa9OEy6qWd09vQvN9bjPxXemze1cA=; b=AA5gc7cz0DvWTCGBMgX9haf4b2gLcvLjK4uWNrBGUIM1NXDEcLl01m5PZLHVebQ2rpYMX9 ZFhzMFq4N/ZNMf0IIzQH1X4VEkFsIY65xh/nTspoK8/cuLJpNJ9vXZcg+tbHbaMQL6cU8v AmlghIcYjTq0nZ0Ak4Vt6L5z25npRmw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684828449; 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=oMJMbFQgcCvHbmJa9OEy6qWd09vQvN9bjPxXemze1cA=; b=163DO29dg01bIQwP/HiNTgA9Z4aTnAageXRIpoW8BX4Goze2FFZRLP7y8q/FzDbKSKPqoQ ECaKfmzQLGctV8CQ== 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 2EC2A13A1A; Tue, 23 May 2023 07:54:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oMt1CiFxbGT4KgAAMHmgww (envelope-from ); Tue, 23 May 2023 07:54:09 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2 23/37] ALSA: seq: Prohibit creating ports with special numbers Date: Tue, 23 May 2023 09:53:44 +0200 Message-Id: <20230523075358.9672-24-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230523075358.9672-1-tiwai@suse.de> References: <20230523075358.9672-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. Reviewed-by: Jaroslav Kysela 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