netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: davem@davemloft.net, netdev@vger.kernel.org, nic_swsd@realtek.com
Cc: Oliver Neukum <oneukum@suse.de>
Subject: [PATCH] r8152: correct error returns
Date: Fri,  1 Aug 2014 15:56:10 +0200	[thread overview]
Message-ID: <1406901370-6847-1-git-send-email-oneukum@suse.de> (raw)

If an autoresume fails the internal error codes of the PM
subsystem mustn't be leaked to user space. Replace them by EIO

Signed-off-by: Oliver Neukum <oneukum@suse.de>
---
 drivers/net/usb/r8152.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 87f7104..0e5b9f9 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2810,6 +2810,7 @@ static int rtl8152_open(struct net_device *netdev)
 	res = usb_autopm_get_interface(tp->intf);
 	if (res < 0) {
 		free_all_mem(tp);
+		res = -EIO;
 		goto out;
 	}
 
@@ -3116,8 +3117,10 @@ static int rtl8152_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 	int ret;
 
 	ret = usb_autopm_get_interface(tp->intf);
-	if (ret < 0)
+	if (ret < 0) {
+		ret = -EIO;
 		goto out_set_wol;
+	}
 
 	__rtl_set_wol(tp, wol->wolopts);
 	tp->saved_wolopts = wol->wolopts & WAKE_ANY;
@@ -3169,8 +3172,10 @@ static int rtl8152_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 	int ret;
 
 	ret = usb_autopm_get_interface(tp->intf);
-	if (ret < 0)
+	if (ret < 0) {
+		ret = -EIO;
 		goto out;
+	}
 
 	ret = rtl8152_set_speed(tp, cmd->autoneg, cmd->speed, cmd->duplex);
 
@@ -3267,8 +3272,10 @@ static int rtl8152_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
 		return -ENODEV;
 
 	res = usb_autopm_get_interface(tp->intf);
-	if (res < 0)
+	if (res < 0) {
+		res = -EIO;
 		goto out;
+	}
 
 	switch (cmd) {
 	case SIOCGMIIPHY:
-- 
1.8.4.5

             reply	other threads:[~2014-08-01 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01 13:56 Oliver Neukum [this message]
2014-08-02 23:34 ` [PATCH] r8152: correct error returns David Miller
2014-08-03  7:06   ` Oliver Neukum
2014-08-04 22:18     ` David Miller
2014-08-05  7:43       ` Oliver Neukum
2014-08-05 19:52         ` David Miller

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=1406901370-6847-1-git-send-email-oneukum@suse.de \
    --to=oneukum@suse.de \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.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 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).