All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: gregkh@linuxfoundation.org, rafael@kernel.org, saravanak@google.com
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH] driver core: Fix a reource leak in 'fw_devlink_create_devlink()'
Date: Sun, 24 Jan 2021 07:32:53 +0100	[thread overview]
Message-ID: <20210124063253.720637-1-christophe.jaillet@wanadoo.fr> (raw)

In 'fw_devlink_create_devlink()', all exit paths, successful or not,
release the reference taken on 'sup_dev'.
All but this one.

Use the existing error handling case to call the missing 'put_device()'.

Fixes: f9aa460672c9c ("driver core: Refactor fw_devlink feature")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Speculative and compile tested only
---
 drivers/base/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index e08d376631cc..8775717a6bf7 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1623,8 +1623,10 @@ static int fw_devlink_create_devlink(struct device *con,
 	 * cycles. So cycle detection isn't necessary and shouldn't be
 	 * done.
 	 */
-	if (flags & DL_FLAG_SYNC_STATE_ONLY)
-		return -EAGAIN;
+	if (flags & DL_FLAG_SYNC_STATE_ONLY) {
+		ret = -EAGAIN;
+		goto out;
+	}
 
 	/*
 	 * If we can't find the supplier device from its fwnode, it might be
-- 
2.27.0


WARNING: multiple messages have this Message-ID (diff)
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: gregkh@linuxfoundation.org, rafael@kernel.org, saravanak@google.com
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH] driver core: Fix a reource leak in 'fw_devlink_create_devlink()'
Date: Sun, 24 Jan 2021 06:32:53 +0000	[thread overview]
Message-ID: <20210124063253.720637-1-christophe.jaillet@wanadoo.fr> (raw)

In 'fw_devlink_create_devlink()', all exit paths, successful or not,
release the reference taken on 'sup_dev'.
All but this one.

Use the existing error handling case to call the missing 'put_device()'.

Fixes: f9aa460672c9c ("driver core: Refactor fw_devlink feature")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Speculative and compile tested only
---
 drivers/base/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index e08d376631cc..8775717a6bf7 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1623,8 +1623,10 @@ static int fw_devlink_create_devlink(struct device *con,
 	 * cycles. So cycle detection isn't necessary and shouldn't be
 	 * done.
 	 */
-	if (flags & DL_FLAG_SYNC_STATE_ONLY)
-		return -EAGAIN;
+	if (flags & DL_FLAG_SYNC_STATE_ONLY) {
+		ret = -EAGAIN;
+		goto out;
+	}
 
 	/*
 	 * If we can't find the supplier device from its fwnode, it might be
-- 
2.27.0

             reply	other threads:[~2021-01-24  6:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-24  6:32 Christophe JAILLET [this message]
2021-01-24  6:32 ` [PATCH] driver core: Fix a reource leak in 'fw_devlink_create_devlink()' Christophe JAILLET
2021-01-24  8:56 ` Saravana Kannan
2021-01-24  8:56   ` Saravana Kannan

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=20210124063253.720637-1-christophe.jaillet@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=saravanak@google.com \
    /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 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.