X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=block%2Fbsg.c;h=b9a53615bdef4945748057e5efbfef56c5cb4847;hb=cd13e478935eac5512185a7532afb725e45373b1;hp=d214e929ce1855bb653808f03482580b45b5344e;hpb=e63c733d03070d4d3aaf3a29775b42fa9ab95bbf;p=firefly-linux-kernel-4.4.55.git diff --git a/block/bsg.c b/block/bsg.c index d214e929ce18..b9a53615bdef 100644 --- a/block/bsg.c +++ b/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;