static bool
 drm_mode_expose_to_userspace(const struct drm_display_mode *mode,
-                            const struct list_head *export_list,
+                            const struct list_head *modes,
                             const struct drm_file *file_priv)
 {
        /*
         * while preparing the list of user-modes.
         */
        if (!file_priv->aspect_ratio_allowed) {
-               struct drm_display_mode *mode_itr;
+               const struct drm_display_mode *mode_itr;
 
-               list_for_each_entry(mode_itr, export_list, export_head)
-                       if (drm_mode_match(mode_itr, mode,
+               list_for_each_entry(mode_itr, modes, head) {
+                       if (mode_itr->expose_to_userspace &&
+                           drm_mode_match(mode_itr, mode,
                                           DRM_MODE_MATCH_TIMINGS |
                                           DRM_MODE_MATCH_CLOCK |
                                           DRM_MODE_MATCH_FLAGS |
                                           DRM_MODE_MATCH_3D_FLAGS))
                                return false;
+               }
        }
 
        return true;
        struct drm_mode_modeinfo u_mode;
        struct drm_mode_modeinfo __user *mode_ptr;
        uint32_t __user *encoder_ptr;
-       LIST_HEAD(export_list);
 
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EOPNOTSUPP;
        out_resp->connection = connector->status;
 
        /* delayed so we get modes regardless of pre-fill_modes state */
-       list_for_each_entry(mode, &connector->modes, head)
-               if (drm_mode_expose_to_userspace(mode, &export_list,
+       list_for_each_entry(mode, &connector->modes, head) {
+               WARN_ON(mode->expose_to_userspace);
+
+               if (drm_mode_expose_to_userspace(mode, &connector->modes,
                                                 file_priv)) {
-                       list_add_tail(&mode->export_head, &export_list);
+                       mode->expose_to_userspace = true;
                        mode_count++;
                }
+       }
 
        /*
         * This ioctl is called twice, once to determine how much space is
         * needed, and the 2nd time to fill it.
-        * The modes that need to be exposed to the user are maintained in the
-        * 'export_list'. When the ioctl is called first time to determine the,
-        * space, the export_list gets filled, to find the no.of modes. In the
-        * 2nd time, the user modes are filled, one by one from the export_list.
         */
        if ((out_resp->count_modes >= mode_count) && mode_count) {
                copied = 0;
                mode_ptr = (struct drm_mode_modeinfo __user *)(unsigned long)out_resp->modes_ptr;
-               list_for_each_entry(mode, &export_list, export_head) {
+               list_for_each_entry(mode, &connector->modes, head) {
+                       if (!mode->expose_to_userspace)
+                               continue;
+
+                       /* Clear the tag for the next time around */
+                       mode->expose_to_userspace = false;
+
                        drm_mode_convert_to_umode(&u_mode, mode);
                        /*
                         * Reset aspect ratio flags of user-mode, if modes with
                        if (copy_to_user(mode_ptr + copied,
                                         &u_mode, sizeof(u_mode))) {
                                ret = -EFAULT;
+
+                               /*
+                                * Clear the tag for the rest of
+                                * the modes for the next time around.
+                                */
+                               list_for_each_entry_continue(mode, &connector->modes, head)
+                                       mode->expose_to_userspace = false;
+
                                mutex_unlock(&dev->mode_config.mutex);
 
                                goto out;
                        }
                        copied++;
                }
+       } else {
+               /* Clear the tag for the next time around */
+               list_for_each_entry(mode, &connector->modes, head)
+                       mode->expose_to_userspace = false;
        }
+
        out_resp->count_modes = mode_count;
        mutex_unlock(&dev->mode_config.mutex);
 
 
        u8 type;
 
        /**
-        * @head:
+        * @expose_to_userspace:
         *
-        * struct list_head for mode lists.
+        * Indicates whether the mode is to be exposed to the userspace.
+        * This is to maintain a set of exposed modes while preparing
+        * user-mode's list in drm_mode_getconnector ioctl. The purpose of
+        * this only lies in the ioctl function, and is not to be used
+        * outside the function.
         */
-       struct list_head head;
+       bool expose_to_userspace;
 
        /**
-        * @export_head:
+        * @head:
         *
-        * struct list_head for modes to be exposed to the userspace.
-        * This is to maintain a list of exposed modes while preparing
-        * user-mode's list in drm_mode_getconnector ioctl. The purpose of this
-        * list_head only lies in the ioctl function, and is not expected to be
-        * used outside the function.
-        * Once used, the stale pointers are not reset, but left as it is, to
-        * avoid overhead of protecting it by mode_config.mutex.
+        * struct list_head for mode lists.
         */
-       struct list_head export_head;
+       struct list_head head;
 
        /**
         * @name: