From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 CE4E038E5C8 for ; Mon, 22 Jun 2026 08:42:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782117729; cv=none; b=F1mDOpYaO0LpTEISUIRgMf+5bIuMEENVvvR75tqdREJfpmuJfq1HtmJSXDzb5zXFOIif67oT9HktmTahyK4O6cKF3RNXkOaJG2fSSLrUFw5tEbLZv7LWlK6QgHXjF9EnH22t3PQZO2/LueE0nCaZqWJ2S6EuQIGOuQklWbsJk+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782117729; c=relaxed/simple; bh=9x5gGNzm/CgGZAAOloa8x0P1VWHqZMFZ/VdZWA1YZ6w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=os+YjCjInkIwkxQ1gTPlkiTIFJQXDwe/BtONERzA4Kriz5g/5okDxuTU5nMp0DZVPpoH4F7tgYF7EpfM6h2tzetAUmj3oX2kQ6mrHPRwsQKniuBR63NG+l5m4Bi84hmfSAO9Y0Rq0vPjl3PUCDAHcr5jvBypqO05Rt5J+sFpLiA= 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=opuuB+Hx; arc=none smtp.client-ip=209.85.208.54 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="opuuB+Hx" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-697ad7f663cso1043069a12.1 for ; Mon, 22 Jun 2026 01:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782117726; x=1782722526; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nXaROWcX8niDcdghF4hGnIFPotv9p/zfW7hZ5AJ/2K4=; b=opuuB+HxngSE3Do/YXmHDTC8bysWZY9NQ19bjbyLlC8UhNNhm+Zd+n4AtyZLjVwPb0 98k8cp2E3LR6pJCQ1yqKLtEkyiKBQqeeMQSNBuaUp0oMJBg/4EASnswagg3eG2VWaN+F 4zpTBEEWUsUrda/Gy41TMZfy7WW7GO73EJksQF4+DQrm9nb4kF3Zrv3PvBcAjH3BX5rJ wRuj4SH5VuodQLdT97SfVh/tFq7u05VWW3YMhewsL/HP/BfAf6fPeyPlryHzw2Yt/Ybx 5J2YJ3sswelKyC7pSt5kDWq4X+Z+3Z7OLmaXQ9x1rDodi/hljTMl8RXa0q1NGTjAEFjt hgeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782117726; x=1782722526; h=in-reply-to:content-disposition: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; bh=nXaROWcX8niDcdghF4hGnIFPotv9p/zfW7hZ5AJ/2K4=; b=jtlFA5CvGqbPiWpkwyeP0dyd+dYvlSFmYXeu8FK9Eq42j/BCJslwa880o6Yp2P9Hpg SBzhyorqLkuA6aUYe8eGY93pQlM7PhmX6WMAH+wLmO+0/mqJaqgofQqbXQZduXko/nQF I0uAyl7ooXFnPVIRiSHFcwSpSzbLfrlneuR2uVITYN2gqxTSwj0+gFZExe4jOm21Ow2B kSnfdLo3yD0njyH2nLuKZkCXUzou0YhrLyWG9CdMcTrC2QfRiWBPdfglsBuIcf5utafo UN3VWA90L6EOL822AflbFUgUenckDV+PdomKGY1e92wyjdHPtGdGl98ZVyWUV7A2Bukc MkKw== X-Forwarded-Encrypted: i=1; AFNElJ+RsqxbSiY5V6HR98r0KRKF8LTIBIm7GY19KY1pUA5OGejkfpxu7g/L8iYp1gOmY/o7l7hjrhszYtvFyIQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2r0y5QCy7ZiN9dcp1B8P79nnbQ1vGHRFtSOMm2A8gdg1aFNFv +SAKd+J8QkBoSOMTFKFX6mExf72vkHXd39M+jBTnNf0m9WwYd1TBpJCLuljH+Dg3 X-Gm-Gg: AfdE7cke+kVw2TqaKrBH6FbQbAvcTtLd2tSrKDk4l6U2Zhkh2JBqQ+eQckajlD1INsV gsZVR1SsfBNrh6fwzRxX+Wm9jE0Hs8fN87DDUeujVjsmyz4SruaSMRJDoNRKgtK8amePKnGcW7o c+NuwDHI3Dyy2pAEJex9hNsuGw0qn/KsSwDbUAYrZIr8ut6aYaU30UO6qO1QeHBZkBlyNqyi5Ta gc27ZBt9bHiNeXjmo+PUJ0N46oU5QegsRWwQTpnfko99h1QGNFEsMrpCMiG5n0rFbUXZ+88hRqs 1r2wrTKe90etpZStk0XtqYx2LkLHUvr+6g1dMeEjJl+vreKVmPt8/iGbv10RRd+X384DSgv2/xn VsKslJp0rgYlMaojABpEP/z72nkw/3ByQ7bF+SUcHX5omEDzHAaZx0isqZbLOhcuE3kWSCBbMBL mlZc2PoesD X-Received: by 2002:a17:907:c01c:b0:bec:687f:6603 with SMTP id a640c23a62f3a-c097c0af677mr640172966b.28.1782117726151; Mon, 22 Jun 2026 01:42:06 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6977be30b35sm2545215a12.16.2026.06.22.01.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2026 01:42:05 -0700 (PDT) Date: Mon, 22 Jun 2026 11:42:01 +0300 From: Dan Carpenter To: Sajal Gupta Cc: linux-raid@vger.kernel.org, song@kernel.org, yukuai3@huawei.com, tomasz.majchrzak@intel.com, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, me@brighamcampbell.com, linux-kernel-mentees@lists.linux.dev Subject: Re: [PATCH] md/raid5-ppl: convert pending_flushes from atomic_t to refcount_t Message-ID: References: <20260622080656.22786-1-sajal2005gupta@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: <20260622080656.22786-1-sajal2005gupta@gmail.com> On Mon, Jun 22, 2026 at 01:34:32PM +0530, Sajal Gupta wrote: > The old atomic_t based counter allowed ppl_do_flush() to continue using io > after it could already have been freed by ppl_io_unit_finished(), leading > to a use-after-free. > > Convert pending_flushes from atomic_t to refcount_t with a proper ownership > model. The creator holds a reference for the duration of ppl_do_flush(), > and each submitted flush bio holds a reference until its endio callback > runs. This makes the io lifetime explicit and removes the need for the > second loop in ppl_do_flush(). > > Fixes: 1532d9e87e8b ("raid5-ppl: PPL support for disks with write-back cache enabled") > Reported-by: Dan Carpenter > Closes: https://lore.kernel.org/all/ajJF2wKYWRk4GGCK@stanley.mountain/ > Signed-off-by: Sajal Gupta > --- Have you tested this at all because it doesn't seem at all correct to me... regards, dan carpenter