All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Altaparmakov <aia21-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
To: Steve French <sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
Cc: 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: CIFS  kernel module bug
Date: Fri, 30 Sep 2011 14:58:58 +0100	[thread overview]
Message-ID: <A904EFBF-CBC1-4842-9E50-2A556103B8AA@cam.ac.uk> (raw)

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
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer, http://www.linux-ntfs.org/

WARNING: multiple messages have this Message-ID (diff)
From: Anton Altaparmakov <aia21@cam.ac.uk>
To: Steve French <sfrench@samba.org>
Cc: 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: CIFS  kernel module bug
Date: Fri, 30 Sep 2011 14:58:58 +0100	[thread overview]
Message-ID: <A904EFBF-CBC1-4842-9E50-2A556103B8AA@cam.ac.uk> (raw)

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
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer, http://www.linux-ntfs.org/


             reply	other threads:[~2011-09-30 13:58 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-30 13:58 Anton Altaparmakov [this message]
2011-09-30 13:58 ` CIFS kernel module bug 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
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=A904EFBF-CBC1-4842-9E50-2A556103B8AA@cam.ac.uk \
    --to=aia21-kwpb1pkirijaa/9udqfwiw@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.