]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Mon, 25 Jul 2022 18:15:17 +0000 (14:15 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 25 Jul 2022 18:15:17 +0000 (14:15 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/dlm-fix-pending-remove-if-msg-allocation-fails.patch [new file with mode: 0644]
queue-4.19/drm-tilcdc-remove-obsolete-crtc_mode_valid-hack.patch [new file with mode: 0644]
queue-4.19/hid-add-always_poll-quirk-to-lenovo-pixart-mouse.patch [new file with mode: 0644]
queue-4.19/hid-multitouch-add-support-for-the-smart-tech-panel.patch [new file with mode: 0644]
queue-4.19/hid-multitouch-lenovo-x1-tablet-gen3-trackpoint-and-.patch [new file with mode: 0644]
queue-4.19/hid-multitouch-simplify-the-application-retrieval.patch [new file with mode: 0644]
queue-4.19/ima-remove-the-ima_template-kconfig-option.patch [new file with mode: 0644]
queue-4.19/series
queue-4.19/tilcdc-tilcdc_external-fix-an-incorrect-null-check-o.patch [new file with mode: 0644]

diff --git a/queue-4.19/dlm-fix-pending-remove-if-msg-allocation-fails.patch b/queue-4.19/dlm-fix-pending-remove-if-msg-allocation-fails.patch
new file mode 100644 (file)
index 0000000..979b033
--- /dev/null
@@ -0,0 +1,47 @@
+From 6ba8620fb25cf6224edd1e67cf98824b33125a62 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 6 Apr 2022 13:34:16 -0400
+Subject: dlm: fix pending remove if msg allocation fails
+
+From: Alexander Aring <aahringo@redhat.com>
+
+[ Upstream commit ba58995909b5098ca4003af65b0ccd5a8d13dd25 ]
+
+This patch unsets ls_remove_len and ls_remove_name if a message
+allocation of a remove messages fails. In this case we never send a
+remove message out but set the per ls ls_remove_len ls_remove_name
+variable for a pending remove. Unset those variable should indicate
+possible waiters in wait_pending_remove() that no pending remove is
+going on at this moment.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Alexander Aring <aahringo@redhat.com>
+Signed-off-by: David Teigland <teigland@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/dlm/lock.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
+index ac53403e9edb..35bfb681bf13 100644
+--- a/fs/dlm/lock.c
++++ b/fs/dlm/lock.c
+@@ -4069,13 +4069,14 @@ static void send_repeat_remove(struct dlm_ls *ls, char *ms_name, int len)
+       rv = _create_message(ls, sizeof(struct dlm_message) + len,
+                            dir_nodeid, DLM_MSG_REMOVE, &ms, &mh);
+       if (rv)
+-              return;
++              goto out;
+       memcpy(ms->m_extra, name, len);
+       ms->m_hash = hash;
+       send_message(mh, ms);
++out:
+       spin_lock(&ls->ls_remove_spin);
+       ls->ls_remove_len = 0;
+       memset(ls->ls_remove_name, 0, DLM_RESNAME_MAXLEN);
+-- 
+2.35.1
+
diff --git a/queue-4.19/drm-tilcdc-remove-obsolete-crtc_mode_valid-hack.patch b/queue-4.19/drm-tilcdc-remove-obsolete-crtc_mode_valid-hack.patch
new file mode 100644 (file)
index 0000000..27721d2
--- /dev/null
@@ -0,0 +1,332 @@
+From 310cbd0b4a44210fed0ec7434b8d1d5e24ba6e8b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 2 Aug 2019 15:55:22 +0300
+Subject: drm/tilcdc: Remove obsolete crtc_mode_valid() hack
+
+From: Jyri Sarha <jsarha@ti.com>
+
+[ Upstream commit 57d8396504b3a93f284e51b866740a3e7419a3d9 ]
+
+Earlier there were no mode_valid() helper for crtc and tilcdc had a
+hack to over come this limitation. But now the mode_valid() helper is
+there (has been since v4.13), so it is about time to get rid of that
+hack.
+
+Signed-off-by: Jyri Sarha <jsarha@ti.com>
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/ <5c4dcb5b1e7975bd2b7ca86f7addf219cd0f9a06.1564750248.git.jsarha@ti.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/tilcdc/tilcdc_crtc.c     | 28 +++-----
+ drivers/gpu/drm/tilcdc/tilcdc_drv.c      |  1 -
+ drivers/gpu/drm/tilcdc/tilcdc_drv.h      |  2 -
+ drivers/gpu/drm/tilcdc/tilcdc_external.c | 88 +++---------------------
+ drivers/gpu/drm/tilcdc/tilcdc_external.h |  1 -
+ drivers/gpu/drm/tilcdc/tilcdc_panel.c    |  9 ---
+ drivers/gpu/drm/tilcdc/tilcdc_tfp410.c   |  9 ---
+ 7 files changed, 19 insertions(+), 119 deletions(-)
+
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+index 1067e702c22c..31a2d1ecce3e 100644
+--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
++++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+@@ -657,9 +657,6 @@ static bool tilcdc_crtc_mode_fixup(struct drm_crtc *crtc,
+ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc,
+                                   struct drm_crtc_state *state)
+ {
+-      struct drm_display_mode *mode = &state->mode;
+-      int ret;
+-
+       /* If we are not active we don't care */
+       if (!state->active)
+               return 0;
+@@ -671,12 +668,6 @@ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc,
+               return -EINVAL;
+       }
+-      ret = tilcdc_crtc_mode_valid(crtc, mode);
+-      if (ret) {
+-              dev_dbg(crtc->dev->dev, "Mode \"%s\" not valid", mode->name);
+-              return -EINVAL;
+-      }
+-
+       return 0;
+ }
+@@ -728,13 +719,6 @@ static const struct drm_crtc_funcs tilcdc_crtc_funcs = {
+       .disable_vblank = tilcdc_crtc_disable_vblank,
+ };
+-static const struct drm_crtc_helper_funcs tilcdc_crtc_helper_funcs = {
+-              .mode_fixup     = tilcdc_crtc_mode_fixup,
+-              .atomic_check   = tilcdc_crtc_atomic_check,
+-              .atomic_enable  = tilcdc_crtc_atomic_enable,
+-              .atomic_disable = tilcdc_crtc_atomic_disable,
+-};
+-
+ int tilcdc_crtc_max_width(struct drm_crtc *crtc)
+ {
+       struct drm_device *dev = crtc->dev;
+@@ -749,7 +733,9 @@ int tilcdc_crtc_max_width(struct drm_crtc *crtc)
+       return max_width;
+ }
+-int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode)
++static enum drm_mode_status
++tilcdc_crtc_mode_valid(struct drm_crtc *crtc,
++                     const struct drm_display_mode *mode)
+ {
+       struct tilcdc_drm_private *priv = crtc->dev->dev_private;
+       unsigned int bandwidth;
+@@ -837,6 +823,14 @@ int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode)
+       return MODE_OK;
+ }
++static const struct drm_crtc_helper_funcs tilcdc_crtc_helper_funcs = {
++      .mode_valid     = tilcdc_crtc_mode_valid,
++      .mode_fixup     = tilcdc_crtc_mode_fixup,
++      .atomic_check   = tilcdc_crtc_atomic_check,
++      .atomic_enable  = tilcdc_crtc_atomic_enable,
++      .atomic_disable = tilcdc_crtc_atomic_disable,
++};
++
+ void tilcdc_crtc_set_panel_info(struct drm_crtc *crtc,
+               const struct tilcdc_panel_info *info)
+ {
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+index e1868776da25..96457fe2b8d5 100644
+--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
++++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+@@ -202,7 +202,6 @@ static void tilcdc_fini(struct drm_device *dev)
+       drm_irq_uninstall(dev);
+       drm_mode_config_cleanup(dev);
+-      tilcdc_remove_external_device(dev);
+       if (priv->clk)
+               clk_put(priv->clk);
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+index ead512216669..35558bbd5cd8 100644
+--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
++++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+@@ -89,7 +89,6 @@ struct tilcdc_drm_private {
+       struct drm_encoder *external_encoder;
+       struct drm_connector *external_connector;
+-      const struct drm_connector_helper_funcs *connector_funcs;
+       bool is_registered;
+       bool is_componentized;
+@@ -171,7 +170,6 @@ void tilcdc_crtc_set_panel_info(struct drm_crtc *crtc,
+               const struct tilcdc_panel_info *info);
+ void tilcdc_crtc_set_simulate_vesa_sync(struct drm_crtc *crtc,
+                                       bool simulate_vesa_sync);
+-int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode);
+ int tilcdc_crtc_max_width(struct drm_crtc *crtc);
+ void tilcdc_crtc_shutdown(struct drm_crtc *crtc);
+ int tilcdc_crtc_update_fb(struct drm_crtc *crtc,
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c
+index b4eaf9bc87f8..a2f623550ce3 100644
+--- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
++++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
+@@ -40,64 +40,6 @@ static const struct tilcdc_panel_info panel_info_default = {
+               .raster_order           = 0,
+ };
+-static int tilcdc_external_mode_valid(struct drm_connector *connector,
+-                                    struct drm_display_mode *mode)
+-{
+-      struct tilcdc_drm_private *priv = connector->dev->dev_private;
+-      int ret;
+-
+-      ret = tilcdc_crtc_mode_valid(priv->crtc, mode);
+-      if (ret != MODE_OK)
+-              return ret;
+-
+-      BUG_ON(priv->external_connector != connector);
+-      BUG_ON(!priv->connector_funcs);
+-
+-      /* If the connector has its own mode_valid call it. */
+-      if (!IS_ERR(priv->connector_funcs) &&
+-          priv->connector_funcs->mode_valid)
+-              return priv->connector_funcs->mode_valid(connector, mode);
+-
+-      return MODE_OK;
+-}
+-
+-static int tilcdc_add_external_connector(struct drm_device *dev,
+-                                       struct drm_connector *connector)
+-{
+-      struct tilcdc_drm_private *priv = dev->dev_private;
+-      struct drm_connector_helper_funcs *connector_funcs;
+-
+-      /* There should never be more than one connector */
+-      if (WARN_ON(priv->external_connector))
+-              return -EINVAL;
+-
+-      priv->external_connector = connector;
+-      connector_funcs = devm_kzalloc(dev->dev, sizeof(*connector_funcs),
+-                                     GFP_KERNEL);
+-      if (!connector_funcs)
+-              return -ENOMEM;
+-
+-      /* connector->helper_private contains always struct
+-       * connector_helper_funcs pointer. For tilcdc crtc to have a
+-       * say if a specific mode is Ok, we need to install our own
+-       * helper functions. In our helper functions we copy
+-       * everything else but use our own mode_valid() (above).
+-       */
+-      if (connector->helper_private) {
+-              priv->connector_funcs = connector->helper_private;
+-              *connector_funcs = *priv->connector_funcs;
+-      } else {
+-              priv->connector_funcs = ERR_PTR(-ENOENT);
+-      }
+-      connector_funcs->mode_valid = tilcdc_external_mode_valid;
+-      drm_connector_helper_add(connector, connector_funcs);
+-
+-      dev_dbg(dev->dev, "External connector '%s' connected\n",
+-              connector->name);
+-
+-      return 0;
+-}
+-
+ static
+ struct drm_connector *tilcdc_encoder_find_connector(struct drm_device *ddev,
+                                                   struct drm_encoder *encoder)
+@@ -118,7 +60,6 @@ struct drm_connector *tilcdc_encoder_find_connector(struct drm_device *ddev,
+ int tilcdc_add_component_encoder(struct drm_device *ddev)
+ {
+       struct tilcdc_drm_private *priv = ddev->dev_private;
+-      struct drm_connector *connector;
+       struct drm_encoder *encoder;
+       list_for_each_entry(encoder, &ddev->mode_config.encoder_list, head)
+@@ -130,28 +71,17 @@ int tilcdc_add_component_encoder(struct drm_device *ddev)
+               return -ENODEV;
+       }
+-      connector = tilcdc_encoder_find_connector(ddev, encoder);
++      priv->external_connector =
++              tilcdc_encoder_find_connector(ddev, encoder);
+-      if (!connector)
++      if (!priv->external_connector)
+               return -ENODEV;
+       /* Only tda998x is supported at the moment. */
+       tilcdc_crtc_set_simulate_vesa_sync(priv->crtc, true);
+       tilcdc_crtc_set_panel_info(priv->crtc, &panel_info_tda998x);
+-      return tilcdc_add_external_connector(ddev, connector);
+-}
+-
+-void tilcdc_remove_external_device(struct drm_device *dev)
+-{
+-      struct tilcdc_drm_private *priv = dev->dev_private;
+-
+-      /* Restore the original helper functions, if any. */
+-      if (IS_ERR(priv->connector_funcs))
+-              drm_connector_helper_add(priv->external_connector, NULL);
+-      else if (priv->connector_funcs)
+-              drm_connector_helper_add(priv->external_connector,
+-                                       priv->connector_funcs);
++      return 0;
+ }
+ static const struct drm_encoder_funcs tilcdc_external_encoder_funcs = {
+@@ -162,7 +92,6 @@ static
+ int tilcdc_attach_bridge(struct drm_device *ddev, struct drm_bridge *bridge)
+ {
+       struct tilcdc_drm_private *priv = ddev->dev_private;
+-      struct drm_connector *connector;
+       int ret;
+       priv->external_encoder->possible_crtcs = BIT(0);
+@@ -175,13 +104,12 @@ int tilcdc_attach_bridge(struct drm_device *ddev, struct drm_bridge *bridge)
+       tilcdc_crtc_set_panel_info(priv->crtc, &panel_info_default);
+-      connector = tilcdc_encoder_find_connector(ddev, priv->external_encoder);
+-      if (!connector)
++      priv->external_connector =
++              tilcdc_encoder_find_connector(ddev, priv->external_encoder);
++      if (!priv->external_connector)
+               return -ENODEV;
+-      ret = tilcdc_add_external_connector(ddev, connector);
+-
+-      return ret;
++      return 0;
+ }
+ int tilcdc_attach_external_device(struct drm_device *ddev)
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.h b/drivers/gpu/drm/tilcdc/tilcdc_external.h
+index 763d18f006c7..a28b9df68c8f 100644
+--- a/drivers/gpu/drm/tilcdc/tilcdc_external.h
++++ b/drivers/gpu/drm/tilcdc/tilcdc_external.h
+@@ -19,7 +19,6 @@
+ #define __TILCDC_EXTERNAL_H__
+ int tilcdc_add_component_encoder(struct drm_device *dev);
+-void tilcdc_remove_external_device(struct drm_device *dev);
+ int tilcdc_get_external_components(struct device *dev,
+                                  struct component_match **match);
+ int tilcdc_attach_external_device(struct drm_device *ddev);
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+index 096a33f12c61..253c555e2997 100644
+--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
++++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+@@ -174,14 +174,6 @@ static int panel_connector_get_modes(struct drm_connector *connector)
+       return i;
+ }
+-static int panel_connector_mode_valid(struct drm_connector *connector,
+-                struct drm_display_mode *mode)
+-{
+-      struct tilcdc_drm_private *priv = connector->dev->dev_private;
+-      /* our only constraints are what the crtc can generate: */
+-      return tilcdc_crtc_mode_valid(priv->crtc, mode);
+-}
+-
+ static struct drm_encoder *panel_connector_best_encoder(
+               struct drm_connector *connector)
+ {
+@@ -199,7 +191,6 @@ static const struct drm_connector_funcs panel_connector_funcs = {
+ static const struct drm_connector_helper_funcs panel_connector_helper_funcs = {
+       .get_modes          = panel_connector_get_modes,
+-      .mode_valid         = panel_connector_mode_valid,
+       .best_encoder       = panel_connector_best_encoder,
+ };
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
+index daebf1aa6b0a..54c6d825b1a0 100644
+--- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
++++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
+@@ -183,14 +183,6 @@ static int tfp410_connector_get_modes(struct drm_connector *connector)
+       return ret;
+ }
+-static int tfp410_connector_mode_valid(struct drm_connector *connector,
+-                struct drm_display_mode *mode)
+-{
+-      struct tilcdc_drm_private *priv = connector->dev->dev_private;
+-      /* our only constraints are what the crtc can generate: */
+-      return tilcdc_crtc_mode_valid(priv->crtc, mode);
+-}
+-
+ static struct drm_encoder *tfp410_connector_best_encoder(
+               struct drm_connector *connector)
+ {
+@@ -209,7 +201,6 @@ static const struct drm_connector_funcs tfp410_connector_funcs = {
+ static const struct drm_connector_helper_funcs tfp410_connector_helper_funcs = {
+       .get_modes          = tfp410_connector_get_modes,
+-      .mode_valid         = tfp410_connector_mode_valid,
+       .best_encoder       = tfp410_connector_best_encoder,
+ };
+-- 
+2.35.1
+
diff --git a/queue-4.19/hid-add-always_poll-quirk-to-lenovo-pixart-mouse.patch b/queue-4.19/hid-add-always_poll-quirk-to-lenovo-pixart-mouse.patch
new file mode 100644 (file)
index 0000000..dd652d9
--- /dev/null
@@ -0,0 +1,50 @@
+From d1a7beb0bec41022a35503ec649fbc7490d0d2f5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 12 Mar 2020 12:16:06 -0400
+Subject: HID: add ALWAYS_POLL quirk to lenovo pixart mouse
+
+From: Tony Fischetti <tony.fischetti@gmail.com>
+
+[ Upstream commit 819d578d51d0ce73f06e35d69395ef55cd683a74 ]
+
+A lenovo pixart mouse (17ef:608d) is afflicted common the the malfunction
+where it disconnects and reconnects every minute--each time incrementing
+the device number. This patch adds the device id of the device and
+specifies that it needs the HID_QUIRK_ALWAYS_POLL quirk in order to
+work properly.
+
+Signed-off-by: Tony Fischetti <tony.fischetti@gmail.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hid/hid-ids.h    | 1 +
+ drivers/hid/hid-quirks.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
+index 1c1de7e128d6..70079d29822b 100644
+--- a/drivers/hid/hid-ids.h
++++ b/drivers/hid/hid-ids.h
+@@ -728,6 +728,7 @@
+ #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
+ #define USB_DEVICE_ID_LENOVO_X1_TAB   0x60a3
+ #define USB_DEVICE_ID_LENOVO_X1_TAB3  0x60b5
++#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D    0x608d
+ #define USB_VENDOR_ID_LG              0x1fd2
+ #define USB_DEVICE_ID_LG_MULTITOUCH   0x0064
+diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
+index 48e9761d4ace..c1b76ba85fb4 100644
+--- a/drivers/hid/hid-quirks.c
++++ b/drivers/hid/hid-quirks.c
+@@ -111,6 +111,7 @@ static const struct hid_device_id hid_quirks[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2), HID_QUIRK_MULTI_INPUT },
+       { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912), HID_QUIRK_MULTI_INPUT },
+       { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2), HID_QUIRK_ALWAYS_POLL },
++      { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D), HID_QUIRK_ALWAYS_POLL },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C007), HID_QUIRK_ALWAYS_POLL },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077), HID_QUIRK_ALWAYS_POLL },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KEYBOARD_G710_PLUS), HID_QUIRK_NOGET },
+-- 
+2.35.1
+
diff --git a/queue-4.19/hid-multitouch-add-support-for-the-smart-tech-panel.patch b/queue-4.19/hid-multitouch-add-support-for-the-smart-tech-panel.patch
new file mode 100644 (file)
index 0000000..b50c9ca
--- /dev/null
@@ -0,0 +1,147 @@
+From 11fdfbb4cb425f0ceb810f15be96d9d0d4383e24 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 12 Aug 2019 18:23:26 +0200
+Subject: HID: multitouch: add support for the Smart Tech panel
+
+From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+
+[ Upstream commit 69ecd44d68a7bf4caeda39825af720362db69233 ]
+
+This panel is not very friendly to us:
+it exposes multiple multitouch collections, some of them being of
+logical application stylus.
+
+Usually, a device has only one report per application, and that is
+what I assumed in commit 8dfe14b3b47f ("HID: multitouch: ditch mt_report_id")
+
+To avoid breaking all working device, add a new class and a new quirk
+for that situation.
+
+Reported-and-tested-by: Matthias Fend <Matthias.Fend@wolfvision.net>
+Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hid/hid-multitouch.c | 34 ++++++++++++++++++++++++++++------
+ 1 file changed, 28 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
+index 1c4426c60972..ce027eda9b17 100644
+--- a/drivers/hid/hid-multitouch.c
++++ b/drivers/hid/hid-multitouch.c
+@@ -72,6 +72,7 @@ MODULE_LICENSE("GPL");
+ #define MT_QUIRK_STICKY_FINGERS               BIT(16)
+ #define MT_QUIRK_ASUS_CUSTOM_UP               BIT(17)
+ #define MT_QUIRK_WIN8_PTP_BUTTONS     BIT(18)
++#define MT_QUIRK_SEPARATE_APP_REPORT  BIT(19)
+ #define MT_INPUTMODE_TOUCHSCREEN      0x02
+ #define MT_INPUTMODE_TOUCHPAD         0x03
+@@ -107,6 +108,7 @@ struct mt_usages {
+ struct mt_application {
+       struct list_head list;
+       unsigned int application;
++      unsigned int report_id;
+       struct list_head mt_usages;     /* mt usages list */
+       __s32 quirks;
+@@ -207,6 +209,7 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app);
+ #define MT_CLS_VTL                            0x0110
+ #define MT_CLS_GOOGLE                         0x0111
+ #define MT_CLS_RAZER_BLADE_STEALTH            0x0112
++#define MT_CLS_SMART_TECH                     0x0113
+ #define MT_DEFAULT_MAXCONTACT 10
+ #define MT_MAX_MAXCONTACT     250
+@@ -357,6 +360,12 @@ static const struct mt_class mt_classes[] = {
+                       MT_QUIRK_CONTACT_CNT_ACCURATE |
+                       MT_QUIRK_WIN8_PTP_BUTTONS,
+       },
++      { .name = MT_CLS_SMART_TECH,
++              .quirks = MT_QUIRK_ALWAYS_VALID |
++                      MT_QUIRK_IGNORE_DUPLICATES |
++                      MT_QUIRK_CONTACT_CNT_ACCURATE |
++                      MT_QUIRK_SEPARATE_APP_REPORT,
++      },
+       { }
+ };
+@@ -513,8 +522,9 @@ static struct mt_usages *mt_allocate_usage(struct hid_device *hdev,
+ }
+ static struct mt_application *mt_allocate_application(struct mt_device *td,
+-                                                    unsigned int application)
++                                                    struct hid_report *report)
+ {
++      unsigned int application = report->application;
+       struct mt_application *mt_application;
+       mt_application = devm_kzalloc(&td->hdev->dev, sizeof(*mt_application),
+@@ -539,6 +549,7 @@ static struct mt_application *mt_allocate_application(struct mt_device *td,
+       mt_application->scantime = DEFAULT_ZERO;
+       mt_application->raw_cc = DEFAULT_ZERO;
+       mt_application->quirks = td->mtclass.quirks;
++      mt_application->report_id = report->id;
+       list_add_tail(&mt_application->list, &td->applications);
+@@ -546,19 +557,23 @@ static struct mt_application *mt_allocate_application(struct mt_device *td,
+ }
+ static struct mt_application *mt_find_application(struct mt_device *td,
+-                                                unsigned int application)
++                                                struct hid_report *report)
+ {
++      unsigned int application = report->application;
+       struct mt_application *tmp, *mt_application = NULL;
+       list_for_each_entry(tmp, &td->applications, list) {
+               if (application == tmp->application) {
+-                      mt_application = tmp;
+-                      break;
++                      if (!(td->mtclass.quirks & MT_QUIRK_SEPARATE_APP_REPORT) ||
++                          tmp->report_id == report->id) {
++                              mt_application = tmp;
++                              break;
++                      }
+               }
+       }
+       if (!mt_application)
+-              mt_application = mt_allocate_application(td, application);
++              mt_application = mt_allocate_application(td, report);
+       return mt_application;
+ }
+@@ -575,7 +590,7 @@ static struct mt_report_data *mt_allocate_report_data(struct mt_device *td,
+               return NULL;
+       rdata->report = report;
+-      rdata->application = mt_find_application(td, report->application);
++      rdata->application = mt_find_application(td, report);
+       if (!rdata->application) {
+               devm_kfree(&td->hdev->dev, rdata);
+@@ -1571,6 +1586,9 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
+       case HID_VD_ASUS_CUSTOM_MEDIA_KEYS:
+               suffix = "Custom Media Keys";
+               break;
++      case HID_DG_PEN:
++              suffix = "Stylus";
++              break;
+       default:
+               suffix = "UNKNOWN";
+               break;
+@@ -2038,6 +2056,10 @@ static const struct hid_device_id mt_devices[] = {
+               HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
+                       USB_VENDOR_ID_SYNAPTICS, 0x8323) },
++      /* Smart Tech panels */
++      { .driver_data = MT_CLS_SMART_TECH,
++              MT_USB_DEVICE(0x0b8c, 0x0092)},
++
+       /* Stantum panels */
+       { .driver_data = MT_CLS_CONFIDENCE,
+               MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
+-- 
+2.35.1
+
diff --git a/queue-4.19/hid-multitouch-lenovo-x1-tablet-gen3-trackpoint-and-.patch b/queue-4.19/hid-multitouch-lenovo-x1-tablet-gen3-trackpoint-and-.patch
new file mode 100644 (file)
index 0000000..0033b77
--- /dev/null
@@ -0,0 +1,57 @@
+From 13dd9de7784337fc4a149c53d78831ecceb3a5bc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 9 Feb 2019 19:05:26 +0100
+Subject: HID: multitouch: Lenovo X1 Tablet Gen3 trackpoint and buttons
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Mikael Wikström <leakim.wikstrom@gmail.com>
+
+[ Upstream commit 8d5037dca7c2089f27e5903c2aecfc5bb10d7806 ]
+
+Add support for the trackpoint and three mouse buttons on the type cover
+of the Lenovo X1 Tablet Gen3.
+
+This is the same as with the 2nd generation Lenovo X1 Tablet.
+
+Signed-off-by: Mikael Wikström <leakim.wikstrom@gmail.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hid/hid-ids.h        | 1 +
+ drivers/hid/hid-multitouch.c | 6 ++++++
+ 2 files changed, 7 insertions(+)
+
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
+index 8d4153c73f5c..1c1de7e128d6 100644
+--- a/drivers/hid/hid-ids.h
++++ b/drivers/hid/hid-ids.h
+@@ -727,6 +727,7 @@
+ #define USB_DEVICE_ID_LENOVO_TPPRODOCK        0x6067
+ #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
+ #define USB_DEVICE_ID_LENOVO_X1_TAB   0x60a3
++#define USB_DEVICE_ID_LENOVO_X1_TAB3  0x60b5
+ #define USB_VENDOR_ID_LG              0x1fd2
+ #define USB_DEVICE_ID_LG_MULTITOUCH   0x0064
+diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
+index 5509b09f8656..1c4426c60972 100644
+--- a/drivers/hid/hid-multitouch.c
++++ b/drivers/hid/hid-multitouch.c
+@@ -1797,6 +1797,12 @@ static const struct hid_device_id mt_devices[] = {
+                          USB_VENDOR_ID_LENOVO,
+                          USB_DEVICE_ID_LENOVO_X1_TAB) },
++      /* Lenovo X1 TAB Gen 3 */
++      { .driver_data = MT_CLS_WIN_8_DUAL,
++              HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8,
++                         USB_VENDOR_ID_LENOVO,
++                         USB_DEVICE_ID_LENOVO_X1_TAB3) },
++
+       /* Anton devices */
+       { .driver_data = MT_CLS_EXPORT_ALL_INPUTS,
+               MT_USB_DEVICE(USB_VENDOR_ID_ANTON,
+-- 
+2.35.1
+
diff --git a/queue-4.19/hid-multitouch-simplify-the-application-retrieval.patch b/queue-4.19/hid-multitouch-simplify-the-application-retrieval.patch
new file mode 100644 (file)
index 0000000..5382e3b
--- /dev/null
@@ -0,0 +1,128 @@
+From 8824eaa4ed5ed3edc16a383fa7613abef2a107ec Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 4 Sep 2018 15:31:15 +0200
+Subject: HID: multitouch: simplify the application retrieval
+
+From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+
+[ Upstream commit 7ffa13be4945b2f60dfe6c71acbc1fdcfc4629a0 ]
+
+Now that the application is simply stored in struct hid_input, we can
+overwrite it in mt_input_mapping() for the faulty egalax and have a
+simpler suffix processing in mt_input_configured()
+
+Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hid/hid-multitouch.c | 72 ++++++++++++++++--------------------
+ 1 file changed, 32 insertions(+), 40 deletions(-)
+
+diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
+index e99286258f62..5509b09f8656 100644
+--- a/drivers/hid/hid-multitouch.c
++++ b/drivers/hid/hid-multitouch.c
+@@ -1332,6 +1332,13 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+               return mt_touch_input_mapping(hdev, hi, field, usage, bit, max,
+                                             application);
++      /*
++       * some egalax touchscreens have "application == DG_TOUCHSCREEN"
++       * for the stylus. Overwrite the hid_input application
++       */
++      if (field->physical == HID_DG_STYLUS)
++              hi->application = HID_DG_STYLUS;
++
+       /* let hid-core decide for the others */
+       return 0;
+ }
+@@ -1520,14 +1527,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
+       struct mt_device *td = hid_get_drvdata(hdev);
+       char *name;
+       const char *suffix = NULL;
+-      unsigned int application = 0;
+       struct mt_report_data *rdata;
+       struct mt_application *mt_application = NULL;
+       struct hid_report *report;
+       int ret;
+       list_for_each_entry(report, &hi->reports, hidinput_list) {
+-              application = report->application;
+               rdata = mt_find_report_data(td, report);
+               if (!rdata) {
+                       hid_err(hdev, "failed to allocate data for report\n");
+@@ -1542,46 +1547,33 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
+                       if (ret)
+                               return ret;
+               }
+-
+-              /*
+-               * some egalax touchscreens have "application == DG_TOUCHSCREEN"
+-               * for the stylus. Check this first, and then rely on
+-               * the application field.
+-               */
+-              if (report->field[0]->physical == HID_DG_STYLUS) {
+-                      suffix = "Pen";
+-                      /* force BTN_STYLUS to allow tablet matching in udev */
+-                      __set_bit(BTN_STYLUS, hi->input->keybit);
+-              }
+       }
+-      if (!suffix) {
+-              switch (application) {
+-              case HID_GD_KEYBOARD:
+-              case HID_GD_KEYPAD:
+-              case HID_GD_MOUSE:
+-              case HID_DG_TOUCHPAD:
+-              case HID_GD_SYSTEM_CONTROL:
+-              case HID_CP_CONSUMER_CONTROL:
+-              case HID_GD_WIRELESS_RADIO_CTLS:
+-              case HID_GD_SYSTEM_MULTIAXIS:
+-                      /* already handled by hid core */
+-                      break;
+-              case HID_DG_TOUCHSCREEN:
+-                      /* we do not set suffix = "Touchscreen" */
+-                      hi->input->name = hdev->name;
+-                      break;
+-              case HID_DG_STYLUS:
+-                      /* force BTN_STYLUS to allow tablet matching in udev */
+-                      __set_bit(BTN_STYLUS, hi->input->keybit);
+-                      break;
+-              case HID_VD_ASUS_CUSTOM_MEDIA_KEYS:
+-                      suffix = "Custom Media Keys";
+-                      break;
+-              default:
+-                      suffix = "UNKNOWN";
+-                      break;
+-              }
++      switch (hi->application) {
++      case HID_GD_KEYBOARD:
++      case HID_GD_KEYPAD:
++      case HID_GD_MOUSE:
++      case HID_DG_TOUCHPAD:
++      case HID_GD_SYSTEM_CONTROL:
++      case HID_CP_CONSUMER_CONTROL:
++      case HID_GD_WIRELESS_RADIO_CTLS:
++      case HID_GD_SYSTEM_MULTIAXIS:
++              /* already handled by hid core */
++              break;
++      case HID_DG_TOUCHSCREEN:
++              /* we do not set suffix = "Touchscreen" */
++              hi->input->name = hdev->name;
++              break;
++      case HID_DG_STYLUS:
++              /* force BTN_STYLUS to allow tablet matching in udev */
++              __set_bit(BTN_STYLUS, hi->input->keybit);
++              break;
++      case HID_VD_ASUS_CUSTOM_MEDIA_KEYS:
++              suffix = "Custom Media Keys";
++              break;
++      default:
++              suffix = "UNKNOWN";
++              break;
+       }
+       if (suffix) {
+-- 
+2.35.1
+
diff --git a/queue-4.19/ima-remove-the-ima_template-kconfig-option.patch b/queue-4.19/ima-remove-the-ima_template-kconfig-option.patch
new file mode 100644 (file)
index 0000000..4dc4175
--- /dev/null
@@ -0,0 +1,100 @@
+From c8b03b514ef1330a1efc8819da3a975e9bdb369d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Apr 2022 10:16:19 +0800
+Subject: ima: remove the IMA_TEMPLATE Kconfig option
+
+From: GUO Zihua <guozihua@huawei.com>
+
+[ Upstream commit 891163adf180bc369b2f11c9dfce6d2758d2a5bd ]
+
+The original 'ima' measurement list template contains a hash, defined
+as 20 bytes, and a null terminated pathname, limited to 255
+characters.  Other measurement list templates permit both larger hashes
+and longer pathnames.  When the "ima" template is configured as the
+default, a new measurement list template (ima_template=) must be
+specified before specifying a larger hash algorithm (ima_hash=) on the
+boot command line.
+
+To avoid this boot command line ordering issue, remove the legacy "ima"
+template configuration option, allowing it to still be specified on the
+boot command line.
+
+The root cause of this issue is that during the processing of ima_hash,
+we would try to check whether the hash algorithm is compatible with the
+template. If the template is not set at the moment we do the check, we
+check the algorithm against the configured default template. If the
+default template is "ima", then we reject any hash algorithm other than
+sha1 and md5.
+
+For example, if the compiled default template is "ima", and the default
+algorithm is sha1 (which is the current default). In the cmdline, we put
+in "ima_hash=sha256 ima_template=ima-ng". The expected behavior would be
+that ima starts with ima-ng as the template and sha256 as the hash
+algorithm. However, during the processing of "ima_hash=",
+"ima_template=" has not been processed yet, and hash_setup would check
+the configured hash algorithm against the compiled default: ima, and
+reject sha256. So at the end, the hash algorithm that is actually used
+will be sha1.
+
+With template "ima" removed from the configured default, we ensure that
+the default tempalte would at least be "ima-ng" which allows for
+basically any hash algorithm.
+
+This change would not break the algorithm compatibility checks for IMA.
+
+Fixes: 4286587dccd43 ("ima: add Kconfig default measurement list template")
+Signed-off-by: GUO Zihua <guozihua@huawei.com>
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ security/integrity/ima/Kconfig | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig
+index 5095b2e8fcee..3ec45028a8c5 100644
+--- a/security/integrity/ima/Kconfig
++++ b/security/integrity/ima/Kconfig
+@@ -68,10 +68,9 @@ choice
+         hash, defined as 20 bytes, and a null terminated pathname,
+         limited to 255 characters.  The 'ima-ng' measurement list
+         template permits both larger hash digests and longer
+-        pathnames.
++        pathnames. The configured default template can be replaced
++        by specifying "ima_template=" on the boot command line.
+-      config IMA_TEMPLATE
+-              bool "ima"
+       config IMA_NG_TEMPLATE
+               bool "ima-ng (default)"
+       config IMA_SIG_TEMPLATE
+@@ -81,7 +80,6 @@ endchoice
+ config IMA_DEFAULT_TEMPLATE
+       string
+       depends on IMA
+-      default "ima" if IMA_TEMPLATE
+       default "ima-ng" if IMA_NG_TEMPLATE
+       default "ima-sig" if IMA_SIG_TEMPLATE
+@@ -101,15 +99,15 @@ choice
+       config IMA_DEFAULT_HASH_SHA256
+               bool "SHA256"
+-              depends on CRYPTO_SHA256=y && !IMA_TEMPLATE
++              depends on CRYPTO_SHA256=y
+       config IMA_DEFAULT_HASH_SHA512
+               bool "SHA512"
+-              depends on CRYPTO_SHA512=y && !IMA_TEMPLATE
++              depends on CRYPTO_SHA512=y
+       config IMA_DEFAULT_HASH_WP512
+               bool "WP512"
+-              depends on CRYPTO_WP512=y && !IMA_TEMPLATE
++              depends on CRYPTO_WP512=y
+ endchoice
+ config IMA_DEFAULT_HASH
+-- 
+2.35.1
+
index 63fc996a87471279deb70e67cbdf43b0a8a852d9..4c180668b48e3c520753c20579a2d23fb1447121 100644 (file)
@@ -33,3 +33,11 @@ tcp-fix-data-races-around-sysctl_tcp_max_reordering.patch
 revert-revert-char-random-silence-a-lockdep-splat-with-printk.patch
 mm-mempolicy-fix-uninit-value-in-mpol_rebind_policy.patch
 bpf-make-sure-mac_header-was-set-before-using-it.patch
+drm-tilcdc-remove-obsolete-crtc_mode_valid-hack.patch
+tilcdc-tilcdc_external-fix-an-incorrect-null-check-o.patch
+hid-multitouch-simplify-the-application-retrieval.patch
+hid-multitouch-lenovo-x1-tablet-gen3-trackpoint-and-.patch
+hid-multitouch-add-support-for-the-smart-tech-panel.patch
+hid-add-always_poll-quirk-to-lenovo-pixart-mouse.patch
+dlm-fix-pending-remove-if-msg-allocation-fails.patch
+ima-remove-the-ima_template-kconfig-option.patch
diff --git a/queue-4.19/tilcdc-tilcdc_external-fix-an-incorrect-null-check-o.patch b/queue-4.19/tilcdc-tilcdc_external-fix-an-incorrect-null-check-o.patch
new file mode 100644 (file)
index 0000000..1779d45
--- /dev/null
@@ -0,0 +1,57 @@
+From 4092f1c359a73997b94d62fa284140eba8cfb1a8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 27 Mar 2022 14:15:16 +0800
+Subject: tilcdc: tilcdc_external: fix an incorrect NULL check on list iterator
+
+From: Xiaomeng Tong <xiam0nd.tong@gmail.com>
+
+[ Upstream commit 8b917cbe38e9b0d002492477a9fc2bfee2412ce4 ]
+
+The bug is here:
+       if (!encoder) {
+
+The list iterator value 'encoder' will *always* be set and non-NULL
+by list_for_each_entry(), so it is incorrect to assume that the
+iterator value will be NULL if the list is empty or no element
+is found.
+
+To fix the bug, use a new variable 'iter' as the list iterator,
+while use the original variable 'encoder' as a dedicated pointer
+to point to the found element.
+
+Cc: stable@vger.kernel.org
+Fixes: ec9eab097a500 ("drm/tilcdc: Add drm bridge support for attaching drm bridge drivers")
+Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
+Reviewed-by: Jyri Sarha <jyri.sarha@iki.fi>
+Tested-by: Jyri Sarha <jyri.sarha@iki.fi>
+Signed-off-by: Jyri Sarha <jyri.sarha@iki.fi>
+Link: https://patchwork.freedesktop.org/patch/msgid/20220327061516.5076-1-xiam0nd.tong@gmail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/tilcdc/tilcdc_external.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c
+index a2f623550ce3..9c1be0635b53 100644
+--- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
++++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
+@@ -60,11 +60,13 @@ struct drm_connector *tilcdc_encoder_find_connector(struct drm_device *ddev,
+ int tilcdc_add_component_encoder(struct drm_device *ddev)
+ {
+       struct tilcdc_drm_private *priv = ddev->dev_private;
+-      struct drm_encoder *encoder;
++      struct drm_encoder *encoder = NULL, *iter;
+-      list_for_each_entry(encoder, &ddev->mode_config.encoder_list, head)
+-              if (encoder->possible_crtcs & (1 << priv->crtc->index))
++      list_for_each_entry(iter, &ddev->mode_config.encoder_list, head)
++              if (iter->possible_crtcs & (1 << priv->crtc->index)) {
++                      encoder = iter;
+                       break;
++              }
+       if (!encoder) {
+               dev_err(ddev->dev, "%s: No suitable encoder found\n", __func__);
+-- 
+2.35.1
+