From nobody Thu Sep 24 15:13:01 2026 Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C635C552955 for ; Tue, 22 Sep 2026 13:26:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.154 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790083608; cv=none; b=C+DAGsFvl4cGa7vFNLU6qNMkt7TmD9LG69v134/N0nbwEW+6Vc/h7HbeGlfmf+4blwNTjMHr69yLS3ER1ehf9pctmsNc1KQBsSl/5RAFF1JfxsVudPhkc2+ZwdDvOVJ15GavmL4cP/uosSm68ECUV4KqFpSsZ28C8vJORpCqOvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790083608; c=relaxed/simple; bh=cpbOg0Un1sVbo7wYoe1EUrwQGxSNEVk/4dUbdqTIo0c=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OozR6ywirfKHG4e4n0n+eD498GdXdXgdqG9t9HtNhTMPtQ3i6vexoYmzQwfbmvCYHfjEloeKYQPs9M2Gp6l+983q5aY4FztExb1iBZonzd3rE4lh8mGTS9CTT96xxPbjsiyCL/WDB6epCrMaYCzfE3wl/WQ+JkETCOCD3nTAMy8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp; spf=pass smtp.mailfrom=sakamocchi.jp; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b=iO11uE/f; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=kTcO1OK9; arc=none smtp.client-ip=103.168.172.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="iO11uE/f"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="kTcO1OK9" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id C400A140007C; Tue, 22 Sep 2026 09:26:44 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Tue, 22 Sep 2026 09:26:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm1; t=1790083604; x=1790170004; bh=tnpUKcHkVi O6Ps+B7HUcLM/JGwZ+2mee55HFrU1wBUs=; b=iO11uE/fGkj3yygX6IYPDQVJZ8 InVTtKlkMkOUKhiau6jJ/h6FOQAv2HV7/GVPU2xg5QdTZ5ih8hjuTHvLeG5mMgLV VYPSF+jBEMdb/5XXZkPn5DH2QEHwYytI1+0QsuHXtaqg9hH9VTDBUxFIk4dFeZ1M cSJcXldOknVANomoI2SCouE4HI2PomuDh3yhsx68KEZ4mAQMf0efTWumdZ0Yfy6T PSARKeMu4XWLMVzC43MeKi1QwO0wjjHgYl+nYmX5iEWzC/t91UHIKLMxXzGqDsmf l0YttspIEcnKpKwI7VhhNYSKsZUAkXXQTR5CQ6PJmphvThqNCXdBK37vsXEA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1790083604; x=1790170004; bh=tnpUKcHkVi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pAPkPSfsEU+3SXXYIkCQkwFz6j0Q X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 22 Sep 2026 09:26:43 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org Subject: [PATCH] firewire: cdev: fix back-transition for iso_resource_auto client resource Date: Tue, 22 Sep 2026 22:26:39 +0900 Message-ID: <20260922132639.191593-1-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The todo member of iso_resource_auto structure represents the state of the client resource and normally transitions in the following order: ISO_RES_AUTO_ALLOC -> ISO_RES_AUTO_REALLOC -> ISO_RES_AUTO_DEALLOC However, concurrent access from the work item and the file descriptor release function can cause the state to transition backwards from ISO_RES_AUTO_DEALLOC to ISO_RES_AUTO_REALLOC. Prevent the back-transition by checking the current state before updating it in the work item. Fixes: fcabbf40fae5 ("firewire: core: move allocation/reallocation paths in= to specific branch after isoc resource management in cdev") Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-cdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index e49d8a58be09..664952a67a11 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -1397,8 +1397,10 @@ static void iso_resource_auto_work(struct work_struc= t *work) } else { // Transit from allocation to reallocation, except if the client reques= ted // deallocation in the meantime. - scoped_guard(spinlock_irq, &client->lock) - r->todo =3D ISO_RES_AUTO_REALLOC; + scoped_guard(spinlock_irq, &client->lock) { + if (r->todo =3D=3D ISO_RES_AUTO_ALLOC) + r->todo =3D ISO_RES_AUTO_REALLOC; + } =20 if (channel >=3D 0) r->params.channels_mask =3D BIT_ULL(channel); --=20 2.53.0