.. | .. |
---|
165 | 165 | static __poll_t vmci_host_poll(struct file *filp, poll_table *wait) |
---|
166 | 166 | { |
---|
167 | 167 | struct vmci_host_dev *vmci_host_dev = filp->private_data; |
---|
168 | | - struct vmci_ctx *context = vmci_host_dev->context; |
---|
| 168 | + struct vmci_ctx *context; |
---|
169 | 169 | __poll_t mask = 0; |
---|
170 | 170 | |
---|
171 | 171 | if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) { |
---|
| 172 | + /* |
---|
| 173 | + * Read context only if ct_type == VMCIOBJ_CONTEXT to make |
---|
| 174 | + * sure that context is initialized |
---|
| 175 | + */ |
---|
| 176 | + context = vmci_host_dev->context; |
---|
| 177 | + |
---|
172 | 178 | /* Check for VMCI calls to this VM context. */ |
---|
173 | 179 | if (wait) |
---|
174 | 180 | poll_wait(filp, &context->host_context.wait_queue, |
---|