From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.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 CFC0A33AD8C for ; Thu, 6 Aug 2026 14:51:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786027896; cv=none; b=oPig5hU4r/PIGLMc1060czw0scewaIJi7hGJQEvZ5ZorNAC55GwuY6zPI4GgTtcAWEsiga3od/QQg6vcg/Ynynj6wbBb49ulCk0YSgQXHRKGMWxLneYrnvdOL0q3wAhIg2+xPXGdhz7Ww4Lz7SqDwbouSpgWe7pPyoZIx/Vafd8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786027896; c=relaxed/simple; bh=Gm4zNo7nyEAnT3TTokUnwY/mnWxoTFTXubMv/mHPneo=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=XWqOB7Om9MEwJao77SMJ0ksB6sQuUTzVPnlJApRWDDS+kx+0053dk94pRykznPX4VsCxuaK8qViOUIHWEuHw91h2JvVmJbeaE3Je5/0BegqQXMxDtdNgI54MzMKxNgDARYbNSz3tlx9de1BBxVNzStcwyLREcAgrhTioL/59Jbw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Yp3p2i7d; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Yp3p2i7d" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-495437bb891so9763355e9.1 for ; Thu, 06 Aug 2026 07:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1786027893; x=1786632693; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to:content-type; bh=GWpFkxMOaVwGZ0w80zyQ1pa/gmhP6MxYxEbTBlhIS5E=; b=Yp3p2i7dBZL59CsRLcTgTy5EYsDbPruGf31RT5WFWdJJX7B4qpfFcZy+NdaXqvy5Mo UDSTyaDyC0IoNiVaNNX2sRAPJ0UEL9GDZiRL3RfPdOhrTP5US3RSv6C/LI2NVIpo9OfX n2BLsy7qgZx5gpeW98IsQswHIXQ8Me+c7UtTC5lABPx3ldLUNfRw9Mb5W6o6Apwn/THO 2Z763En6rY3i1+BD37ZglkHDdC/m86l0EwmKMUdjtWu1mmeTE635H5Jx1rNorZYrq/Xd xy4RNZ4g2LRMNmGtGhmZd4L/+e+hMeSGSBrZVbnT2TSPHkX//sAe7j2y7zw4upgqRUgK pHhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786027893; x=1786632693; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=GWpFkxMOaVwGZ0w80zyQ1pa/gmhP6MxYxEbTBlhIS5E=; b=BwMNJvsYNJJPkaPBb1MhpHRQB2VWzyV/PnCyySpQwxXSxzXREpF/7cRSIQiyHj89La bwQWmhHPU4MHh2PUftUhA3ay6DfLlpS2TWXgl6DsCRL002DpJqrMJzW6DF7pBTl61jLe IlDZcw0m2ykfzXjKHc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8440mr50043225e9.9.1786027892968; Thu, 06 Aug 2026 07:51:32 -0700 (PDT) Received: from ?IPV6:2a07:de40:8100:0:fc6c:f9a2:4a0a:6354? ([2001:af0:8000:1409:193:86:92:181]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4995421b1e2sm85741405e9.8.2026.08.06.07.51.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Aug 2026 07:51:32 -0700 (PDT) Message-ID: Date: Thu, 6 Aug 2026 16:51:32 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] params: fix charp corruption on allocation failure From: Petr Pavlu To: Jiacheng Yu Cc: samitolvanen@google.com, rusty@rustcorp.com.au, hannes@cmpxchg.org, yosry@kernel.org, nphamcs@gmail.com, liuyongqiang13@huawei.com, linux-modules@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20260729123243.790023-1-yujiacheng3@huawei.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 7/31/26 4:21 PM, Petr Pavlu wrote: > On 7/29/26 2:32 PM, Jiacheng Yu wrote: >> param_set_charp() stores charp parameters in allocated memory after slab is >> available, and releases the previous value when the parameter is updated. >> >> The previous value is released before the replacement allocation succeeds. >> If kmalloc_parameter() fails, the setter returns -ENOMEM with the parameter >> left as NULL. >> >> Failing zswap's compressor update before zswap is initialized can later >> trigger: >> >> BUG: kernel NULL pointer dereference, address: 0000000000000000 >> RIP: 0010:strcmp+0x10/0x30 >> Call Trace: >> zswap_setup+0x3b1/0x490 >> zswap_enabled_param_set+0x5b/0xa0 >> param_attr_store+0x93/0xe0 >> module_attr_store+0x1c/0x30 >> kernfs_fop_write_iter+0x116/0x1f0 >> >> Allocate and copy the replacement first, then replace the parameter value >> only after allocation succeeds. >> >> Fixes: e180a6b7759a ("param: fix charp parameters set via sysfs") >> Cc: stable@vger.kernel.org >> Signed-off-by: Jiacheng Yu > > Looks ok to me. > > Reviewed-by: Petr Pavlu > > I'll give others more time to comment. If there are no further concerns, > I plan to take this on modules-fixes. I've queued the fix on modules-next for v7.3-rc1. -- Thanks, Petr