hdmitx: fix edid parse crash [1/1]
authorhang cheng <hang.cheng@amlogic.com>
Tue, 29 Jun 2021 12:59:51 +0000 (20:59 +0800)
committerNolen Johnson <johnsonnolen@gmail.com>
Tue, 21 Dec 2021 18:34:38 +0000 (13:34 -0500)
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 <hang.cheng@amlogic.com>
drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c
drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c

index b8a0a78d6b921f309ecdc5c5f3e21f1b74dfad6f..854d16ad9f559026783a582914eef4e6498ae176 100644 (file)
@@ -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)
index 795c9d17086701a22eb0225ac0c70c739427772e..17f7ce3611d184952182155ffb22710ecfcb4d0b 100644 (file)
@@ -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);