<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/fs/pipe.c, branch v2.6.34</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>fs: no games with DCACHE_UNHASHED</title>
<updated>2009-12-17T15:51:40+00:00</updated>
<author>
<name>Nick Piggin</name>
<email>npiggin@suse.de</email>
</author>
<published>2009-11-18T04:30:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a3a065e3f13da8a3470ed09c7f38aad256083726'/>
<id>a3a065e3f13da8a3470ed09c7f38aad256083726</id>
<content type='text'>
Filesystems outside the regular namespace do not have to clear DCACHE_UNHASHED
in order to have a working /proc/$pid/fd/XXX. Nothing in proc prevents the
fd link from being used if its dentry is not in the hash.

Also, it does not get put into the dcache hash if DCACHE_UNHASHED is clear;
that depends on the filesystem calling d_add or d_rehash.

So delete the misleading comments and needless code.

Acked-by: Miklos Szeredi &lt;mszeredi@suse.cz&gt;
Signed-off-by: Nick Piggin &lt;npiggin@suse.de&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Filesystems outside the regular namespace do not have to clear DCACHE_UNHASHED
in order to have a working /proc/$pid/fd/XXX. Nothing in proc prevents the
fd link from being used if its dentry is not in the hash.

Also, it does not get put into the dcache hash if DCACHE_UNHASHED is clear;
that depends on the filesystem calling d_add or d_rehash.

So delete the misleading comments and needless code.

Acked-by: Miklos Szeredi &lt;mszeredi@suse.cz&gt;
Signed-off-by: Nick Piggin &lt;npiggin@suse.de&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>switch create_read_pipe() to alloc_file()</title>
<updated>2009-12-16T17:16:43+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2009-08-08T21:01:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d231412db66355e72d606f8403ee8b6bd8ad4f9a'/>
<id>d231412db66355e72d606f8403ee8b6bd8ad4f9a</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>switch alloc_file() to passing struct path</title>
<updated>2009-12-16T17:16:42+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2009-08-08T20:52:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2c48b9c45579a9b5e3e74694eebf3d2451f3dbd3'/>
<id>2c48b9c45579a9b5e3e74694eebf3d2451f3dbd3</id>
<content type='text'>
... and have the caller grab both mnt and dentry; kill
leak in infiniband, while we are at it.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
... and have the caller grab both mnt and dentry; kill
leak in infiniband, while we are at it.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: pipe.c null pointer dereference</title>
<updated>2009-10-21T23:11:44+00:00</updated>
<author>
<name>Earl Chew</name>
<email>earl_chew@agilent.com</email>
</author>
<published>2009-10-19T22:55:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ad3960243e55320d74195fb85c975e0a8cc4466c'/>
<id>ad3960243e55320d74195fb85c975e0a8cc4466c</id>
<content type='text'>
This patch fixes a null pointer exception in pipe_rdwr_open() which
generates the stack trace:

&gt; Unable to handle kernel NULL pointer dereference at 0000000000000028 RIP:
&gt;  [&lt;ffffffff802899a5&gt;] pipe_rdwr_open+0x35/0x70
&gt;  [&lt;ffffffff8028125c&gt;] __dentry_open+0x13c/0x230
&gt;  [&lt;ffffffff8028143d&gt;] do_filp_open+0x2d/0x40
&gt;  [&lt;ffffffff802814aa&gt;] do_sys_open+0x5a/0x100
&gt;  [&lt;ffffffff8021faf3&gt;] sysenter_do_call+0x1b/0x67

The failure mode is triggered by an attempt to open an anonymous
pipe via /proc/pid/fd/* as exemplified by this script:

=============================================================
while : ; do
   { echo y ; sleep 1 ; } | { while read ; do echo z$REPLY; done ; } &amp;
   PID=$!
   OUT=$(ps -efl | grep 'sleep 1' | grep -v grep |
        { read PID REST ; echo $PID; } )
   OUT="${OUT%% *}"
   DELAY=$((RANDOM * 1000 / 32768))
   usleep $((DELAY * 1000 + RANDOM % 1000 ))
   echo n &gt; /proc/$OUT/fd/1                 # Trigger defect
done
=============================================================

Note that the failure window is quite small and I could only
reliably reproduce the defect by inserting a small delay
in pipe_rdwr_open(). For example:

 static int
 pipe_rdwr_open(struct inode *inode, struct file *filp)
 {
       msleep(100);
       mutex_lock(&amp;inode-&gt;i_mutex);

Although the defect was observed in pipe_rdwr_open(), I think it
makes sense to replicate the change through all the pipe_*_open()
functions.

The core of the change is to verify that inode-&gt;i_pipe has not
been released before attempting to manipulate it. If inode-&gt;i_pipe
is no longer present, return ENOENT to indicate so.

The comment about potentially using atomic_t for i_pipe-&gt;readers
and i_pipe-&gt;writers has also been removed because it is no longer
relevant in this context. The inode-&gt;i_mutex lock must be used so
that inode-&gt;i_pipe can be dealt with correctly.

Signed-off-by: Earl Chew &lt;earl_chew@agilent.com&gt;
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes a null pointer exception in pipe_rdwr_open() which
generates the stack trace:

&gt; Unable to handle kernel NULL pointer dereference at 0000000000000028 RIP:
&gt;  [&lt;ffffffff802899a5&gt;] pipe_rdwr_open+0x35/0x70
&gt;  [&lt;ffffffff8028125c&gt;] __dentry_open+0x13c/0x230
&gt;  [&lt;ffffffff8028143d&gt;] do_filp_open+0x2d/0x40
&gt;  [&lt;ffffffff802814aa&gt;] do_sys_open+0x5a/0x100
&gt;  [&lt;ffffffff8021faf3&gt;] sysenter_do_call+0x1b/0x67

The failure mode is triggered by an attempt to open an anonymous
pipe via /proc/pid/fd/* as exemplified by this script:

=============================================================
while : ; do
   { echo y ; sleep 1 ; } | { while read ; do echo z$REPLY; done ; } &amp;
   PID=$!
   OUT=$(ps -efl | grep 'sleep 1' | grep -v grep |
        { read PID REST ; echo $PID; } )
   OUT="${OUT%% *}"
   DELAY=$((RANDOM * 1000 / 32768))
   usleep $((DELAY * 1000 + RANDOM % 1000 ))
   echo n &gt; /proc/$OUT/fd/1                 # Trigger defect
done
=============================================================

Note that the failure window is quite small and I could only
reliably reproduce the defect by inserting a small delay
in pipe_rdwr_open(). For example:

 static int
 pipe_rdwr_open(struct inode *inode, struct file *filp)
 {
       msleep(100);
       mutex_lock(&amp;inode-&gt;i_mutex);

Although the defect was observed in pipe_rdwr_open(), I think it
makes sense to replicate the change through all the pipe_*_open()
functions.

The core of the change is to verify that inode-&gt;i_pipe has not
been released before attempting to manipulate it. If inode-&gt;i_pipe
is no longer present, return ENOENT to indicate so.

The comment about potentially using atomic_t for i_pipe-&gt;readers
and i_pipe-&gt;writers has also been removed because it is no longer
relevant in this context. The inode-&gt;i_mutex lock must be used so
that inode-&gt;i_pipe can be dealt with correctly.

Signed-off-by: Earl Chew &lt;earl_chew@agilent.com&gt;
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lockdep: Fix lockdep annotation for pipe_double_lock()</title>
<updated>2009-07-22T19:14:14+00:00</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2009-07-21T08:09:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=023d43c7b5a23a81fe8afa9f37296f8ed4be11fb'/>
<id>023d43c7b5a23a81fe8afa9f37296f8ed4be11fb</id>
<content type='text'>
The presumed use of the pipe_double_lock() routine is to lock 2 locks in
a deadlock free way by ordering the locks by their address. However it
fails to keep the specified lock classes in order and explicitly
annotates a deadlock.

Rectify this.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Acked-by: Miklos Szeredi &lt;mszeredi@suse.cz&gt;
LKML-Reference: &lt;1248163763.15751.11098.camel@twins&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The presumed use of the pipe_double_lock() routine is to lock 2 locks in
a deadlock free way by ordering the locks by their address. However it
fails to keep the specified lock classes in order and explicitly
annotates a deadlock.

Rectify this.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Acked-by: Miklos Szeredi &lt;mszeredi@suse.cz&gt;
LKML-Reference: &lt;1248163763.15751.11098.camel@twins&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>splice: implement default splice_read method</title>
<updated>2009-05-11T12:13:10+00:00</updated>
<author>
<name>Miklos Szeredi</name>
<email>miklos@szeredi.hu</email>
</author>
<published>2009-05-07T13:37:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6818173bd658439b83896a2a7586f64ab51bf29c'/>
<id>6818173bd658439b83896a2a7586f64ab51bf29c</id>
<content type='text'>
If f_op-&gt;splice_read() is not implemented, fall back to a plain read.
Use vfs_readv() to read into previously allocated pages.

This will allow splice and functions using splice, such as the loop
device, to work on all filesystems.  This includes "direct_io" files
in fuse which bypass the page cache.

Signed-off-by: Miklos Szeredi &lt;mszeredi@suse.cz&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If f_op-&gt;splice_read() is not implemented, fall back to a plain read.
Use vfs_readv() to read into previously allocated pages.

This will allow splice and functions using splice, such as the loop
device, to work on all filesystems.  This includes "direct_io" files
in fuse which bypass the page cache.

Signed-off-by: Miklos Szeredi &lt;mszeredi@suse.cz&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>splice: add helpers for locking pipe inode</title>
<updated>2009-04-15T10:10:12+00:00</updated>
<author>
<name>Miklos Szeredi</name>
<email>miklos@szeredi.hu</email>
</author>
<published>2009-04-14T17:48:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=61e0d47c33cc371f725bcda4a47ae0efe652dba8'/>
<id>61e0d47c33cc371f725bcda4a47ae0efe652dba8</id>
<content type='text'>
There are lots of sequences like this, especially in splice code:

	if (pipe-&gt;inode)
		mutex_lock(&amp;pipe-&gt;inode-&gt;i_mutex);
	/* do something */
	if (pipe-&gt;inode)
		mutex_unlock(&amp;pipe-&gt;inode-&gt;i_mutex);

so introduce helpers which do the conditional locking and unlocking.
Also replace the inode_double_lock() call with a pipe_double_lock()
helper to avoid spreading the use of this functionality beyond the
pipe code.

This patch is just a cleanup, and should cause no behavioral changes.

Signed-off-by: Miklos Szeredi &lt;mszeredi@suse.cz&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are lots of sequences like this, especially in splice code:

	if (pipe-&gt;inode)
		mutex_lock(&amp;pipe-&gt;inode-&gt;i_mutex);
	/* do something */
	if (pipe-&gt;inode)
		mutex_unlock(&amp;pipe-&gt;inode-&gt;i_mutex);

so introduce helpers which do the conditional locking and unlocking.
Also replace the inode_double_lock() call with a pipe_double_lock()
helper to avoid spreading the use of this functionality beyond the
pipe code.

This patch is just a cleanup, and should cause no behavioral changes.

Signed-off-by: Miklos Szeredi &lt;mszeredi@suse.cz&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6</title>
<updated>2009-03-27T23:23:12+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2009-03-27T23:23:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3ae5080f4c2e293229508dabe7c8a90af4e4c460'/>
<id>3ae5080f4c2e293229508dabe7c8a90af4e4c460</id>
<content type='text'>
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (37 commits)
  fs: avoid I_NEW inodes
  Merge code for single and multiple-instance mounts
  Remove get_init_pts_sb()
  Move common mknod_ptmx() calls into caller
  Parse mount options just once and copy them to super block
  Unroll essentials of do_remount_sb() into devpts
  vfs: simple_set_mnt() should return void
  fs: move bdev code out of buffer.c
  constify dentry_operations: rest
  constify dentry_operations: configfs
  constify dentry_operations: sysfs
  constify dentry_operations: JFS
  constify dentry_operations: OCFS2
  constify dentry_operations: GFS2
  constify dentry_operations: FAT
  constify dentry_operations: FUSE
  constify dentry_operations: procfs
  constify dentry_operations: ecryptfs
  constify dentry_operations: CIFS
  constify dentry_operations: AFS
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (37 commits)
  fs: avoid I_NEW inodes
  Merge code for single and multiple-instance mounts
  Remove get_init_pts_sb()
  Move common mknod_ptmx() calls into caller
  Parse mount options just once and copy them to super block
  Unroll essentials of do_remount_sb() into devpts
  vfs: simple_set_mnt() should return void
  fs: move bdev code out of buffer.c
  constify dentry_operations: rest
  constify dentry_operations: configfs
  constify dentry_operations: sysfs
  constify dentry_operations: JFS
  constify dentry_operations: OCFS2
  constify dentry_operations: GFS2
  constify dentry_operations: FAT
  constify dentry_operations: FUSE
  constify dentry_operations: procfs
  constify dentry_operations: ecryptfs
  constify dentry_operations: CIFS
  constify dentry_operations: AFS
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>constify dentry_operations: rest</title>
<updated>2009-03-27T18:44:03+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2009-02-20T06:02:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3ba13d179e8c24c68eac32b93593a6b10fcd1572'/>
<id>3ba13d179e8c24c68eac32b93593a6b10fcd1572</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>do_pipe cleanup: drop its last user in arch/alpha/</title>
<updated>2009-03-27T18:43:58+00:00</updated>
<author>
<name>Cheng Renquan</name>
<email>crquan@gmail.com</email>
</author>
<published>2009-01-14T09:01:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=10f303ae1e5e77a9f7cb053e6329906afb132c67'/>
<id>10f303ae1e5e77a9f7cb053e6329906afb132c67</id>
<content type='text'>
The last user of do_pipe is in arch/alpha/, after replacing it with
do_pipe_flags, the do_pipe can be totally dropped.

Signed-off-by: Cheng Renquan &lt;crquan@gmail.com&gt;
Acked-by: Richard Henderson &lt;rth@twiddle.net&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The last user of do_pipe is in arch/alpha/, after replacing it with
do_pipe_flags, the do_pipe can be totally dropped.

Signed-off-by: Cheng Renquan &lt;crquan@gmail.com&gt;
Acked-by: Richard Henderson &lt;rth@twiddle.net&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
</feed>
