linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wen Yang <wen.yang99@zte.com.cn>
To: linux-kernel@vger.kernel.org
Cc: wang.yi59@zte.com.cn, Wen Yang <wen.yang99@zte.com.cn>,
	Douglas Miller <dougmill@linux.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: [PATCH 2/3] net: ibm: fix possible object reference leak
Date: Fri, 22 Mar 2019 11:04:08 +0800	[thread overview]
Message-ID: <1553223849-7143-2-git-send-email-wen.yang99@zte.com.cn> (raw)
In-Reply-To: <1553223849-7143-1-git-send-email-wen.yang99@zte.com.cn>

The call to ehea_get_eth_dn returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
./drivers/net/ethernet/ibm/ehea/ehea_main.c:3163:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3154, but without a corresponding object release within this function.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Douglas Miller <dougmill@linux.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/ibm/ehea/ehea_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index 3baabdc..90b62c1 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -3160,6 +3160,7 @@ static ssize_t ehea_probe_port(struct device *dev,
 
 	if (ehea_add_adapter_mr(adapter)) {
 		pr_err("creating MR failed\n");
+		of_node_put(eth_dn);
 		return -EIO;
 	}
 
-- 
2.9.5


  reply	other threads:[~2019-03-22  3:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22  3:04 [PATCH 1/3] net: xilinx: fix possible object reference leak Wen Yang
2019-03-22  3:04 ` Wen Yang [this message]
2019-03-24  1:21   ` [PATCH 2/3] net: ibm: " David Miller
2019-03-22  3:04 ` [PATCH 3/3] net: ethernet: ti: " Wen Yang
2019-03-24  1:22   ` David Miller
2019-04-05  8:27   ` [PATCH 3/3] " Markus Elfring
2019-03-24  1:21 ` [PATCH 1/3] net: xilinx: " David Miller
2019-04-05  7:54 ` Markus Elfring
2019-04-05  8:13   ` Dan Carpenter
2019-04-05  9:18     ` [1/3] " Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1553223849-7143-2-git-send-email-wen.yang99@zte.com.cn \
    --to=wen.yang99@zte.com.cn \
    --cc=davem@davemloft.net \
    --cc=dougmill@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=wang.yi59@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).