There is no need to take SRCU lock before checking
file->ucontext, so move it do it before it.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
if (ret)
return ret;
+ if (!file->ucontext &&
+ (command != IB_USER_VERBS_CMD_GET_CONTEXT || extended))
+ return -EINVAL;
+
if (extended && count < (sizeof(hdr) + sizeof(ex_hdr)))
return -EINVAL;
goto out;
}
- if (!file->ucontext &&
- command != IB_USER_VERBS_CMD_GET_CONTEXT) {
- ret = -EINVAL;
- goto out;
- }
-
if (!extended) {
if (hdr.in_words * 4 != count) {
ret = -EINVAL;
struct ib_udata uhw;
size_t written_count = count;
- if (!file->ucontext) {
- ret = -EINVAL;
- goto out;
- }
-
if (copy_from_user(&ex_hdr, buf + sizeof(hdr), sizeof(ex_hdr))) {
ret = -EFAULT;
goto out;