ceph: avoid putting the realm twice when decoding snaps fails
authorXiubo Li <xiubli@redhat.com>
Wed, 9 Nov 2022 03:00:39 +0000 (11:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:41:00 +0000 (17:41 +0100)
commit2f6e2de3a5289004650118b61f138fe7c28e1905
tree598b995b9e4e6a5fbedf5e9482db47417251b232
parent8bef55d7934dca945376af8fef988d94c55cfe1d
ceph: avoid putting the realm twice when decoding snaps fails

[ Upstream commit 51884d153f7ec85e18d607b2467820a90e0f4359 ]

When decoding the snaps fails it maybe leaving the 'first_realm'
and 'realm' pointing to the same snaprealm memory. And then it'll
put it twice and could cause random use-after-free, BUG_ON, etc
issues.

Cc: stable@vger.kernel.org
Link: https://tracker.ceph.com/issues/57686
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ceph/snap.c