summaryrefslogtreecommitdiffstats
path: root/kernel/block/bsg.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/block/bsg.c')
-rw-r--r--kernel/block/bsg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/block/bsg.c b/kernel/block/bsg.c
index d214e929c..b9a53615b 100644
--- a/kernel/block/bsg.c
+++ b/kernel/block/bsg.c
@@ -655,6 +655,9 @@ bsg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
dprintk("%s: write %Zd bytes\n", bd->name, count);
+ if (unlikely(segment_eq(get_fs(), KERNEL_DS)))
+ return -EINVAL;
+
bsg_set_block(bd, file);
bytes_written = 0;