]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - include/linux/regset.h
regset: Prevent null pointer reference on readonly regsets
[~shefty/rdma-dev.git] / include / linux / regset.h
index 8abee65562230fe05174d2ded6bc8ec50249348b..5150fd16ef93cbb38a840fb6667b56b937697f51 100644 (file)
@@ -335,6 +335,9 @@ static inline int copy_regset_to_user(struct task_struct *target,
 {
        const struct user_regset *regset = &view->regsets[setno];
 
+       if (!regset->get)
+               return -EOPNOTSUPP;
+
        if (!access_ok(VERIFY_WRITE, data, size))
                return -EIO;
 
@@ -358,6 +361,9 @@ static inline int copy_regset_from_user(struct task_struct *target,
 {
        const struct user_regset *regset = &view->regsets[setno];
 
+       if (!regset->set)
+               return -EOPNOTSUPP;
+
        if (!access_ok(VERIFY_READ, data, size))
                return -EIO;