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=1796279832; b=4xSwTmY5e2xJjUxaZqjHpU8cY2daMjpZFUSh/OllYSCOLYZb0Q2G8LvAEGbGhq7I2A7h tRLewxO2HtJTEZW6WzNBh3Di704YNFlJoYZu2TT2FgEudXqqugUY1H2QOYmPj+nuCyNU2 R+m4e5kCprRjsjqVxW9lv/Y5usBWYagL+i5Jo1IHmzWLw8xYvIYON6wOzxHXqMMUhyto2 MIWDBUj7wYvlowJgbpezBalSPs9UnPwBzP2oh4Xe2LyCux1SH5/Boacf8+wZY/bz5HEta idnOJ98aAF4FYIpnBUPfm5Ua5lujl7g5XxYXIMUfINd/iztf/wGImRcP6uR4CxftyuQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796279832; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=G7+Gl1ulVwjcYdYZDFHslUDm2c+lDtvVy6XwS5+OIIA=; b=YzR8rDTD7mhWOrM7pHPIeaxeQTEP2SWbscl2InrmmZP0KnDI91EFBQkOm78DNsbtRxwR Ug3qUOUhljyQ4fEoqhom7jdoDFI2/aJmKC04rmvrVu0TzSo7sDFNB11qxooIx/soDegKD DXge7U1MGOMUeYHuBzkLdvXwkztMYu1L9ZLtIwltotX6WQ2ma7C/xWEZz+644Mqj/GOHQ DfGD891jBL/BcNxyetOj3004ckeE3dMhY9bJ1plyxban3iRMmGMyye+dcgPZYi5hTB9mA AUV9GXVX2+klrcs6y9MYYzaBtDGWx3qqS0QXtKbjAijFyu+ii8NrmiHhrlm9suZcJtw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hd5l7tUH; 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 E4AC1606A322 for ; Thu, 3 Dec 2026 06:37:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hd5l7tUH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BB421F00893; Thu, 3 Dec 2026 06:37:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796279831; bh=G7+Gl1ulVwjcYdYZDFHslUDm2c+lDtvVy6XwS5+OIIA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=hd5l7tUHqbrRIjw8CYbC611Em3aWumWfXBykvBdf7PtMfQOaJ55ud0vkmBKxbl22o e4thGMCPCRfz+/qb20C8Ngt7cTz5nrNVncqu7cSkTob8r8nVlE2B9UT9Go5AtJPGQf kH0Ioq85BrRuDpvnKkUBuEIcDB9dLq+99a0flNEN/m7S5ZNw1xYjNS/jsa18CBhrx8 WrgcQls9iziVxkytE4INXe8kR1nLzXM+PC4JOvsb1w2YQsJ6aLueQq9CynM0hqKNAT kilkW7ZwTxUwW1yF4jA7wIajOAShvWCQtNx/d9jvkCITR2Bbz88CKsv4n1WELOKmJK XvHjbMVoyU2Bw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] s390/zcrypt: Put the opened zcdn device in zcrypt_release() Reply-To: sashiko-reviews@lists.linux.dev To: "Yige Jiang" Cc: linux-s390@vger.kernel.org, "Heiko Carstens" , "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" In-Reply-To: <20261203032056.db46df7057fc.zcrypt-zcdn@gmail.com> References: <20261203032056.db46df7057fc.zcrypt-zcdn@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 06:37:10 +0000 X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > zcrypt_open() keeps the device reference returned by > find_zcdndev_by_devt() and stores a pointer to that device's permissions > in filp->private_data. zcrypt_release() instead looks the device up > again by its devt and drops two references on the result. >=20 > If the original zcdn device is destroyed while the file is open, the > lookup can find no device or a new device using the same minor. The > original reference then leaks. In the latter case the replacement > device also loses a reference it never handed out, which can cause > use-after-free when it is subsequently destroyed. >=20 > Recover the originally opened device from filp->private_data and put > only that device. The global ap_perms pointer identifies files for > which zcrypt_open() took no zcdn reference. >=20 > Fixes: 00fab2350e6b ("s390/zcrypt: multiple zcrypt device nodes support") > Cc: stable@vger.kernel.org > Signed-off-by: Yige Jiang Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203032056.db46= df7057fc.zcrypt-zcdn@gmail.com?part=3D1