All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
Cc: Anton Altaparmakov
	<aia21-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>,
	Steve French <sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	PWF Linux <pwf-linux-IE+S/cj2AuA2EctHIo1CcQ@public.gmane.org>
Subject: Re: CIFS kernel module bug
Date: Fri, 30 Sep 2011 13:30:10 -0500	[thread overview]
Message-ID: <CAH2r5mvu=dYwai5yoCsy6SO5aLfD-eaYuMXuwZUN3rYqjHZY9Q@mail.gmail.com> (raw)
In-Reply-To: <20110930140409.51c1a94c-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>

On Fri, Sep 30, 2011 at 1:04 PM, Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org> wrote:
> On Fri, 30 Sep 2011 14:58:58 +0100
> Anton Altaparmakov <aia21-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org> 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-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
>


Yes - obviously that code was wrong, fortunately not a disaster.
Thanks for pointing this out.  If you don't want to write up
the patch let us know and we will make the trivial fix.



-- 
Thanks,

Steve

WARNING: multiple messages have this Message-ID (diff)
From: Steve French <smfrench@gmail.com>
To: Jeff Layton <jlayton@samba.org>
Cc: Anton Altaparmakov <aia21@cam.ac.uk>,
	Steve French <sfrench@samba.org>,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	LKML <linux-kernel@vger.kernel.org>,
	PWF Linux <pwf-linux@ucs.cam.ac.uk>
Subject: Re: CIFS kernel module bug
Date: Fri, 30 Sep 2011 13:30:10 -0500	[thread overview]
Message-ID: <CAH2r5mvu=dYwai5yoCsy6SO5aLfD-eaYuMXuwZUN3rYqjHZY9Q@mail.gmail.com> (raw)
In-Reply-To: <20110930140409.51c1a94c@tlielax.poochiereds.net>

On Fri, Sep 30, 2011 at 1:04 PM, Jeff Layton <jlayton@samba.org> wrote:
> On Fri, 30 Sep 2011 14:58:58 +0100
> Anton Altaparmakov <aia21@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@samba.org>
>


Yes - obviously that code was wrong, fortunately not a disaster.
Thanks for pointing this out.  If you don't want to write up
the patch let us know and we will make the trivial fix.



-- 
Thanks,

Steve

  parent reply	other threads:[~2011-09-30 18:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-30 13:58 CIFS kernel module bug Anton Altaparmakov
2011-09-30 13:58 ` Anton Altaparmakov
2011-09-30 18:04 ` Jeff Layton
     [not found]   ` <20110930140409.51c1a94c-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2011-09-30 18:30     ` Steve French [this message]
2011-09-30 18:30       ` Steve French
2011-09-30 21:30     ` Anton Altaparmakov
2011-09-30 21:30       ` Anton Altaparmakov
2011-09-30 23:47       ` Jeremy Allison
2011-09-30 23:47         ` Jeremy Allison
2011-10-01  0:34         ` J.P. King
2011-10-01  0:34           ` J.P. King
     [not found]           ` <alpine.LSU.2.00.1110010122210.15683-rNEEB5iaIwQgWVoWv9+vLtDNj2e20MGE@public.gmane.org>
2011-10-01  8:48             ` Anton Altaparmakov
2011-10-01  8:48               ` Anton Altaparmakov
     [not found]               ` <6704F264-5437-4948-8C1B-FE3F5CE59C24-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2011-10-01 15:07                 ` Lars Müller
2011-10-01 15:07                   ` Lars Müller
     [not found]                   ` <20111001150730.GJ5170-jzW0CqpAA0Me6aEkudXLsA@public.gmane.org>
2011-10-01 19:53                     ` Anton Altaparmakov
2011-10-01 19:53                       ` Anton Altaparmakov
     [not found]                       ` <6A5AB13C-F313-4BF2-A402-F41AB53493F0-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2011-10-01 20:22                         ` Jim McDonough
2011-10-01 20:22                           ` Jim McDonough
2011-10-01 23:14                           ` Steve French
2011-10-01 23:14                             ` Steve French
     [not found]                           ` <CAFneQcc8D7ho-Yfr2X0DxaLLX11iMU=wSgCw9daKoViZCMk6dA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-02 20:16                             ` Anton Altaparmakov
2011-10-02 20:16                               ` Anton Altaparmakov
2011-10-03  2:44                               ` Jeremy Allison
2011-10-03  2:44                                 ` Jeremy Allison
     [not found]                               ` <65C75335-2A74-4B00-989A-212BAC06A646-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2011-10-03 16:56                                 ` Lars Müller
2011-10-03 16:56                                   ` Lars Müller
     [not found]       ` <E35BF115-B84D-4DB2-BDDC-E356052282F2-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2011-09-30 22:20         ` Steve French
2011-09-30 22:20           ` Steve French
2011-10-03 11:17         ` Jeff Layton
2011-10-03 11:17           ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH2r5mvu=dYwai5yoCsy6SO5aLfD-eaYuMXuwZUN3rYqjHZY9Q@mail.gmail.com' \
    --to=smfrench-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=aia21-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org \
    --cc=jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pwf-linux-IE+S/cj2AuA2EctHIo1CcQ@public.gmane.org \
    --cc=samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org \
    --cc=sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.