misc/93xx46: avoid infinite loop on write()
authorVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Mon, 28 Oct 2013 17:05:16 +0000 (19:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Oct 2013 23:24:33 +0000 (16:24 -0700)
This change fixes a problem of infinite zero byte write() without
an error status, if there is an attempt to write a file bigger than
EEPROM size over sysfs interface.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/eeprom/eeprom_93xx46.c

index 94cfc121257710459b98a5088d1820d618080e10..3a015abb444a826baecef6c6596f6a5c58adb648 100644 (file)
@@ -202,7 +202,7 @@ eeprom_93xx46_bin_write(struct file *filp, struct kobject *kobj,
        edev = dev_get_drvdata(dev);
 
        if (unlikely(off >= edev->bin.size))
-               return 0;
+               return -EFBIG;
        if ((off + count) > edev->bin.size)
                count = edev->bin.size - off;
        if (unlikely(!count))