aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/bitmap.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 3f3b8051f342..c63ddd06a5da 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -632,19 +632,22 @@ EXPORT_SYMBOL(bitmap_parselist);
632 * @nmaskbits: size of bitmap, in bits. 632 * @nmaskbits: size of bitmap, in bits.
633 * 633 *
634 * Wrapper for bitmap_parselist(), providing it with user buffer. 634 * Wrapper for bitmap_parselist(), providing it with user buffer.
635 *
636 * We cannot have this as an inline function in bitmap.h because it needs
637 * linux/uaccess.h to get the access_ok() declaration and this causes
638 * cyclic dependencies.
639 */ 635 */
640int bitmap_parselist_user(const char __user *ubuf, 636int bitmap_parselist_user(const char __user *ubuf,
641 unsigned int ulen, unsigned long *maskp, 637 unsigned int ulen, unsigned long *maskp,
642 int nmaskbits) 638 int nmaskbits)
643{ 639{
644 if (!access_ok(ubuf, ulen)) 640 char *buf;
645 return -EFAULT; 641 int ret;
646 return __bitmap_parselist((const char __force *)ubuf, 642
647 ulen, 1, maskp, nmaskbits); 643 buf = memdup_user_nul(ubuf, ulen);
644 if (IS_ERR(buf))
645 return PTR_ERR(buf);
646
647 ret = bitmap_parselist(buf, maskp, nmaskbits);
648
649 kfree(buf);
650 return ret;
648} 651}
649EXPORT_SYMBOL(bitmap_parselist_user); 652EXPORT_SYMBOL(bitmap_parselist_user);
650 653