From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 D671F1B7910; Wed, 20 May 2026 18:01:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779300062; cv=none; b=YV0zNTOxF95ZlIwGgmQzjPFfbtgjDBrLWiBbjqu63WIJNNoimxrk7q+mNYExj3sG6VzMSC41FQrPWh6RlFGfVQfF2BFA76Jk6mUZMoK0yWjTy6Du1v9p65KTRfAEj4EXtVyLmU/DENnA65yXWvC5b0ODZIc3OGuGeSD2YflWITI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779300062; c=relaxed/simple; bh=VRpKFPqIHWeDBpsrTRQw/b+J9rNUMKOcrpye26XRhOI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UezWqtgsOyTeXmUH4ZxHQfdBWZgEPPaihL8xrVQpw6tj4TEAxrO9h/rEUD2bbibf6CirFjV9l6dV1vh9/SuWkV/KOiWJMe2Nn83WA3Ul7hqpOZr1TL0que12m8zqSFNefe1CqmfOJD/pMsZRDFMWxhVXX7zPNIjA7EwrDhEYR8Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dcqfQSvc; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dcqfQSvc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EC1E1F000E9; Wed, 20 May 2026 18:01:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779300060; bh=zhh14tUVcPIZ6rpWYwChdhm7veMvTYOp041QWvRYaSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dcqfQSvcGbOHJf128uk0qSLlw/KQ19vktw986nLn0wFPUXZihHmJLgAEdBF+1BR/u L1keAQV5LqWqHEMnD6uMB8UINZ45PT8ujqVasdrL+wxiR32l9LnPjEBexrvbJ3vyvy lleEoEJ8D1/5OOySriSHP/gJfKwiqKikRrNFYI54= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Christoph=20B=C3=B6hmwalder?= , Christoph Hellwig , Andreas Gruenbacher , Bart Van Assche , Jens Axboe , Sasha Levin Subject: [PATCH 6.12 006/666] drbd: Balance RCU calls in drbd_adm_dump_devices() Date: Wed, 20 May 2026 18:13:37 +0200 Message-ID: <20260520162111.370251493@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162111.222830634@linuxfoundation.org> References: <20260520162111.222830634@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bart Van Assche [ Upstream commit 2b31e86387e60b3689339f0f0fbb4d3623d9d494 ] Make drbd_adm_dump_devices() call rcu_read_lock() before rcu_read_unlock() is called. This has been detected by the Clang thread-safety analyzer. Tested-by: Christoph Böhmwalder Reviewed-by: Christoph Hellwig Cc: Andreas Gruenbacher Fixes: a55bbd375d18 ("drbd: Backport the "status" command") Signed-off-by: Bart Van Assche Link: https://patch.msgid.link/20260326214054.284593-1-bvanassche@acm.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/drbd/drbd_nl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 8c12bf1b2a0d2..2e985101963e6 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -3377,8 +3377,10 @@ int drbd_adm_dump_devices(struct sk_buff *skb, struct netlink_callback *cb) if (resource_filter) { retcode = ERR_RES_NOT_KNOWN; resource = drbd_find_resource(nla_data(resource_filter)); - if (!resource) + if (!resource) { + rcu_read_lock(); goto put_result; + } cb->args[0] = (long)resource; } } @@ -3627,8 +3629,10 @@ int drbd_adm_dump_peer_devices(struct sk_buff *skb, struct netlink_callback *cb) if (resource_filter) { retcode = ERR_RES_NOT_KNOWN; resource = drbd_find_resource(nla_data(resource_filter)); - if (!resource) + if (!resource) { + rcu_read_lock(); goto put_result; + } } cb->args[0] = (long)resource; } -- 2.53.0