All of lore.kernel.org
 help / color / mirror / Atom feed
From: Federico Sauter <fsauter-LVkJPw3T+odGBRGhe+f61g@public.gmane.org>
To: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Flush issue with overwritten FID
Date: Thu, 28 May 2015 18:56:34 +0200	[thread overview]
Message-ID: <556748C2.40202@innominate.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2628 bytes --]

Greetings,


I am using a Linux device with kernel 3.10.40. The Windows host is using 
XP PRO (32-bit,) but the problem has laso been observed with Windows 7 
64-bit.

When I directly connect the Linux device to the Windows host, a very 
strange problem arises. First of all: by "directly connect" I mean 
connecting the network cable from the device's NIC directly to the 
host's NIC, without any switch in between.

The device then mounts two shares on the host: a RO share, as well as a 
RW share.

The device opens a file (integrity-check-idx.tmp) for writing on the RW 
share. Then (without closing it) it scans the contents of the RO share. 
Afterwards, it writes some result on that file and flushes it before 
closing it. Straightforward enough.

In the described case where the NICs are directly connected *and* that 
the Windows host finishes booting before the Linux device does, 
something strange happens. The file opened for writing is opened on FID 
0x4002, then, when opening another file on the RO share, the same FID 
seems to be reused. That file is closed and FID 0x4002 is then invalid. 
In the end, when FID 0x4002 is flushed, an error is returned.

Attached you will find an abridged version of the Wireshark capture. 
Here is the summary:

SMB_COM_NT_CREATE_ANDX integrity-check-idx.tmp on FID 0x4002
SMB_COM_READ_ANDX  FID 0x4002
(...browse share...)
SMB_COM_NT_CREATE_ANDX append.exe on FID 0x4002
SMB_COM_READ_ANDX  FID 0x4002
SMB_COM_CLOSE  FID 0x4002
(...)
SMB_COM_FLUSH  FID 0x4002
Response: NT Status: STATUS_INVALID_HANDLE (0xc0000008)

In the case where there is a switch between both NICs, this problem does 
not happen. In that case, FID 0x4002 is used only once for the file 
opened for writing (which was created first) and then other FIDs are 
used for each file that is opened afterwards. Thus, all operations 
succeed (which is the behavior that I would expect.)

Do you have any idea on how to solve this?

I am taking a deeper look at the kernel code, but so far it seems to me 
like this was a Windows problem and not a problem in our implementation, 
given that the FID is assigned by the Windows host. Could you please 
confirm that this is correct so as to provide a workaround?

Thank you in advance for your kind support!


Federico Sauter
Senior Firmware Programmer
-- 
Innominate Security Technologies AG
Rudower Chaussee 13 | 12489 Berlin | Germany
tel: +49 30 921028-210 | fax: +49 30 921028-020
www.innominate.com | www.twitter.com/mGuardcom

Register Court: AG Charlottenburg, HR B 81603
Management Board: Dirk Seewald | Chairman of the Supervisory Board: 
Christoph Leifer

[-- Attachment #2: bug_14517.cap --]
[-- Type: application/vnd.tcpdump.pcap, Size: 4176 bytes --]

             reply	other threads:[~2015-05-28 16:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28 16:56 Federico Sauter [this message]
     [not found] ` <556748C2.40202-LVkJPw3T+odGBRGhe+f61g@public.gmane.org>
2015-06-11 16:06   ` Flush issue with overwritten FID Federico Sauter

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=556748C2.40202@innominate.com \
    --to=fsauter-lvkjpw3t+odgbrghe+f61g@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@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.