From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E73633B6F9 for ; Thu, 7 May 2026 23:37:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778197076; cv=none; b=rvHEtj7h9ATIQmUeXFhDXoWY2XBPH+5Lxyx9OJR4cdmdGmXmlGMrU0t1PjupZh0wa7PAKvVkc5M8Z8XgUokeq9pdpNHLOSNfkEzhoKBFKf23tGiPK633dsH+zoeGrXFr9n9peaaLFz7OG+NeJYRfWfCt/Bwn6+lBPqgVpiiUByU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778197076; c=relaxed/simple; bh=dymaywSsJ8bL9nKxldKN+amZarY0Rc3i6Hw2CU/N3Rc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nWQ/yYq2lVIVR1H6KMLv2WDLuW5One7l28rt4NDtqx9fF5zFLFBLcTtPpdaVxy1Ar3oO0t4nGyZC+7ltXYlo51zezmj1srW2a23Be4bVdPFP5v8IduFXjvYO0JcFXyov0RSPjAjko7cpd+juedSo0dShJizKG4nAlXr2p1vcIAE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OcGDhBBK; arc=none smtp.client-ip=209.85.160.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OcGDhBBK" Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-42c035bb2f1so112194fac.2 for ; Thu, 07 May 2026 16:37:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778197074; x=1778801874; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=evwJ3WUGDeN11ruEycjl7by7AWSkCxsRcEiQqBCjgN4=; b=OcGDhBBKvvC8JXYhHlIolDtuF3pQwUJKAMYyIaBVZHx6WM0yorg+lKAbZ/CiWReDFf g93WwYjgxX83uCKiV0PbgXnkskPnatfr0TKfgylOSC5AtIEfnGu4JhNUnza1d9ljtxwy nO1CDNp3/wpxVlEljP50kSTiHkIlTpWpa6Ws//CiZlqB3MPNoCGnIFYBlnWW0M/fDeql VzSIOi2f/yy2R1uwpjyYcMSqwrFhsV7SDC7tUx/2Nnph9PLsXLuDpf3SrFhiDMQA0BCq ALtG6BqTAjObumtLqb4tJWDn/WWgJkC8toBOKyg32Nt8BC2l2UlYWwXiZZVsV7PFy3tE B5lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778197074; x=1778801874; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=evwJ3WUGDeN11ruEycjl7by7AWSkCxsRcEiQqBCjgN4=; b=pHs/qH+ELDGdpqAW5aMfzLmMMztjIof5aoah+EflhrJUlXwtrcLFtWD8UiNuXSsnNo Be3UqrH67uUeG9JvVLZX69VWCSOalBYuvgItC4B9map74zIIg1r7VVNQGrsIlFEujLDr h0ppUhcycvXzoMzOzNJY6t7opRlGJWBqxJNqH2TOm6JRMQbnB3fGF3sIQFOADw/BAd3+ TWxPlTifu94bUEaapOtjfhutSzwFrPg2wJ8PEu4K7xkvYUE0q1zDAyD0RWLaoccZe6OX a2wj4RYYw7zROYPn0zHkRh2DhTQt598AQnATZd7+5+ECC7nfZGjO+Xoja6vqH29ylUOD Olew== X-Forwarded-Encrypted: i=1; AFNElJ81id2d6ayvd2LRWzidfTNtUC9BcK/WsHjoxTGpa0cD5f/KSL3c9fhhWdCDhcnPfywY56SQcr76DyvMbbU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6ouEGbE8SQsjlI+lbkSb2MQ9huhFeQTZ4MfzkQIgnW5FwRE6V hUwnkL5zMvzGVqw993NCyAui/ZWzEGL+9Ij9GxL2pheHgRR5W0csjWxq X-Gm-Gg: AeBDies6nGa1+TOYZnwmCGGHK9gjMUMXIUn4ZubxbjW+E4LmW21v61loh4yglPmf2Cs RhBVcTWbLuSTD49EMe36SQH5k70YWxWA6Q9PIwsM1udd2nGJ0ihHMOQj0PwajdLiHKKiYjAtv/J nKUpAq0woRB4NcabOYLdOc31RU3FWsRycurUSoKvxVD9fI9iFxM6Wvb55vYk5Ok04MfGc4UYKpN XPEKaLykEifMwmQSK7ZKp0sYNEyAgP9XkU/f76inILmhIvHVzWxha0Qcz/5iNLA/UyJi2GFyFcP Z7zuCMYod7JJ2KyOqxVxFZrm6bN5pMzNcKgG1XejXNjQQu6WWL+gWnrDyOzoexGDzQYhQxMIkXi XOJXl7KFjwVUlBQhaZNPUr3measK6/JXcMmzCuc/uDfVQGnVLBPqLGVonuu4UmRWAM3beZFohcN 2Kq4bBRiU/KotqC8fQbi99Ff65SocvzTWdLHhzRE1hGGLfHjromdMurZbpiTdmJoewYHd4ujtnZ OdS/rKlaCgfvXHfVI59e7yIGaGHQGggpTg= X-Received: by 2002:a05:6830:d1a:b0:7dc:d390:4999 with SMTP id 46e09a7af769-7e1df0d2f3bmr4084450a34.6.1778197074200; Thu, 07 May 2026 16:37:54 -0700 (PDT) Received: from localhost ([136.49.184.116]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e367d8fd96sm78980a34.19.2026.05.07.16.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2026 16:37:53 -0700 (PDT) From: Aaron Esau To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, davem@davemloft.net, stable@vger.kernel.org, linux-kernel@vger.kernel.org, Aaron Esau Subject: [PATCH] crypto: acomp - fix dst-folio branch setting src instead of dst in acomp_virt_to_sg Date: Thu, 7 May 2026 18:37:48 -0500 Message-ID: <20260507233748.327004-1-aaron1esau@gmail.com> 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: 8bit In acomp_virt_to_sg(), the dst_isfolio branch calls acomp_request_set_src_sg() instead of acomp_request_set_dst_sg(). This overwrites req->src with the destination folio SG and leaves req->dst holding a raw struct folio pointer (via the src/dst union). The algorithm then reads from the wrong buffer and dereferences the stale folio pointer as a scatterlist. The bug is reachable from UBIFS decompression on systems with a hardware compression accelerator (HiSilicon ZIP, Intel IAA, Intel QAT), where crypto_alloc_acomp() selects the hardware driver over scompress. Software scompress backends are unaffected because they set CRYPTO_ALG_REQ_CHAIN and bypass acomp_virt_to_sg() entirely. Fixes: 8a6771cda3f4 ("crypto: acomp - Add support for folios") Cc: stable@vger.kernel.org Signed-off-by: Aaron Esau --- crypto/acompress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/acompress.c b/crypto/acompress.c index f7a3fbe54..5a8b0cf3a 100644 --- a/crypto/acompress.c +++ b/crypto/acompress.c @@ -237,7 +237,7 @@ static void acomp_virt_to_sg(struct acomp_req *req) sg_init_table(&state->dsg, 1); sg_set_page(&state->dsg, folio_page(folio, off / PAGE_SIZE), dlen, off % PAGE_SIZE); - acomp_request_set_src_sg(req, &state->dsg, dlen); + acomp_request_set_dst_sg(req, &state->dsg, dlen); } } -- 2.53.0