X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=block%2Fbsg.c;h=b9a53615bdef4945748057e5efbfef56c5cb4847;hb=a584e047770fbc1379dda832eb828f464341c7d3;hp=d214e929ce1855bb653808f03482580b45b5344e;hpb=e3e72f38a5bd7b17aca04f1bfe6d0ef2371cf05a;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;