]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Revert "ARM: amba: Fix race condition with driver_override"
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Apr 2018 08:29:57 +0000 (10:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Apr 2018 08:29:57 +0000 (10:29 +0200)
This reverts commit ec4a0a0601e6c58aba6bd7eb4e75da03b9b2396f.

My backport was incorrect, as Geert pointed out :(

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Todd Kjos <tkjos@google.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/amba/bus.c

index 8e6ac30316624356dde7517988d1be0133044053..fac8e36de11eaec7073c6d5dc4f4d140b65d5d97 100644 (file)
@@ -69,15 +69,11 @@ static ssize_t driver_override_show(struct device *_dev,
                                    struct device_attribute *attr, char *buf)
 {
        struct amba_device *dev = to_amba_device(_dev);
-       ssize_t len;
 
        if (!dev->driver_override)
                return 0;
 
-       device_lock(_dev);
-       len = sprintf(buf, "%s\n", dev->driver_override);
-       device_unlock(_dev);
-       return len;
+       return sprintf(buf, "%s\n", dev->driver_override);
 }
 
 static ssize_t driver_override_store(struct device *_dev,
@@ -85,7 +81,7 @@ static ssize_t driver_override_store(struct device *_dev,
                                     const char *buf, size_t count)
 {
        struct amba_device *dev = to_amba_device(_dev);
-       char *driver_override, *old, *cp;
+       char *driver_override, *old = dev->driver_override, *cp;
 
        /* We need to keep extra room for a newline */
        if (count >= (PAGE_SIZE - 1))
@@ -99,15 +95,12 @@ static ssize_t driver_override_store(struct device *_dev,
        if (cp)
                *cp = '\0';
 
-       device_lock(_dev);
-       old = dev->driver_override;
        if (strlen(driver_override)) {
                dev->driver_override = driver_override;
        } else {
               kfree(driver_override);
               dev->driver_override = NULL;
        }
-       device_unlock(_dev);
 
        kfree(old);