X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=block%2Fbsg.c;h=a57046de2f07f00eae78aaabe9b5e43c1ecc178f;hb=cb38b45346f17f4b0a105b9315b030a2e24fb7e6;hp=8a05a404ae708503589bdf33643948c37d243e62;hpb=8421c60446290c0fef1858a806261871a40ebf76;p=linux.git diff --git a/block/bsg.c b/block/bsg.c index 8a05a404ae70..a57046de2f07 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;