Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vt8623fb: fix kernel oops

commit 20e061fb750d36ec0ffcb2e44ed7dafa9018223b
Author: Ondrej Zajicek <santiago@crfreenet.org>
Date: Mon Apr 28 02:15:18 2008 -0700

fbdev: framebuffer_alloc() fixes

Correct the dev arg of framebuffer_alloc() in arkfb, s3fb and vt8623fb.

causes a null-pointer deref because "info->dev is NULL, info was just
kzallocated".

Signed-off-by: Ondrej Zajicek <santiago@crfreenet.org>
Reported-by: "MadLoisae@gmx.net" <MadLoisae@gmx.net>
Tested-by: "MadLoisae@gmx.net" <MadLoisae@gmx.net>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: <stable@kernel.org> [2.6.26.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Ondrej Zajicek and committed by
Linus Torvalds
594a8819 c6e2bee2

+28 -28
+9 -9
drivers/video/arkfb.c
··· 958 958 /* Prepare PCI device */ 959 959 rc = pci_enable_device(dev); 960 960 if (rc < 0) { 961 - dev_err(info->dev, "cannot enable PCI device\n"); 961 + dev_err(info->device, "cannot enable PCI device\n"); 962 962 goto err_enable_device; 963 963 } 964 964 965 965 rc = pci_request_regions(dev, "arkfb"); 966 966 if (rc < 0) { 967 - dev_err(info->dev, "cannot reserve framebuffer region\n"); 967 + dev_err(info->device, "cannot reserve framebuffer region\n"); 968 968 goto err_request_regions; 969 969 } 970 970 971 971 par->dac = ics5342_init(ark_dac_read_regs, ark_dac_write_regs, info); 972 972 if (! par->dac) { 973 973 rc = -ENOMEM; 974 - dev_err(info->dev, "RAMDAC initialization failed\n"); 974 + dev_err(info->device, "RAMDAC initialization failed\n"); 975 975 goto err_dac; 976 976 } 977 977 ··· 982 982 info->screen_base = pci_iomap(dev, 0, 0); 983 983 if (! info->screen_base) { 984 984 rc = -ENOMEM; 985 - dev_err(info->dev, "iomap for framebuffer failed\n"); 985 + dev_err(info->device, "iomap for framebuffer failed\n"); 986 986 goto err_iomap; 987 987 } 988 988 ··· 1004 1004 rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8); 1005 1005 if (! ((rc == 1) || (rc == 2))) { 1006 1006 rc = -EINVAL; 1007 - dev_err(info->dev, "mode %s not found\n", mode_option); 1007 + dev_err(info->device, "mode %s not found\n", mode_option); 1008 1008 goto err_find_mode; 1009 1009 } 1010 1010 1011 1011 rc = fb_alloc_cmap(&info->cmap, 256, 0); 1012 1012 if (rc < 0) { 1013 - dev_err(info->dev, "cannot allocate colormap\n"); 1013 + dev_err(info->device, "cannot allocate colormap\n"); 1014 1014 goto err_alloc_cmap; 1015 1015 } 1016 1016 1017 1017 rc = register_framebuffer(info); 1018 1018 if (rc < 0) { 1019 - dev_err(info->dev, "cannot register framebugger\n"); 1019 + dev_err(info->device, "cannot register framebugger\n"); 1020 1020 goto err_reg_fb; 1021 1021 } 1022 1022 ··· 1090 1090 struct fb_info *info = pci_get_drvdata(dev); 1091 1091 struct arkfb_info *par = info->par; 1092 1092 1093 - dev_info(info->dev, "suspend\n"); 1093 + dev_info(info->device, "suspend\n"); 1094 1094 1095 1095 acquire_console_sem(); 1096 1096 mutex_lock(&(par->open_lock)); ··· 1121 1121 struct fb_info *info = pci_get_drvdata(dev); 1122 1122 struct arkfb_info *par = info->par; 1123 1123 1124 - dev_info(info->dev, "resume\n"); 1124 + dev_info(info->device, "resume\n"); 1125 1125 1126 1126 acquire_console_sem(); 1127 1127 mutex_lock(&(par->open_lock));
+9 -9
drivers/video/s3fb.c
··· 903 903 /* Prepare PCI device */ 904 904 rc = pci_enable_device(dev); 905 905 if (rc < 0) { 906 - dev_err(info->dev, "cannot enable PCI device\n"); 906 + dev_err(info->device, "cannot enable PCI device\n"); 907 907 goto err_enable_device; 908 908 } 909 909 910 910 rc = pci_request_regions(dev, "s3fb"); 911 911 if (rc < 0) { 912 - dev_err(info->dev, "cannot reserve framebuffer region\n"); 912 + dev_err(info->device, "cannot reserve framebuffer region\n"); 913 913 goto err_request_regions; 914 914 } 915 915 ··· 921 921 info->screen_base = pci_iomap(dev, 0, 0); 922 922 if (! info->screen_base) { 923 923 rc = -ENOMEM; 924 - dev_err(info->dev, "iomap for framebuffer failed\n"); 924 + dev_err(info->device, "iomap for framebuffer failed\n"); 925 925 goto err_iomap; 926 926 } 927 927 ··· 965 965 rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8); 966 966 if (! ((rc == 1) || (rc == 2))) { 967 967 rc = -EINVAL; 968 - dev_err(info->dev, "mode %s not found\n", mode_option); 968 + dev_err(info->device, "mode %s not found\n", mode_option); 969 969 goto err_find_mode; 970 970 } 971 971 972 972 rc = fb_alloc_cmap(&info->cmap, 256, 0); 973 973 if (rc < 0) { 974 - dev_err(info->dev, "cannot allocate colormap\n"); 974 + dev_err(info->device, "cannot allocate colormap\n"); 975 975 goto err_alloc_cmap; 976 976 } 977 977 978 978 rc = register_framebuffer(info); 979 979 if (rc < 0) { 980 - dev_err(info->dev, "cannot register framebuffer\n"); 980 + dev_err(info->device, "cannot register framebuffer\n"); 981 981 goto err_reg_fb; 982 982 } 983 983 ··· 1053 1053 struct fb_info *info = pci_get_drvdata(dev); 1054 1054 struct s3fb_info *par = info->par; 1055 1055 1056 - dev_info(info->dev, "suspend\n"); 1056 + dev_info(info->device, "suspend\n"); 1057 1057 1058 1058 acquire_console_sem(); 1059 1059 mutex_lock(&(par->open_lock)); ··· 1085 1085 struct s3fb_info *par = info->par; 1086 1086 int err; 1087 1087 1088 - dev_info(info->dev, "resume\n"); 1088 + dev_info(info->device, "resume\n"); 1089 1089 1090 1090 acquire_console_sem(); 1091 1091 mutex_lock(&(par->open_lock)); ··· 1102 1102 if (err) { 1103 1103 mutex_unlock(&(par->open_lock)); 1104 1104 release_console_sem(); 1105 - dev_err(info->dev, "error %d enabling device for resume\n", err); 1105 + dev_err(info->device, "error %d enabling device for resume\n", err); 1106 1106 return err; 1107 1107 } 1108 1108 pci_set_master(dev);
+10 -10
drivers/video/vt8623fb.c
··· 677 677 678 678 rc = pci_enable_device(dev); 679 679 if (rc < 0) { 680 - dev_err(info->dev, "cannot enable PCI device\n"); 680 + dev_err(info->device, "cannot enable PCI device\n"); 681 681 goto err_enable_device; 682 682 } 683 683 684 684 rc = pci_request_regions(dev, "vt8623fb"); 685 685 if (rc < 0) { 686 - dev_err(info->dev, "cannot reserve framebuffer region\n"); 686 + dev_err(info->device, "cannot reserve framebuffer region\n"); 687 687 goto err_request_regions; 688 688 } 689 689 ··· 696 696 info->screen_base = pci_iomap(dev, 0, 0); 697 697 if (! info->screen_base) { 698 698 rc = -ENOMEM; 699 - dev_err(info->dev, "iomap for framebuffer failed\n"); 699 + dev_err(info->device, "iomap for framebuffer failed\n"); 700 700 goto err_iomap_1; 701 701 } 702 702 703 703 par->mmio_base = pci_iomap(dev, 1, 0); 704 704 if (! par->mmio_base) { 705 705 rc = -ENOMEM; 706 - dev_err(info->dev, "iomap for MMIO failed\n"); 706 + dev_err(info->device, "iomap for MMIO failed\n"); 707 707 goto err_iomap_2; 708 708 } 709 709 ··· 714 714 if ((16 <= memsize1) && (memsize1 <= 64) && (memsize1 == memsize2)) 715 715 info->screen_size = memsize1 << 20; 716 716 else { 717 - dev_err(info->dev, "memory size detection failed (%x %x), suppose 16 MB\n", memsize1, memsize2); 717 + dev_err(info->device, "memory size detection failed (%x %x), suppose 16 MB\n", memsize1, memsize2); 718 718 info->screen_size = 16 << 20; 719 719 } 720 720 ··· 731 731 rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8); 732 732 if (! ((rc == 1) || (rc == 2))) { 733 733 rc = -EINVAL; 734 - dev_err(info->dev, "mode %s not found\n", mode_option); 734 + dev_err(info->device, "mode %s not found\n", mode_option); 735 735 goto err_find_mode; 736 736 } 737 737 738 738 rc = fb_alloc_cmap(&info->cmap, 256, 0); 739 739 if (rc < 0) { 740 - dev_err(info->dev, "cannot allocate colormap\n"); 740 + dev_err(info->device, "cannot allocate colormap\n"); 741 741 goto err_alloc_cmap; 742 742 } 743 743 744 744 rc = register_framebuffer(info); 745 745 if (rc < 0) { 746 - dev_err(info->dev, "cannot register framebugger\n"); 746 + dev_err(info->device, "cannot register framebugger\n"); 747 747 goto err_reg_fb; 748 748 } 749 749 ··· 817 817 struct fb_info *info = pci_get_drvdata(dev); 818 818 struct vt8623fb_info *par = info->par; 819 819 820 - dev_info(info->dev, "suspend\n"); 820 + dev_info(info->device, "suspend\n"); 821 821 822 822 acquire_console_sem(); 823 823 mutex_lock(&(par->open_lock)); ··· 848 848 struct fb_info *info = pci_get_drvdata(dev); 849 849 struct vt8623fb_info *par = info->par; 850 850 851 - dev_info(info->dev, "resume\n"); 851 + dev_info(info->device, "resume\n"); 852 852 853 853 acquire_console_sem(); 854 854 mutex_lock(&(par->open_lock));