fbdev fixes and updates for kernel 6.1-rc1:

- fixes an use-after-free in smscufx USB graphics driver,
 - adds missing pci_disable_device() in tridentfb failure paths,
 - correctly handle irq detection failure in mb862xx driver,
 - fixes resume code in omapfb/dss,
 - drops unused code in controlfb, tridentfb, arkfb, imxfb and udlfb,
 - converts uvesafb to use scnprintf() instead of snprintf(),
 - converts gbefb to use dev_groups,
 - adds MODULE_DEVICE_TABLE() entry to vga16fb
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCY0F8FgAKCRD3ErUQojoP
 X4n3AP4tU3d/U+VFAxzQ5CKLIbKkk9qyJygFhF+QQ1aWuFYxSQEAmC+Yc6oEu/qw
 EhgtvSXHhEhBdy00I/Pj30+3O0BiUgA=
 =DqOe
 -----END PGP SIGNATURE-----

Merge tag 'fbdev-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev

Pull fbdev updates from Helge Deller:
 "Here's a fix for the smscufx USB graphics card to prevent a kernel
  crash if it's plugged in/out too fast.

  The other patches are mostly small cleanups, fixes in failure paths
  and code removal:

   - fix an use-after-free in smscufx USB graphics driver

   - add missing pci_disable_device() in tridentfb failure paths

   - correctly handle irq detection failure in mb862xx driver

   - fix resume code in omapfb/dss

   - drop unused code in controlfb, tridentfb, arkfb, imxfb and udlfb

   - convert uvesafb to use scnprintf() instead of snprintf()

   - convert gbefb to use dev_groups

   - add MODULE_DEVICE_TABLE() entry to vga16fb"

* tag 'fbdev-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
  fbdev: mb862xx: Fix check of return value from irq_of_parse_and_map()
  fbdev: vga16fb: Add missing MODULE_DEVICE_TABLE() entry
  fbdev: tridentfb: Fix missing pci_disable_device() in probe and remove
  fbdev: smscufx: Fix use-after-free in ufx_ops_open()
  fbdev: gbefb: Convert to use dev_groups
  fbdev: imxfb: Remove redundant dev_err() call
  fbdev: omapfb/dss: Use pm_runtime_resume_and_get() instead of pm_runtime_get_sync()
  fbdev: uvesafb: Convert snprintf to scnprintf
  fbdev: arkfb: Remove the unused function dac_read_reg()
  fbdev: tridentfb: Remove the unused function shadowmode_off()
  fbdev: controlfb: Remove the unused function VAR_MATCH()
  fbdev: udlfb: Remove redundant initialization to variable identical
This commit is contained in:
Linus Torvalds 2022-10-11 10:49:17 -07:00
commit eec4ed317d
16 changed files with 41 additions and 71 deletions

View File

@ -318,14 +318,6 @@ struct dac_info
void *data;
};
static inline u8 dac_read_reg(struct dac_info *info, u8 reg)
{
u8 code[2] = {reg, 0};
info->dac_read_regs(info->data, code, 1);
return code[1];
}
static inline void dac_read_regs(struct dac_info *info, u8 *code, int count)
{
info->dac_read_regs(info->data, code, count);

View File

@ -108,13 +108,6 @@ static inline int PAR_EQUAL(struct fb_par_control *x, struct fb_par_control *y)
return (!DIRTY(cmode) && !DIRTY(xres) && !DIRTY(yres)
&& !DIRTY(vxres) && !DIRTY(vyres));
}
static inline int VAR_MATCH(struct fb_var_screeninfo *x, struct fb_var_screeninfo *y)
{
return (!DIRTY(bits_per_pixel) && !DIRTY(xres)
&& !DIRTY(yres) && !DIRTY(xres_virtual)
&& !DIRTY(yres_virtual)
&& !DIRTY_CMAP(red) && !DIRTY_CMAP(green) && !DIRTY_CMAP(blue));
}
struct fb_info_control {
struct fb_info info;

View File

@ -1072,17 +1072,12 @@ static ssize_t gbefb_show_rev(struct device *device, struct device_attribute *at
static DEVICE_ATTR(revision, S_IRUGO, gbefb_show_rev, NULL);
static void gbefb_remove_sysfs(struct device *dev)
{
device_remove_file(dev, &dev_attr_size);
device_remove_file(dev, &dev_attr_revision);
}
static void gbefb_create_sysfs(struct device *dev)
{
device_create_file(dev, &dev_attr_size);
device_create_file(dev, &dev_attr_revision);
}
static struct attribute *gbefb_attrs[] = {
&dev_attr_size.attr,
&dev_attr_revision.attr,
NULL,
};
ATTRIBUTE_GROUPS(gbefb);
/*
* Initialization
@ -1221,7 +1216,6 @@ static int gbefb_probe(struct platform_device *p_dev)
}
platform_set_drvdata(p_dev, info);
gbefb_create_sysfs(&p_dev->dev);
fb_info(info, "%s rev %d @ 0x%08x using %dkB memory\n",
info->fix.id, gbe_revision, (unsigned)GBE_BASE,
@ -1248,7 +1242,6 @@ static int gbefb_remove(struct platform_device* p_dev)
gbe_turn_off();
arch_phys_wc_del(par->wc_cookie);
release_mem_region(GBE_BASE, sizeof(struct sgi_gbe));
gbefb_remove_sysfs(&p_dev->dev);
framebuffer_release(info);
return 0;
@ -1259,6 +1252,7 @@ static struct platform_driver gbefb_driver = {
.remove = gbefb_remove,
.driver = {
.name = "gbefb",
.dev_groups = gbefb_groups,
},
};

View File

@ -972,7 +972,6 @@ static int imxfb_probe(struct platform_device *pdev)
fbi->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(fbi->regs)) {
dev_err(&pdev->dev, "Cannot map frame buffer registers\n");
ret = PTR_ERR(fbi->regs);
goto failed_ioremap;
}

View File

@ -693,7 +693,7 @@ static int of_platform_mb862xx_probe(struct platform_device *ofdev)
par->dev = dev;
par->irq = irq_of_parse_and_map(np, 0);
if (par->irq == NO_IRQ) {
if (!par->irq) {
dev_err(dev, "failed to map irq\n");
ret = -ENODEV;
goto fbrel;

View File

@ -519,11 +519,9 @@ int dispc_runtime_get(void)
DSSDBG("dispc_runtime_get\n");
r = pm_runtime_get_sync(&dispc.pdev->dev);
if (WARN_ON(r < 0)) {
pm_runtime_put_sync(&dispc.pdev->dev);
r = pm_runtime_resume_and_get(&dispc.pdev->dev);
if (WARN_ON(r < 0))
return r;
}
return 0;
}
EXPORT_SYMBOL(dispc_runtime_get);

View File

@ -1136,11 +1136,9 @@ static int dsi_runtime_get(struct platform_device *dsidev)
DSSDBG("dsi_runtime_get\n");
r = pm_runtime_get_sync(&dsi->pdev->dev);
if (WARN_ON(r < 0)) {
pm_runtime_put_sync(&dsi->pdev->dev);
r = pm_runtime_resume_and_get(&dsi->pdev->dev);
if (WARN_ON(r < 0))
return r;
}
return 0;
}

View File

@ -767,11 +767,9 @@ int dss_runtime_get(void)
DSSDBG("dss_runtime_get\n");
r = pm_runtime_get_sync(&dss.pdev->dev);
if (WARN_ON(r < 0)) {
pm_runtime_put_sync(&dss.pdev->dev);
r = pm_runtime_resume_and_get(&dss.pdev->dev);
if (WARN_ON(r < 0))
return r;
}
return 0;
}

View File

@ -38,11 +38,9 @@ static int hdmi_runtime_get(void)
DSSDBG("hdmi_runtime_get\n");
r = pm_runtime_get_sync(&hdmi.pdev->dev);
if (WARN_ON(r < 0)) {
pm_runtime_put_sync(&hdmi.pdev->dev);
r = pm_runtime_resume_and_get(&hdmi.pdev->dev);
if (WARN_ON(r < 0))
return r;
}
return 0;
}

View File

@ -42,11 +42,9 @@ static int hdmi_runtime_get(void)
DSSDBG("hdmi_runtime_get\n");
r = pm_runtime_get_sync(&hdmi.pdev->dev);
if (WARN_ON(r < 0)) {
pm_runtime_put_sync(&hdmi.pdev->dev);
r = pm_runtime_resume_and_get(&hdmi.pdev->dev);
if (WARN_ON(r < 0))
return r;
}
return 0;
}

View File

@ -347,11 +347,9 @@ static int venc_runtime_get(void)
DSSDBG("venc_runtime_get\n");
r = pm_runtime_get_sync(&venc.pdev->dev);
if (WARN_ON(r < 0)) {
pm_runtime_put_sync(&venc.pdev->dev);
r = pm_runtime_resume_and_get(&venc.pdev->dev);
if (WARN_ON(r < 0))
return r;
}
return 0;
}

View File

@ -137,6 +137,8 @@ static int ufx_submit_urb(struct ufx_data *dev, struct urb * urb, size_t len);
static int ufx_alloc_urb_list(struct ufx_data *dev, int count, size_t size);
static void ufx_free_urb_list(struct ufx_data *dev);
static DEFINE_MUTEX(disconnect_mutex);
/* reads a control register */
static int ufx_reg_read(struct ufx_data *dev, u32 index, u32 *data)
{
@ -1071,9 +1073,13 @@ static int ufx_ops_open(struct fb_info *info, int user)
if (user == 0 && !console)
return -EBUSY;
mutex_lock(&disconnect_mutex);
/* If the USB device is gone, we don't accept new opens */
if (dev->virtualized)
if (dev->virtualized) {
mutex_unlock(&disconnect_mutex);
return -ENODEV;
}
dev->fb_count++;
@ -1097,6 +1103,8 @@ static int ufx_ops_open(struct fb_info *info, int user)
pr_debug("open /dev/fb%d user=%d fb_info=%p count=%d",
info->node, user, info, dev->fb_count);
mutex_unlock(&disconnect_mutex);
return 0;
}
@ -1741,6 +1749,8 @@ static void ufx_usb_disconnect(struct usb_interface *interface)
{
struct ufx_data *dev;
mutex_lock(&disconnect_mutex);
dev = usb_get_intfdata(interface);
pr_debug("USB disconnect starting\n");
@ -1761,6 +1771,8 @@ static void ufx_usb_disconnect(struct usb_interface *interface)
kref_put(&dev->kref, ufx_free);
/* consider ufx_data freed */
mutex_unlock(&disconnect_mutex);
}
static struct usb_driver ufx_driver = {

View File

@ -1128,11 +1128,6 @@ static inline void shadowmode_on(struct tridentfb_par *par)
write3CE(par, CyberControl, read3CE(par, CyberControl) | 0x81);
}
static inline void shadowmode_off(struct tridentfb_par *par)
{
write3CE(par, CyberControl, read3CE(par, CyberControl) & 0x7E);
}
/* Set the hardware to the requested video mode */
static int tridentfb_set_par(struct fb_info *info)
{
@ -1475,7 +1470,7 @@ static int trident_pci_probe(struct pci_dev *dev,
if (err)
return err;
err = pci_enable_device(dev);
err = pcim_enable_device(dev);
if (err)
return err;
@ -1715,12 +1710,10 @@ out_unmap2:
kfree(info->pixmap.addr);
if (info->screen_base)
iounmap(info->screen_base);
release_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len);
disable_mmio(info->par);
out_unmap1:
if (default_par->io_virt)
iounmap(default_par->io_virt);
release_mem_region(tridentfb_fix.mmio_start, tridentfb_fix.mmio_len);
framebuffer_release(info);
return err;
}
@ -1735,8 +1728,6 @@ static void trident_pci_remove(struct pci_dev *dev)
i2c_del_adapter(&par->ddc_adapter);
iounmap(par->io_virt);
iounmap(info->screen_base);
release_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len);
release_mem_region(tridentfb_fix.mmio_start, tridentfb_fix.mmio_len);
kfree(info->pixmap.addr);
fb_dealloc_cmap(&info->cmap);
framebuffer_release(info);

View File

@ -370,7 +370,7 @@ static int dlfb_trim_hline(const u8 *bback, const u8 **bfront, int *width_bytes)
const unsigned long *back = (const unsigned long *) bback;
const unsigned long *front = (const unsigned long *) *bfront;
const int width = *width_bytes / sizeof(unsigned long);
int identical = width;
int identical;
int start = width;
int end = width;

View File

@ -1580,7 +1580,7 @@ static ssize_t uvesafb_show_vendor(struct device *dev,
struct uvesafb_par *par = info->par;
if (par->vbe_ib.oem_vendor_name_ptr)
return snprintf(buf, PAGE_SIZE, "%s\n", (char *)
return scnprintf(buf, PAGE_SIZE, "%s\n", (char *)
(&par->vbe_ib) + par->vbe_ib.oem_vendor_name_ptr);
else
return 0;
@ -1595,7 +1595,7 @@ static ssize_t uvesafb_show_product_name(struct device *dev,
struct uvesafb_par *par = info->par;
if (par->vbe_ib.oem_product_name_ptr)
return snprintf(buf, PAGE_SIZE, "%s\n", (char *)
return scnprintf(buf, PAGE_SIZE, "%s\n", (char *)
(&par->vbe_ib) + par->vbe_ib.oem_product_name_ptr);
else
return 0;
@ -1610,7 +1610,7 @@ static ssize_t uvesafb_show_product_rev(struct device *dev,
struct uvesafb_par *par = info->par;
if (par->vbe_ib.oem_product_rev_ptr)
return snprintf(buf, PAGE_SIZE, "%s\n", (char *)
return scnprintf(buf, PAGE_SIZE, "%s\n", (char *)
(&par->vbe_ib) + par->vbe_ib.oem_product_rev_ptr);
else
return 0;
@ -1625,7 +1625,7 @@ static ssize_t uvesafb_show_oem_string(struct device *dev,
struct uvesafb_par *par = info->par;
if (par->vbe_ib.oem_string_ptr)
return snprintf(buf, PAGE_SIZE, "%s\n",
return scnprintf(buf, PAGE_SIZE, "%s\n",
(char *)(&par->vbe_ib) + par->vbe_ib.oem_string_ptr);
else
return 0;
@ -1639,7 +1639,7 @@ static ssize_t uvesafb_show_nocrtc(struct device *dev,
struct fb_info *info = dev_get_drvdata(dev);
struct uvesafb_par *par = info->par;
return snprintf(buf, PAGE_SIZE, "%d\n", par->nocrtc);
return scnprintf(buf, PAGE_SIZE, "%d\n", par->nocrtc);
}
static ssize_t uvesafb_store_nocrtc(struct device *dev,

View File

@ -1421,6 +1421,7 @@ static const struct platform_device_id vga16fb_driver_id_table[] = {
{"vga-framebuffer", 0},
{ }
};
MODULE_DEVICE_TABLE(platform, vga16fb_driver_id_table);
static struct platform_driver vga16fb_driver = {
.probe = vga16fb_probe,