From nobody Tue Apr 7 02:54:32 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DECF9280A5B for ; Mon, 16 Mar 2026 14:01:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773669684; cv=none; b=Q4JiwAj1UfkDI9wUQSqfMI88vFqixILSRUs8Rm4Q1v98kwDY93aW4eaar0oEBYPPy6T1+ZQxejmrIzwyfqHsDTkRNFiuUPcvOwJ5sVWaQVk0GFGjIVIjfoHxkCfeU7xcPtlatlDqHOBEtPGHOhIkXPQKZoBaZk9h2+FbINKVRYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773669684; c=relaxed/simple; bh=8V3rRaEbinASkU1E4LwT5DYCKUX2xJLJs2DXJrkSqHE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GxeOlZymKr/Dkfc/k2u/uu1H2LD7yFoHQkEbZb+7gkK4xsUzeeK+7l4tr00As6Ew7piM+xmlOp5QTsuv3IdpSJzbaSnxw42f/g1HZcyG0NqUPl5DKuQuiEQYCnWSsya4Zj28Ywjmixkkds3m5WaLgce8f1VeUlPQJ5JPUsaxaEQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C42kNjB+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C42kNjB+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4476BC19421; Mon, 16 Mar 2026 14:01:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773669684; bh=8V3rRaEbinASkU1E4LwT5DYCKUX2xJLJs2DXJrkSqHE=; h=From:To:Cc:Subject:Date:From; b=C42kNjB+DOlpOn9IPsKKhkHGUEXdC3RsDDG1Dmr7sd2Xo5PAAsfKntUKVQRSey5we MPaE41pWSq0BQzeaF6lyHQ7RlYTfYede6wdIhRLXoL7pSbirxezLtxKbDoL8ufLEsU Mp4DJZRpaw2UCIJxHhQ+ciXr/H0/RkBa1Da6FudBvWYa/kdd9Fn9QQBKgDm5pIzoys A/4n/8SRMgk7+wc+stfHF/jkcbR/iZRuHpmTi3WgqAxmUUiRMRAD7ekoJwanLFxRvz UE5H58jBt/EqRgVvdJ46JHVC9i1ufQtoJw6KRq35RAmb6MduHhI2fT4GE37+ju/vi0 hAhjND180Z2Pw== From: "Lorenzo Stoakes (Oracle)" To: Andrew Morton Cc: Johannes Weiner , Yosry Ahmed , Nhat Pham , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH mm-hotfixes] mm/zswap: add missing kunmap_local() Date: Mon, 16 Mar 2026 14:01:22 +0000 Message-ID: <20260316140122.339697-1-ljs@kernel.org> 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" Commit e2c3b6b21c77 ("mm: zswap: use SG list decompression APIs from zsmalloc") updated zswap_decompress() to use the scatterwalk API to copy data for uncompressed pages. In doing so, it mapped kernel memory locally for 32-bit kernels using kmap_local_folio(), however it never unmapped this memory. This resulted in the linked syzbot report where a BUG_ON() is triggered due to leaking the kmap slot. This patch fixes the issue by explicitly unmapping the established kmap. Reported-by: syzbot+fe426bef95363177631d@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/69b75e2c.050a0220.12d28.015a.GAE@google= .com Fixes: e2c3b6b21c77 ("mm: zswap: use SG list decompression APIs from zsmall= oc") Signed-off-by: Lorenzo Stoakes (Oracle) Acked-by: Johannes Weiner Acked-by: Nhat Pham Acked-by: Yosry Ahmed Reviewed-by: SeongJae Park --- mm/zswap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/zswap.c b/mm/zswap.c index e6ec3295bdb0..499520f65ff0 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -942,9 +942,14 @@ static bool zswap_decompress(struct zswap_entry *entry= , struct folio *folio) /* zswap entries of length PAGE_SIZE are not compressed. */ if (entry->length =3D=3D PAGE_SIZE) { + void *dst; + WARN_ON_ONCE(input->length !=3D PAGE_SIZE); - memcpy_from_sglist(kmap_local_folio(folio, 0), input, 0, PAGE_SIZE); + + dst =3D kmap_local_folio(folio, 0); + memcpy_from_sglist(dst, input, 0, PAGE_SIZE); dlen =3D PAGE_SIZE; + kunmap_local(dst); } else { sg_init_table(&output, 1); sg_set_folio(&output, folio, PAGE_SIZE, 0); -- 2.53.0