CIFS kernel module bug
Jeff Layton
jlayton at samba.org
Fri Sep 30 12:04:09 MDT 2011
On Fri, 30 Sep 2011 14:58:58 +0100
Anton Altaparmakov <aia21 at cam.ac.uk> wrote:
> Hi,
>
> Looking at the current kernel (in Linus' repository on github) there is a silly logic bug in the cifs module in fs/cifs/cifsfs.c::cifs_llseek() there is this bit of code:
>
> /*
> * origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
> * the cached file length
> */
> if (origin != SEEK_SET || origin != SEEK_CUR) {
>
> The logical or should be a logical and, i.e. this should be:
>
> if (origin != SEEK_SET && origin != SEEK_CUR) {
>
> As the code is at present that line is ALWAYS true because origin is ALWAYS either != SEEK_SET or != SEEK_CUR as if it equals one it cannot equal the other and vice versa…
>
> So at the moment it always does the revalidation instead of only for SEEK_END, SEEK_DATA, and SEEK_HOLE.
>
> Best regards,
>
> Anton
Haha, good catch. Care to roll up a patch to fix that?
--
Jeff Layton <jlayton at samba.org>
More information about the samba-technical
mailing list