[PATCH] posix_fadvise bug (unexpected success on FIFO/pipe)

From: Valentine Barshak
Date: Fri Dec 09 2005 - 07:58:18 EST


Hello all.
This patch adds a FIFO/pipe check to posix_fadvise system call.
If the specified file descriptor is pipe or FIFO, the system call returns ESPIPE error.
Thank you.

Signed-off-by: Valentine Barshak <vbarshak@xxxxxxxxxxxxx>

--- a/mm/fadvise.c 2005-10-10 22:54:29.000000000 +0400
+++ b/mm/fadvise.c 2005-12-06 23:04:19.980711464 +0300
@@ -37,6 +37,11 @@
if (!file)
return -EBADF;

+ if (S_ISFIFO(file->f_dentry->d_inode->i_mode)) {
+ ret = -ESPIPE;
+ goto out;
+ }
+
mapping = file->f_mapping;
if (!mapping || len < 0) {
ret = -EINVAL;