From: Oliver Neukum <oneukum@suse.de>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, nic_swsd@realtek.com
Subject: Re: [PATCH] r8152: correct error returns
Date: Sun, 03 Aug 2014 09:06:58 +0200 [thread overview]
Message-ID: <1407049618.26893.8.camel@linux-fkkt.site> (raw)
In-Reply-To: <20140802.163418.1314777407262254543.davem@davemloft.net>
On Sat, 2014-08-02 at 16:34 -0700, David Miller wrote:
> From: Oliver Neukum <oneukum@suse.de>
> Date: Fri, 1 Aug 2014 15:56:10 +0200
>
> > 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>
>
> Really?
Yes. You can get results like returning -EINVAL
from open().
You can call down into
drivers/core/power/runtime.c::static int rpm_resume(struct device *dev,
int rpmflags)
As you can see it uses errors in its own ways:
static int rpm_resume(struct device *dev, int rpmflags)
__releases(&dev->power.lock) __acquires(&dev->power.lock)
{
int (*callback)(struct device *);
struct device *parent = NULL;
int retval = 0;
trace_rpm_resume(dev, rpmflags);
repeat:
if (dev->power.runtime_error)
retval = -EINVAL;
else if (dev->power.disable_depth == 1 &&
dev->power.is_suspended
&& dev->power.runtime_status == RPM_ACTIVE)
retval = 1;
else if (dev->power.disable_depth > 0)
retval = -EACCES;
if (retval)
goto out;
The call chain is
usb_autopm_get_interface()->pm_runtime_get_sync()->__pm_runtime_resume()
->rpm_resume()
> Then even the core usbnet driver gets this wrong, as well as many
> other drivers I scanned over for this problem.
OK, I just looked at this single driver. I'll try to come up with
a generic solution. The mapping is a bit simplistic. I should let
-ENOMEM pass for example.
Regards
Oliver
next prev parent reply other threads:[~2014-08-03 7:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-01 13:56 [PATCH] r8152: correct error returns Oliver Neukum
2014-08-02 23:34 ` David Miller
2014-08-03 7:06 ` Oliver Neukum [this message]
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=1407049618.26893.8.camel@linux-fkkt.site \
--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).