All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFC: netlink: remove unexpected nfc_put_device
@ 2018-11-27  7:54 Pan Bian
  0 siblings, 0 replies; only message in thread
From: Pan Bian @ 2018-11-27  7:54 UTC (permalink / raw)
  To: Samuel Ortiz, David S. Miller
  Cc: linux-wireless, netdev, linux-kernel, Pan Bian

The functions nfc_genl_llc_set_params and nfc_genl_llc_sdreq drops the
reference to dev via nfc_put_device on the error branch that no local
device is found. However, the error handling block reads dev's field and
then put dev again. This may result in use-after-free bugs. The patch
removes the unexpected call to nfc_put_device.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 net/nfc/netlink.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 376181c..e1f2057 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -1107,7 +1107,6 @@ static int nfc_genl_llc_set_params(struct sk_buff *skb, struct genl_info *info)
 
 	local = nfc_llcp_find_local(dev);
 	if (!local) {
-		nfc_put_device(dev);
 		rc = -ENODEV;
 		goto exit;
 	}
@@ -1167,7 +1166,6 @@ static int nfc_genl_llc_sdreq(struct sk_buff *skb, struct genl_info *info)
 
 	local = nfc_llcp_find_local(dev);
 	if (!local) {
-		nfc_put_device(dev);
 		rc = -ENODEV;
 		goto exit;
 	}
-- 
2.7.4



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-11-27  7:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27  7:54 [PATCH] NFC: netlink: remove unexpected nfc_put_device Pan Bian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.