mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] w1: Fix refcount leak in netlink connector
@ 2014-03-08 23:08 Richard Weinberger
  2014-03-23  6:33 ` David Fries
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Weinberger @ 2014-03-08 23:08 UTC (permalink / raw)
  To: zbr; +Cc: linux-kernel, Richard Weinberger

If userspace sends a w1 message of length 0 we leak
the refcount.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/w1/w1_netlink.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c
index 40788c9..7131777 100644
--- a/drivers/w1/w1_netlink.c
+++ b/drivers/w1/w1_netlink.c
@@ -355,7 +355,7 @@ static void w1_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 
 		err = 0;
 		if (!mlen)
-			goto out_cont;
+			goto out_dec;
 
 		mutex_lock(&dev->mutex);
 
@@ -384,10 +384,11 @@ static void w1_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 			mlen -= cmd->len + sizeof(struct w1_netlink_cmd);
 		}
 out_up:
+		mutex_unlock(&dev->mutex);
+out_dec:
 		atomic_dec(&dev->refcnt);
 		if (sl)
 			atomic_dec(&sl->refcnt);
-		mutex_unlock(&dev->mutex);
 out_cont:
 		if (!cmd || err)
 			w1_netlink_send_error(msg, m, cmd, err);
-- 
1.8.4.2


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

end of thread, other threads:[~2014-03-23  6:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-08 23:08 [PATCH] w1: Fix refcount leak in netlink connector Richard Weinberger
2014-03-23  6:33 ` David Fries

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