--- /dev/null
+From 2b79bc4f7ebbd5af3c8b867968f9f15602d5f802 Mon Sep 17 00:00:00 2001
+From: Jeff Mahoney <jeffm@suse.com>
+Date: Mon, 11 May 2009 14:25:34 -0400
+Subject: dup2: Fix return value with oldfd == newfd and invalid fd
+
+From: Jeff Mahoney <jeffm@suse.com>
+
+commit 2b79bc4f7ebbd5af3c8b867968f9f15602d5f802 upstream.
+
+The return value of dup2 when oldfd == newfd and the fd isn't valid is
+not getting properly sign extended. We end up with 4294967287 instead
+of -EBADF.
+
+I've reproduced this on SLE11 (2.6.27.21), openSUSE Factory
+(2.6.29-rc5), and Ubuntu 9.04 (2.6.28).
+
+This patch uses a signed int for the error value so it is properly
+extended.
+
+Commit 6c5d0512a091480c9f981162227fdb1c9d70e555 introduced this
+regression.
+
+Reported-by: Jiri Dluhos <jdluhos@novell.com>
+Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/fcntl.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/fs/fcntl.c
++++ b/fs/fcntl.c
+@@ -117,11 +117,13 @@ SYSCALL_DEFINE2(dup2, unsigned int, oldf
+ {
+ if (unlikely(newfd == oldfd)) { /* corner case */
+ struct files_struct *files = current->files;
++ int retval = oldfd;
++
+ rcu_read_lock();
+ if (!fcheck_files(files, oldfd))
+- oldfd = -EBADF;
++ retval = -EBADF;
+ rcu_read_unlock();
+- return oldfd;
++ return retval;
+ }
+ return sys_dup3(oldfd, newfd, 0);
+ }
--- /dev/null
+From stable-bounces@linux.kernel.org Tue May 12 13:51:08 2009
+From: Dave Airlie <airlied@redhat.com>
+Date: Thu, 7 May 2009 14:57:24 +0200
+Subject: i2c-algo-bit: Fix timeout test
+To: stable@kernel.org
+Message-ID: <20090507145724.730d8916@hyperion.delvare>
+
+
+From: Dave Airlie <airlied@redhat.com>
+
+commit 0cdba07bb23cdd3e0d64357ec3d983e6b75e541f upstream
+
+When fetching DDC using i2c algo bit, we were often seeing timeouts
+before getting valid EDID on a retry. The VESA spec states 2ms is the
+DDC timeout, so when this translates into 1 jiffie and we are close
+to the end of the time period, it could return with a timeout less than
+2ms.
+
+Change this code to use time_after instead of time_after_eq.
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/i2c/algos/i2c-algo-bit.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/i2c/algos/i2c-algo-bit.c
++++ b/drivers/i2c/algos/i2c-algo-bit.c
+@@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_dat
+ * chips may hold it low ("clock stretching") while they
+ * are processing data internally.
+ */
+- if (time_after_eq(jiffies, start + adap->timeout))
++ if (time_after(jiffies, start + adap->timeout))
+ return -ETIMEDOUT;
+ cond_resched();
+ }
--- /dev/null
+From stable-bounces@linux.kernel.org Tue May 12 13:51:50 2009
+From: Enrik Berkhan <Enrik.Berkhan@ge.com>
+Date: Thu, 7 May 2009 14:58:48 +0200
+Subject: i2c-algo-pca: Let PCA9564 recover from unacked data byte (state 0x30)
+To: stable@kernel.org
+Message-ID: <20090507145848.7fb8a908@hyperion.delvare>
+
+
+From: Enrik Berkhan <Enrik.Berkhan@ge.com>
+
+commit 2196d1cf4afab93fb64c2e5b417096e49b661612 upstream
+
+Currently, the i2c-algo-pca driver does nothing if the chip enters state
+0x30 (Data byte in I2CDAT has been transmitted; NOT ACK has been
+received). Thus, the i2c bus connected to the controller gets stuck
+afterwards.
+
+I have seen this kind of error on a custom board in certain load
+situations most probably caused by interference or noise.
+
+A possible reaction is to let the controller generate a STOP condition.
+This is documented in the PCA9564 data sheet (2006-09-01) and the same
+is done for other NACK states as well.
+
+Further, state 0x38 isn't handled completely, either. Try to do another
+START in this case like the data sheet says. As this couldn't be tested,
+I've added a comment to try to reset the chip if the START doesn't help
+as suggested by Wolfram Sang.
+
+Signed-off-by: Enrik Berkhan <Enrik.Berkhan@ge.com>
+Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/i2c/algos/i2c-algo-pca.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- a/drivers/i2c/algos/i2c-algo-pca.c
++++ b/drivers/i2c/algos/i2c-algo-pca.c
+@@ -270,10 +270,21 @@ static int pca_xfer(struct i2c_adapter *
+
+ case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK has been received */
+ DEB2("NOT ACK received after data byte\n");
++ pca_stop(adap);
+ goto out;
+
+ case 0x38: /* Arbitration lost during SLA+W, SLA+R or data bytes */
+ DEB2("Arbitration lost\n");
++ /*
++ * The PCA9564 data sheet (2006-09-01) says "A
++ * START condition will be transmitted when the
++ * bus becomes free (STOP or SCL and SDA high)"
++ * when the STA bit is set (p. 11).
++ *
++ * In case this won't work, try pca_reset()
++ * instead.
++ */
++ pca_start(adap);
+ goto out;
+
+ case 0x58: /* Data byte has been received; NOT ACK has been returned */
md-raid10-don-t-clear-bitmap-during-recovery-if-array-will-still-be-degraded.patch
md-remove-ability-to-explicit-set-an-inactive-array-to-clean.patch
usb-gadget-fix-utf-conversion-in-the-usbstring-library.patch
+dup2-fix-return-value-with-oldfd-newfd-and-invalid-fd.patch
+i2c-algo-bit-fix-timeout-test.patch
+i2c-algo-pca-let-pca9564-recover-from-unacked-data-byte.patch