mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	drm: Don't call drm_for_each_crtc with a non-KMS driver
Fixes oops if userspace calls DRM_IOCTL_GET_CAP for
 DRM_CAP_PAGE_FLIP_TARGET on a non-KMS device node. (Normal userspace
doesn't do that, discovered by syzkaller)
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Fixes: f837297ad8 ("drm: Add DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags v2")
Cc: stable@vger.kernel.org
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161130083002.1520-1-michel@daenzer.net
			
			
This commit is contained in:
		
							parent
							
								
									e5517c2a5a
								
							
						
					
					
						commit
						e94bd1736f
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -254,10 +254,12 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
 | 
				
			||||||
		req->value = dev->mode_config.async_page_flip;
 | 
							req->value = dev->mode_config.async_page_flip;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case DRM_CAP_PAGE_FLIP_TARGET:
 | 
						case DRM_CAP_PAGE_FLIP_TARGET:
 | 
				
			||||||
		req->value = 1;
 | 
							if (drm_core_check_feature(dev, DRIVER_MODESET)) {
 | 
				
			||||||
		drm_for_each_crtc(crtc, dev) {
 | 
								req->value = 1;
 | 
				
			||||||
			if (!crtc->funcs->page_flip_target)
 | 
								drm_for_each_crtc(crtc, dev) {
 | 
				
			||||||
				req->value = 0;
 | 
									if (!crtc->funcs->page_flip_target)
 | 
				
			||||||
 | 
										req->value = 0;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case DRM_CAP_CURSOR_WIDTH:
 | 
						case DRM_CAP_CURSOR_WIDTH:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue