Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1655418 > unrolled thread

[PATCH 3.16 073/212] w1: don't leak refcount on slave attach failure in w1_attach_slave_device()

Started byBen Hutchings <ben@decadent.org.uk>
First post2017-06-01 18:30 +0200
Last post2017-06-01 18:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.16 073/212] w1: don't leak refcount on slave attach  failure in w1_attach_slave_device() Ben Hutchings <ben@decadent.org.uk> - 2017-06-01 18:30 +0200

#1655418 — [PATCH 3.16 073/212] w1: don't leak refcount on slave attach failure in w1_attach_slave_device()

FromBen Hutchings <ben@decadent.org.uk>
Date2017-06-01 18:30 +0200
Subject[PATCH 3.16 073/212] w1: don't leak refcount on slave attach failure in w1_attach_slave_device()
Message-ID<tNB90-4UR-39@gated-at.bofh.it>
3.16.44-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>

commit d2ce4ea1a0b0162e5d2d7e7942ab6f5cc2063d5a upstream.

Near the beginning of w1_attach_slave_device() we increment a w1 master
reference count.
Later, when we are going to exit this function without actually attaching
a slave device (due to failure of __w1_attach_slave_device()) we need to
decrement this reference count back.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Fixes: 9fcbbac5ded489 ("w1: process w1 netlink commands in w1_process thread")
Cc: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/w1/w1.c | 1 +
 1 file changed, 1 insertion(+)

--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -749,6 +749,7 @@ int w1_attach_slave_device(struct w1_mas
 		dev_err(&dev->dev, "%s: Attaching %s failed.\n", __func__,
 			 sl->name);
 		w1_family_put(sl->family);
+		atomic_dec(&sl->master->refcnt);
 		kfree(sl);
 		return err;
 	}

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web