From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 49052361967 for ; Fri, 24 Jul 2026 05:17:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784870263; cv=none; b=qrteLUXCcxYQyxqFxRYvppovBNhssIfIlgVaBVzxQtA+e7M307sznQc+TdV+6nA6bDQp1wky9AAwS1d9O/HeSmDTJdeyte6Pm6W8ejwDH5knlMkbAfCr/NaQ2/W6qtfhgFcnoiBi0D3U/RBMB9yxmqcZyIPsPkMavRVYqL5E2Zc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784870263; c=relaxed/simple; bh=cnmLRwqhZ7jPzODlxI+gjG7xRflVr6cVqDj4bUvfKFU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VL3Tvb1p3JPcqtvGRqWQbO82weh5L5Ui67nTrnUhpP145aXt3awWRzGNoV09LqVMnAUMy78+03s842L6cc+jqCyZ5Wt82b3BujSyBx+ZRea7kSylWQOjG4kF/XIGUtTBnIqm36klgrl9GQt8dh1suYj/oSdlXGLCRW3dZEM/yHA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=QIDNIoUB; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="QIDNIoUB" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2cea3004256so819765ad.0 for ; Thu, 23 Jul 2026 22:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1784870262; x=1785475062; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=ntnajWJ6p85rD0cr4ir+e1iCPNlwNbliu2B8JzUfLjc=; b=QIDNIoUBhZUfjOGKxiXr1n/BIxRMPQ3IcSRWnRfGeONmjOnahDFBmUim3V3WbDw0c+ gmq1PvY9+S0RDP/JPmRXsgXvoK00/po+ec6AZNWdo4C/fbtH+09eWrvKFuceBnWDg+NU fWP2m6KvZFD6lnAfRz+QAK5BzgPLsDysuJSCo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784870262; x=1785475062; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ntnajWJ6p85rD0cr4ir+e1iCPNlwNbliu2B8JzUfLjc=; b=GOx2PSdsuNo03yOAETviMC1S3q6NajQowYZ1DWSRCegmLa5o2dLCfGOZR+nxlCj9nX PitYbRgITOxXqqkwEWxYYDdI7AJ4yQ949neTyQQsl2BeauSjBHBiyn2lJEK4ywyGFbUb wX9QLgfS+Me9zQ0kNtojL69lsojdD45kCpbRJ6KQu4q7gQXdGoj5iDSYXXnHLgKRZCtv IZhomOz3sugZM7ZasEGGj+uOemG/YXtSiFm0Ivew/axgpN+Dq4DUzUpct1x+11mftpI9 u8p5bE3PRGl9VGWIMq+S+DbRdm8iURUXOMWJ7MmAhY3wLHB7aubNWUpHbOCIFkXwPR9h 1nkQ== X-Forwarded-Encrypted: i=1; AHgh+RqwZl5frSulwzqwtljtLZQMX/TgKk/PbWyW89k9mHAL7ZWUlGfzQNOToUnQhYyR8wURrwIMI3HX7DPbBL4=@vger.kernel.org X-Gm-Message-State: AOJu0YwHUK5SqaIIMsByum4af3I9R5WTJTPokzxW9j4SEDFUQUq8hD8Z diJq10ocPxMc6z7x0DLz2WqxcP+H1dfrn8WuiY1IMFT07FJ+tPuwfi7Ioa+2H7Dghw== X-Gm-Gg: AR+sD11qiXhGdAbfB+z9PwCFXb6cqI3rjkbyLFyNyizSIPp/84BXj+Wc9loThI5Q5sk Jcyq5wT+S5Rl29vL8vIHgA/Fl60DPHEHFreit62I+hYnM2/HRRL385RoQGc1/9aSO0Z0/44kJv8 9+1KAnZgAXh5bwRD48I8ydyEMyKa6Dwl45bv3fWUzBk4n52YYoU+RvmZ7Mya85genF1aFdQOPaZ Kj51z9nqFj6kcTU7K1XihKawKSuGPi4G2WTeUnOv1KjmYnJ5gRhtNIhrY3p+hgHKYiR0mmsFq+Y yLh3gEGsLXhiOYM/PDtRuyrMZpNmhanJbalvsIwZLPqSyj2I4j3yh6/OKiSkgWW8U5iYZbvwinR l/uso8XLBMBI1jZMjltwL3J04ae+rIlY9ISvrZAWfhJ/hhDUlnZD2+WvHSC7c86a/8CrPX+xhSP 1VmMcOMyEASkWZeDGmzYpGjuPhBcedXzBL9bSIiXnKEQ== X-Received: by 2002:a17:903:1250:b0:2c8:25c8:85a6 with SMTP id d9443c01a7336-2cfa6a43936mr74219335ad.2.1784870261655; Thu, 23 Jul 2026 22:17:41 -0700 (PDT) Received: from google.com ([2a00:79e0:2031:6:c102:f12d:5168:6be5]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf8f00a6f5sm45045945ad.37.2026.07.23.22.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 22:17:41 -0700 (PDT) Date: Fri, 24 Jul 2026 14:17:37 +0900 From: Sergey Senozhatsky To: Haoqin Huang Cc: minchan@kernel.org, senozhatsky@chromium.org, axboe@kernel.dk, terrelln@fb.com, dsterba@suse.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, rongwei.wrw@gmail.com, Haoqin Huang , Rongwei Wang Subject: Re: [PATCH 1/3] zram: fix zstd dict use-after-free on per-CPU error path Message-ID: References: <20260627070216.13511-1-haoqinhuang7@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260627070216.13511-1-haoqinhuang7@gmail.com> On (26/06/27 15:02), Haoqin Huang wrote: > zstd_setup_params() creates global cdict and ddict stored in > params->drv_data, shared across all per-CPU contexts. When a > per-CPU zstd_create() failed, its error path called > zstd_release_params() which freed those shared objects while > other per-CPU contexts might already hold references to them. zstd_release_params() sets ->drv_data to NULL so we can free params only once. In addition, "while other per-CPU contexts might already hold references to them" -- other CPUs cannot do anything with those params, the device is not setup and we cannot handle any IO requests, right? There is no double-free nor UAF there as far as I can tell. > Remove the premature zstd_release_params() from the per-CPU > error path, the global cdict/ddict are properly released later > by zstd_release_params(), called from zcomp_init()'s cleanup > or from zcomp_destroy(). > > Fixes: 6a559ecd6e7e ("zram: add dictionary support to zstd backend") What exactly does this fix?