source: N950F DSH1 lineage-16.0
authorMichael Benedict <michaelbt@live.com>
Fri, 30 Aug 2019 14:24:16 +0000 (00:24 +1000)
committerMichael Benedict <michaelbt@live.com>
Fri, 30 Aug 2019 14:24:45 +0000 (00:24 +1000)
Signed-off-by: Michael Benedict <michaelbt@live.com>
drivers/staging/android/freecess.c
drivers/video/fbdev/exynos/dpu/displayport_edid.c

index e8d9fd442fd5633729ca1f16778003284776e957..af97bf7ccb72b4da85dee27d2613a1327a3e0f02 100644 (file)
@@ -281,11 +281,19 @@ static void recv_handler(struct sk_buff *skb)
        struct kfreecess_msg_data *payload = NULL;
        struct nlmsghdr *nlh = NULL;
        unsigned int msglen  = 0;
+       uid_t uid = 0;
 
        if (!skb) {
                pr_err("recv_handler %s: skb is NULL!\n", __func__);
                return;
        }
+       
+       uid = (*NETLINK_CREDS(skb)).uid.val;
+       //only allow system user to communicate with Freecess kernel part.
+       if (uid != 1000) {
+               pr_err("freecess--uid: %d, permission denied\n", uid);
+               return;
+       }
 
        if (skb->len >= NLMSG_SPACE(0)) {
                nlh = nlmsg_hdr(skb);
@@ -302,10 +310,15 @@ static void recv_handler(struct sk_buff *skb)
                                pr_err("USER_HOOK_CALLBACK %s: dst_portid is %d not kernel!\n", __func__, payload->dst_portid);
                                return;
                        }
+                       
+                       if (!check_mod_type(payload->mod)) {
+                               pr_err("USER_HOOK_CALLBACK %s: mod %d is not valid!\n", __func__, payload->mod);
+                               return;
+                       }
 
-                       atomic_set(&bind_port[payload->mod], payload->src_portid);
                        switch (payload->type) {
                        case LOOPBACK_MSG:
+                               atomic_set(&bind_port[payload->mod], payload->src_portid);
                                dump_kfreecess_msg(payload);
                                mod_sendmsg(LOOPBACK_MSG, payload->mod, NULL);
                                break;
index f8fe13c4967c92bb4e4e7a4dd8e394d525fb514d..1a9442505817bc9e1750c47d72189a998fe4dcad 100644 (file)
@@ -68,11 +68,11 @@ struct displayport_supported_preset displayport_supported_presets[] = {
        {V4L2_DV_BT_CEA_4096X2160P60,   4096, 2160, 60, FB_VMODE_NONINTERLACED, 102, "4096x2160p@60"},
 };
 
-videoformat ud_mode_h14b_vsdb[] = {
-       v3840x2160p_30Hz,
-       v3840x2160p_25Hz,
-       v3840x2160p_24Hz,
-       v4096x2160p_24Hz
+struct displayport_supported_preset ud_mode_h14b_vsdb[] = {
+       {V4L2_DV_BT_CEA_3840X2160P30,       3840, 2160, 30, FB_VMODE_NONINTERLACED,  95, "3840x2160p@30"},
+       {V4L2_DV_BT_CEA_3840X2160P25,       3840, 2160, 25, FB_VMODE_NONINTERLACED,  94, "3840x2160p@25"},
+       {V4L2_DV_BT_CEA_3840X2160P24,       3840, 2160, 24, FB_VMODE_NONINTERLACED,  93, "3840x2160p@24"},
+       {V4L2_DV_BT_CEA_4096X2160P24,       4096, 2160, 24, FB_VMODE_NONINTERLACED,  98, "4096x2160p@24"}
 };
 
 const int displayport_pre_cnt = ARRAY_SIZE(displayport_supported_presets);
@@ -426,10 +426,8 @@ static int edid_parse_audio_video_db(unsigned char *edid, struct fb_audio *sad)
        return 0;
 }
 
-int static edid_dv_timing_to_fb_video(videoformat video, struct fb_videomode *fb)
+int static edid_dv_timing_to_fb_video(struct displayport_supported_preset pre, struct fb_videomode *fb)
 {
-       struct displayport_supported_preset pre = displayport_supported_presets[video];
-
        fb->name = pre.name;
        fb->refresh = pre.refresh;
        fb->xres = pre.dv_timings.bt.width;