diff options
Diffstat (limited to 'drivers/video/fbmem.c')
-rw-r--r-- | drivers/video/fbmem.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index cfd9dce1ce0b..2ac32e6b5953 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -46,6 +46,17 @@ | |||
46 | struct fb_info *registered_fb[FB_MAX] __read_mostly; | 46 | struct fb_info *registered_fb[FB_MAX] __read_mostly; |
47 | int num_registered_fb __read_mostly; | 47 | int num_registered_fb __read_mostly; |
48 | 48 | ||
49 | int lock_fb_info(struct fb_info *info) | ||
50 | { | ||
51 | mutex_lock(&info->lock); | ||
52 | if (!info->fbops) { | ||
53 | mutex_unlock(&info->lock); | ||
54 | return 0; | ||
55 | } | ||
56 | return 1; | ||
57 | } | ||
58 | EXPORT_SYMBOL(lock_fb_info); | ||
59 | |||
49 | /* | 60 | /* |
50 | * Helpers | 61 | * Helpers |
51 | */ | 62 | */ |
@@ -1086,13 +1097,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
1086 | return -EINVAL; | 1097 | return -EINVAL; |
1087 | con2fb.framebuffer = -1; | 1098 | con2fb.framebuffer = -1; |
1088 | event.data = &con2fb; | 1099 | event.data = &con2fb; |
1089 | |||
1090 | if (!lock_fb_info(info)) | ||
1091 | return -ENODEV; | ||
1092 | event.info = info; | 1100 | event.info = info; |
1093 | fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event); | 1101 | fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event); |
1094 | unlock_fb_info(info); | ||
1095 | |||
1096 | ret = copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0; | 1102 | ret = copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0; |
1097 | break; | 1103 | break; |
1098 | case FBIOPUT_CON2FBMAP: | 1104 | case FBIOPUT_CON2FBMAP: |
@@ -1109,12 +1115,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
1109 | break; | 1115 | break; |
1110 | } | 1116 | } |
1111 | event.data = &con2fb; | 1117 | event.data = &con2fb; |
1112 | if (!lock_fb_info(info)) | ||
1113 | return -ENODEV; | ||
1114 | event.info = info; | 1118 | event.info = info; |
1115 | ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, | 1119 | ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, &event); |
1116 | &event); | ||
1117 | unlock_fb_info(info); | ||
1118 | break; | 1120 | break; |
1119 | case FBIOBLANK: | 1121 | case FBIOBLANK: |
1120 | if (!lock_fb_info(info)) | 1122 | if (!lock_fb_info(info)) |