From: hang cheng Date: Tue, 29 Jun 2021 12:59:51 +0000 (+0800) Subject: hdmitx: fix edid parse crash [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=94fca52dcef30e60f87cef8f49abc040baa6ca19;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git hdmitx: fix edid parse crash [1/1] PD#SWPL-56548 Problem: may block during spinlock cause crash Solution: move block outside of spinlock Verify: AB311 Change-Id: If0086cf3dd53b3426c8c2132e4718e36d06cb866 Signed-off-by: hang cheng --- diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c index b8a0a78d6b92..854d16ad9f55 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c @@ -395,7 +395,6 @@ static void set_vsdb_phy_addr(struct hdmitx_dev *hdev, ((vsdb->c & 0xf) << 4) | ((vsdb->d & 0xf) << 0); hdev->physical_addr = phy_addr; - hdmitx_event_notify(HDMITX_PHY_ADDR_VALID, &phy_addr); } static void set_vsdb_dc_cap(struct rx_cap *prxcap) diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c index 795c9d170867..17f7ce3611d1 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c @@ -4424,6 +4424,26 @@ static ssize_t store_sysctrl_enable(struct device *dev, return count; } +static ssize_t hdr_mute_frame_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int pos = 0; + + pos += snprintf(buf + pos, PAGE_SIZE, "%d\r\n", hdr_mute_frame); + return pos; +} + +static ssize_t hdr_mute_frame_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + unsigned long mute_frame = 0; + + pr_info("set hdr_mute_frame: %s\n", buf); + if (kstrtoul(buf, 10, &mute_frame) == 0) + hdr_mute_frame = mute_frame; + return count; +} + #undef pr_fmt #define pr_fmt(fmt) "" fmt void print_drm_config_data(void) @@ -5109,6 +5129,8 @@ static DEVICE_ATTR(hdmi_rx_info, 0444, show_hdmirx_info, NULL); static DEVICE_ATTR(hdmi_hsty_config_info, 0444, show_hdmi_hsty_config, NULL); static DEVICE_ATTR(sysctrl_enable, 0664, show_sysctrl_enable, store_sysctrl_enable); +static DEVICE_ATTR(hdr_mute_frame, 0664, + hdr_mute_frame_show, hdr_mute_frame_store); static struct vinfo_s *hdmitx_get_current_vinfo(void) { @@ -5480,6 +5502,7 @@ static void hdmitx_get_edid(struct hdmitx_dev *hdev) pr_info("clear dv_info\n"); } spin_unlock_irqrestore(&hdev->edid_spinlock, flags); + hdmitx_event_notify(HDMITX_PHY_ADDR_VALID, &hdev->physical_addr); hdmitx_edid_buf_compare_print(hdev); mutex_unlock(&getedid_mutex); } @@ -6497,6 +6520,7 @@ static int amhdmitx_probe(struct platform_device *pdev) ret = device_create_file(dev, &dev_attr_hdmi_hsty_config_info); ret = device_create_file(dev, &dev_attr_drm_mode_setting); ret = device_create_file(dev, &dev_attr_sysctrl_enable); + ret = device_create_file(dev, &dev_attr_hdr_mute_frame); #ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND register_early_suspend(&hdmitx_early_suspend_handler); @@ -6617,6 +6641,7 @@ static int amhdmitx_remove(struct platform_device *pdev) device_remove_file(dev, &dev_attr_hdmi_hsty_config_info); device_remove_file(dev, &dev_attr_drm_mode_setting); device_remove_file(dev, &dev_attr_sysctrl_enable); + device_remove_file(dev, &dev_attr_hdr_mute_frame); cdev_del(&hdmitx_device.cdev);