From: Greg Kroah-Hartman Date: Tue, 12 May 2009 21:00:59 +0000 (-0700) Subject: some .27 patches X-Git-Tag: v2.6.29.4~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e55f4a0f7873b1c82fe553e69d273452aaf9976e;p=thirdparty%2Fkernel%2Fstable-queue.git some .27 patches --- diff --git a/queue-2.6.27/dup2-fix-return-value-with-oldfd-newfd-and-invalid-fd.patch b/queue-2.6.27/dup2-fix-return-value-with-oldfd-newfd-and-invalid-fd.patch new file mode 100644 index 00000000000..1017b0bc8ae --- /dev/null +++ b/queue-2.6.27/dup2-fix-return-value-with-oldfd-newfd-and-invalid-fd.patch @@ -0,0 +1,50 @@ +From 2b79bc4f7ebbd5af3c8b867968f9f15602d5f802 Mon Sep 17 00:00:00 2001 +From: Jeff Mahoney +Date: Mon, 11 May 2009 14:25:34 -0400 +Subject: dup2: Fix return value with oldfd == newfd and invalid fd + +From: Jeff Mahoney + +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 +Signed-off-by: Jeff Mahoney +Signed-off-by: Linus Torvalds +Cc: Andrew Morton +Signed-off-by: Greg Kroah-Hartman + +--- + 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); + } diff --git a/queue-2.6.27/i2c-algo-bit-fix-timeout-test.patch b/queue-2.6.27/i2c-algo-bit-fix-timeout-test.patch new file mode 100644 index 00000000000..f13e04d6560 --- /dev/null +++ b/queue-2.6.27/i2c-algo-bit-fix-timeout-test.patch @@ -0,0 +1,39 @@ +From stable-bounces@linux.kernel.org Tue May 12 13:51:08 2009 +From: Dave Airlie +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 + +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 +Signed-off-by: Jean Delvare +Signed-off-by: Greg Kroah-Hartman + +--- + 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(); + } diff --git a/queue-2.6.27/i2c-algo-pca-let-pca9564-recover-from-unacked-data-byte.patch b/queue-2.6.27/i2c-algo-pca-let-pca9564-recover-from-unacked-data-byte.patch new file mode 100644 index 00000000000..9830a187ef5 --- /dev/null +++ b/queue-2.6.27/i2c-algo-pca-let-pca9564-recover-from-unacked-data-byte.patch @@ -0,0 +1,62 @@ +From stable-bounces@linux.kernel.org Tue May 12 13:51:50 2009 +From: Enrik Berkhan +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 + +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 +Reviewed-by: Wolfram Sang +Signed-off-by: Jean Delvare +Signed-off-by: Greg Kroah-Hartman + +--- + 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 */ diff --git a/queue-2.6.27/series b/queue-2.6.27/series index 3b529b553fa..d7fb6fb7686 100644 --- a/queue-2.6.27/series +++ b/queue-2.6.27/series @@ -3,3 +3,6 @@ md-fix-some-errors-with-bitmaps-on-devices-larger-than-2tb.patch 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