mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] block/drbd/drbd_debugfs.c: Protect &connection->kref with resource->req_lock
@ 2019-11-26  4:34 kc27041980
  2019-11-26  9:57 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: kc27041980 @ 2019-11-26  4:34 UTC (permalink / raw)
  To: Philipp Reisner, Lars Ellenberg, Jens Axboe
  Cc: drbd-dev, linux-block, linux-kernel, KC27041980

From: KC27041980 <kc27041980@gmail.com>

Protect &connection->kref by moving it under resource->req_lock.

Signed-off-by: KC27041980 <kc27041980@gmail.com>
---
 drivers/block/drbd/drbd_debugfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_debugfs.c b/drivers/block/drbd/drbd_debugfs.c
index b3b9cd5..f6d75fa 100644
--- a/drivers/block/drbd/drbd_debugfs.c
+++ b/drivers/block/drbd/drbd_debugfs.c
@@ -363,11 +363,15 @@ static int in_flight_summary_show(struct seq_file *m, void *pos)
 	struct drbd_connection *connection;
 	unsigned long jif = jiffies;
 
+	spin_lock_irq(&resource->req_lock);
 	connection = first_connection(resource);
 	/* This does not happen, actually.
 	 * But be robust and prepare for future code changes. */
-	if (!connection || !kref_get_unless_zero(&connection->kref))
+	if (!connection || !kref_get_unless_zero(&connection->kref)) {
+		spin_unlock_irq(&resource->req_lock);
 		return -ESTALE;
+	}
+	spin_unlock_irq(&resource->req_lock);
 
 	/* BUMP me if you change the file format/content/presentation */
 	seq_printf(m, "v: %u\n\n", 0);
-- 
2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-26 10:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26  4:34 [PATCH 1/1] block/drbd/drbd_debugfs.c: Protect &connection->kref with resource->req_lock kc27041980
2019-11-26  9:57 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome