lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 03 Aug 2014 09:06:58 +0200
From:	Oliver Neukum <oneukum@...e.de>
To:	David Miller <davem@...emloft.net>
Cc:	netdev@...r.kernel.org, nic_swsd@...ltek.com
Subject: Re: [PATCH] r8152: correct error returns

On Sat, 2014-08-02 at 16:34 -0700, David Miller wrote:
> From: Oliver Neukum <oneukum@...e.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@...e.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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ