From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796389007; b=16z5IqtOnn0UkymfKw1kJmNQwE+1TX9DNTvNUjZimGR1hHDxQO3M/w13F7SzJwtMsnkq YNU3f08Gap3QyNL5VTKIz3iDYD2ckq8kUhHK7FKGYZQIkh9XKXJhdWV4KEObrTt5pID0i pDO+UXBu6+aHFv3K+sbrbxYfkmPWpj/EMcVo9NbJ8WUlm0bdbHA63HlPlPkPIXchAszYf gaWfZ02u1JgF4UnI19F547zOtxO2O/aYyX62TDPWhoy7kmwHA95Ti4gPBkjdQnYM/2EJc I/+EsJQPwmPVoRLPd5s+sVRBFdGiQLfSD1ODdGNmSMJf0jJC1FH+FJm67vgBgnYigFg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389007; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=aHVWs6veTKOfAGRMS4/bnDCffRcet9ZnstUVhi+NEbw=; b=Khc1845bXBvETl74ZCSTrISgjzU5Djx9fd2zaVQw2x2rAHxTqTCVikPAqO9OW42/laLx cdFXotCQajFMJWE9mWnisNu+wpyrEI3MaP2KqVau3XxUGwJRE33Pxt+bapS20fqqeTET/ OVY/IrDrknKQlbOsyexr8Oq4ndRYUsFF9tcoWTAs3rG1V8W389+BgRs47fwuK4nVEZeEA i0TQpPAvv2LmBl1RqleDnUaz3gggOLV0s7IC5vJ4QsxxSMFMb+4BrK4FIugxX+CoqDDlS gfYQFwQb7gu/fPftpBl2i2QVVzHPHr2Y2KYs7TpHlj2sEaeArCNafS7uJxOljlCtNrA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=suS9bWex; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1C78606A322; Fri, 4 Dec 2026 12:56:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=suS9bWex Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF5F01F000C2; Fri, 4 Dec 2026 12:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389007; bh=aHVWs6veTKOfAGRMS4/bnDCffRcet9ZnstUVhi+NEbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=suS9bWexs7wnbuZFAyyw7isyQdKZjTIEUqnnG7pGnEuZBna5zoEwSKgI+lb3o1MeU r3AVxUvz2Rtx7P+Y2q4EhBuAsjpiTVK25/kcroXJRQWbKJm6Z68H8WFU3qVAe2qUuD hnLSyhIx4SlM0+z6GmPIqeUn3LRzjbm4oSqsQLbo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Takashi Iwai , Sasha Levin Subject: [PATCH 6.1 0831/1059] ALSA: pcm: Use CLASS() for fdget()/fdput() Date: Fri, 4 Dec 2026 19:06:02 +0900 Message-ID: <20261204100705.551207421@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Iwai [ Upstream commit d90950c6a2658ed8cffb4255a5ddba9c831389fe ] Now we have a nice definition of CLASS(fd) that can be applied as a clean up for the fdget/fdput pairs in snd_pcm_link(). No functional changes, only code refactoring. Signed-off-by: Takashi Iwai Link: https://lore.kernel.org/r/20240223084241.3361-2-tiwai@suse.de Stable-dep-of: bedefcbb8a08 ("ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic()") Signed-off-by: Sasha Levin --- sound/core/pcm_native.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 39a5e720c768f..e12f910c6e519 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -2276,28 +2276,22 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) struct snd_pcm_group *group __free(kfree) = NULL; struct snd_pcm_group *target_group; bool nonatomic = substream->pcm->nonatomic; - struct fd f = fdget(fd); + CLASS(fd, f)(fd); if (!f.file) return -EBADFD; - if (!is_pcm_file(f.file)) { - res = -EBADFD; - goto _badf; - } + if (!is_pcm_file(f.file)) + return -EBADFD; pcm_file = f.file->private_data; substream1 = pcm_file->substream; - if (substream == substream1) { - res = -EINVAL; - goto _badf; - } + if (substream == substream1) + return -EINVAL; group = kzalloc(sizeof(*group), GFP_KERNEL); - if (!group) { - res = -ENOMEM; - goto _badf; - } + if (!group) + return -ENOMEM; snd_pcm_group_init(group); @@ -2329,8 +2323,6 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) snd_pcm_group_unlock_irq(target_group, nonatomic); _end: up_write(&snd_pcm_link_rwsem); - _badf: - fdput(f); return res; } -- 2.53.0