Prev: mprotect pgprot handling weirdness
Next: in x86 architecture ,why the function atomic_sub_and_test() does not disable the interrupt?
From: Wu Fengguang on 6 Apr 2010 01:20 On Tue, Apr 06, 2010 at 05:19:05AM +0800, Eric Dumazet wrote: > Le lundi 05 avril 2010 à 23:04 +0200, Eric Dumazet a écrit : > > Andrew, commit dcefafb6ac90ece8d68a6c203105f3d313e52da4 seems to be the > > problem. > > > > It breaks rewinds (negative offsets to lseek (... SEEK_CUR)) > > > > Here is a patch to make rewind working again on /dev/mem Looks good to me. Thanks for the fix! Thanks, Fengguang > [PATCH] /dev/mem: Allow rewinding > > commit dcefafb6 (/dev/mem: dont allow seek to last page) > inadvertently disabled rewinding on /dev/mem. > > This broke x86info for example. > > Signed-off-by: Eric Dumazet <eric.dumazet(a)gmail.com> > --- > diff --git a/drivers/char/mem.c b/drivers/char/mem.c > index 1f3215a..3973a1d 100644 > --- a/drivers/char/mem.c > +++ b/drivers/char/mem.c > @@ -710,11 +710,6 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) > switch (orig) { > case SEEK_CUR: > offset += file->f_pos; > - if ((unsigned long long)offset < > - (unsigned long long)file->f_pos) { > - ret = -EOVERFLOW; > - break; > - } > case SEEK_SET: > /* to avoid userland mistaking f_pos=-9 as -EBADF=-9 */ > if ((unsigned long long)offset >= ~0xFFFULL) { > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Américo Wang on 6 Apr 2010 01:40 On Tue, Apr 6, 2010 at 5:19 AM, Eric Dumazet <eric.dumazet(a)gmail.com> wrote: > Le lundi 05 avril 2010 à 23:04 +0200, Eric Dumazet a écrit : >> Andrew, commit dcefafb6ac90ece8d68a6c203105f3d313e52da4 seems to be the >> problem. >> >> It breaks rewinds (negative offsets to lseek (... SEEK_CUR)) >> > > Here is a patch to make rewind working again on /dev/mem > > [PATCH] /dev/mem: Allow rewinding > > commit dcefafb6 (/dev/mem: dont allow seek to last page) > inadvertently disabled rewinding on /dev/mem. > > This broke x86info for example. > > Signed-off-by: Eric Dumazet <eric.dumazet(a)gmail.com> > --- > diff --git a/drivers/char/mem.c b/drivers/char/mem.c > index 1f3215a..3973a1d 100644 > --- a/drivers/char/mem.c > +++ b/drivers/char/mem.c > @@ -710,11 +710,6 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) > switch (orig) { > case SEEK_CUR: > offset += file->f_pos; > - if ((unsigned long long)offset < > - (unsigned long long)file->f_pos) { > - ret = -EOVERFLOW; > - break; > - } Why completely dropping the overflow check? What you need to do is just adding the 'offset < 0' case check. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Wu Fengguang on 6 Apr 2010 01:50 On Tue, Apr 06, 2010 at 01:30:29PM +0800, Américo Wang wrote: > On Tue, Apr 6, 2010 at 5:19 AM, Eric Dumazet <eric.dumazet(a)gmail.com> wrote: > > Le lundi 05 avril 2010 à 23:04 +0200, Eric Dumazet a écrit : > >> Andrew, commit dcefafb6ac90ece8d68a6c203105f3d313e52da4 seems to be the > >> problem. > >> > >> It breaks rewinds (negative offsets to lseek (... SEEK_CUR)) > >> > > > > Here is a patch to make rewind working again on /dev/mem > > > > [PATCH] /dev/mem: Allow rewinding > > > > commit dcefafb6 (/dev/mem: dont allow seek to last page) > > inadvertently disabled rewinding on /dev/mem. > > > > This broke x86info for example. > > > > Signed-off-by: Eric Dumazet <eric.dumazet(a)gmail.com> > > --- > > diff --git a/drivers/char/mem.c b/drivers/char/mem.c > > index 1f3215a..3973a1d 100644 > > --- a/drivers/char/mem.c > > +++ b/drivers/char/mem.c > > @@ -710,11 +710,6 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) > > switch (orig) { > > case SEEK_CUR: > > offset += file->f_pos; > > - if ((unsigned long long)offset < > > - (unsigned long long)file->f_pos) { > > - ret = -EOVERFLOW; > > - break; > > - } > > Why completely dropping the overflow check? What you need to do is just > adding the 'offset < 0' case check. It will fall through to the next EOVERFLOW check in the SEEK_SET case :) Thanks, Fengguang -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Eric Dumazet on 6 Apr 2010 02:30 Le mardi 06 avril 2010 à 13:30 +0800, Américo Wang a écrit : > > Signed-off-by: Eric Dumazet <eric.dumazet(a)gmail.com> > > --- > > diff --git a/drivers/char/mem.c b/drivers/char/mem.c > > index 1f3215a..3973a1d 100644 > > --- a/drivers/char/mem.c > > +++ b/drivers/char/mem.c > > @@ -710,11 +710,6 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) > > switch (orig) { > > case SEEK_CUR: > > offset += file->f_pos; > > - if ((unsigned long long)offset < > > - (unsigned long long)file->f_pos) { > > - ret = -EOVERFLOW; > > - break; > > - } > > Why completely dropping the overflow check? What you need to do is just > adding the 'offset < 0' case check. > Because the overflow check at this point is completely redundant, it is performed a few lines after... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Américo Wang on 6 Apr 2010 02:30
On Tue, Apr 6, 2010 at 1:43 PM, Wu Fengguang <fengguang.wu(a)intel.com> wrote: > On Tue, Apr 06, 2010 at 01:30:29PM +0800, Américo Wang wrote: >> On Tue, Apr 6, 2010 at 5:19 AM, Eric Dumazet <eric.dumazet(a)gmail.com> wrote: >> > Le lundi 05 avril 2010 à 23:04 +0200, Eric Dumazet a écrit : >> >> Andrew, commit dcefafb6ac90ece8d68a6c203105f3d313e52da4 seems to be the >> >> problem. >> >> >> >> It breaks rewinds (negative offsets to lseek (... SEEK_CUR)) >> >> >> > >> > Here is a patch to make rewind working again on /dev/mem >> > >> > [PATCH] /dev/mem: Allow rewinding >> > >> > commit dcefafb6 (/dev/mem: dont allow seek to last page) >> > inadvertently disabled rewinding on /dev/mem. >> > >> > This broke x86info for example. >> > >> > Signed-off-by: Eric Dumazet <eric.dumazet(a)gmail.com> >> > --- >> > diff --git a/drivers/char/mem.c b/drivers/char/mem.c >> > index 1f3215a..3973a1d 100644 >> > --- a/drivers/char/mem.c >> > +++ b/drivers/char/mem.c >> > @@ -710,11 +710,6 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) >> > switch (orig) { >> > case SEEK_CUR: >> > offset += file->f_pos; >> > - if ((unsigned long long)offset < >> > - (unsigned long long)file->f_pos) { >> > - ret = -EOVERFLOW; >> > - break; >> > - } >> >> Why completely dropping the overflow check? What you need to do is just >> adding the 'offset < 0' case check. > > It will fall through to the next EOVERFLOW check in the SEEK_SET case :) > Oh, right, I didn't read the code, merely the patch. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |