From: Greg Kroah-Hartman Date: Wed, 8 Sep 2021 07:05:51 +0000 (+0200) Subject: 5.14-stable patches X-Git-Tag: v5.4.145~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca37a15a32221bcc200d2aed793eb69811598bb5;p=thirdparty%2Fkernel%2Fstable-queue.git 5.14-stable patches added patches: can-c_can-fix-null-ptr-deref-on-ioctl.patch firmware-dmi-move-product_sku-info-to-the-end-of-the-modalias.patch --- diff --git a/queue-5.14/can-c_can-fix-null-ptr-deref-on-ioctl.patch b/queue-5.14/can-c_can-fix-null-ptr-deref-on-ioctl.patch new file mode 100644 index 00000000000..141b8d44cf5 --- /dev/null +++ b/queue-5.14/can-c_can-fix-null-ptr-deref-on-ioctl.patch @@ -0,0 +1,46 @@ +From 644d0a5bcc3361170d84fb8d0b13943c354119db Mon Sep 17 00:00:00 2001 +From: Tong Zhang +Date: Mon, 6 Sep 2021 16:37:02 -0700 +Subject: can: c_can: fix null-ptr-deref on ioctl() + +From: Tong Zhang + +commit 644d0a5bcc3361170d84fb8d0b13943c354119db upstream. + +The pdev maybe not a platform device, e.g. c_can_pci device, in this +case, calling to_platform_device() would not make sense. Also, per the +comment in drivers/net/can/c_can/c_can_ethtool.c, @bus_info should +match dev_name() string, so I am replacing this with dev_name() to fix +this issue. + +[ 1.458583] BUG: unable to handle page fault for address: 0000000100000000 +[ 1.460921] RIP: 0010:strnlen+0x1a/0x30 +[ 1.466336] ? c_can_get_drvinfo+0x65/0xb0 [c_can] +[ 1.466597] ethtool_get_drvinfo+0xae/0x360 +[ 1.466826] dev_ethtool+0x10f8/0x2970 +[ 1.467880] sock_ioctl+0xef/0x300 + +Fixes: 2722ac986e93 ("can: c_can: add ethtool support") +Link: https://lore.kernel.org/r/20210906233704.1162666-1-ztong0001@gmail.com +Cc: stable@vger.kernel.org # 5.14+ +Signed-off-by: Tong Zhang +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/can/c_can/c_can_ethtool.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/can/c_can/c_can_ethtool.c ++++ b/drivers/net/can/c_can/c_can_ethtool.c +@@ -15,10 +15,8 @@ static void c_can_get_drvinfo(struct net + struct ethtool_drvinfo *info) + { + struct c_can_priv *priv = netdev_priv(netdev); +- struct platform_device *pdev = to_platform_device(priv->device); +- + strscpy(info->driver, "c_can", sizeof(info->driver)); +- strscpy(info->bus_info, pdev->name, sizeof(info->bus_info)); ++ strscpy(info->bus_info, dev_name(priv->device), sizeof(info->bus_info)); + } + + static void c_can_get_ringparam(struct net_device *netdev, diff --git a/queue-5.14/firmware-dmi-move-product_sku-info-to-the-end-of-the-modalias.patch b/queue-5.14/firmware-dmi-move-product_sku-info-to-the-end-of-the-modalias.patch new file mode 100644 index 00000000000..84f7d1af62e --- /dev/null +++ b/queue-5.14/firmware-dmi-move-product_sku-info-to-the-end-of-the-modalias.patch @@ -0,0 +1,88 @@ +From f97a2103f1a75ca70f23deadb4d96a16c4d85e7d Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 2 Sep 2021 17:28:53 +0200 +Subject: firmware: dmi: Move product_sku info to the end of the modalias + +From: Hans de Goede + +commit f97a2103f1a75ca70f23deadb4d96a16c4d85e7d upstream. + +Commit e26f023e01ef ("firmware/dmi: Include product_sku info to modalias") +added a new field to the modalias in the middle of the modalias, breaking +some existing udev/hwdb matches on the whole modalias without a wildcard +('*') in between the pvr and rvn fields. + +All modalias matches in e.g. : +https://github.com/systemd/systemd/blob/main/hwdb.d/60-sensor.hwdb +deliberately end in ':*' so that new fields can be added at *the end* of +the modalias, but adding a new field in the middle like this breaks things. + +Move the new sku field to the end of the modalias to fix some hwdb +entries no longer matching. + +The new sku field has already been put to use in 2 new hwdb entries: + + sensor:modalias:platform:HID-SENSOR-200073:dmi:*svnDell*:sku0A3E:* + ACCEL_LOCATION=base + + sensor:modalias:platform:HID-SENSOR-200073:dmi:*svnDell*:sku0B0B:* + ACCEL_LOCATION=base + +The wildcard use before and after the sku in these matches means that they +should keep working with the sku moved to the end. + +Note that there is a second instance of in essence the same problem, +commit f5152f4ded3c ("firmware/dmi: Report DMI Bios & EC firmware release") + +Added 2 new br and efr fields in the middle of the modalias. This too +breaks some hwdb modalias matches, but this has gone unnoticed for over +a year. So some newer hwdb modalias matches actually depend on these +fields being in the middle of the string. Moving these to the end now +would break 3 hwdb entries, while fixing 8 entries. + +Since there is no good answer for the new br and efr fields I have chosen +to leave these as is. Instead I'll submit a hwdb update to put a wildcard +at the place where these fields may or may not be present depending on the +kernel version. + +BugLink: https://github.com/systemd/systemd/issues/20550 +Link: https://github.com/systemd/systemd/pull/20562 +Fixes: e26f023e01ef ("firmware/dmi: Include product_sku info to modalias") +Cc: stable@vger.kernel.org +Cc: Kai-Chuan Hsieh +Cc: Erwan Velu +Signed-off-by: Hans de Goede +Signed-off-by: Jean Delvare +Signed-off-by: Greg Kroah-Hartman +--- + drivers/firmware/dmi-id.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/firmware/dmi-id.c ++++ b/drivers/firmware/dmi-id.c +@@ -73,6 +73,10 @@ static void ascii_filter(char *d, const + + static ssize_t get_modalias(char *buffer, size_t buffer_size) + { ++ /* ++ * Note new fields need to be added at the end to keep compatibility ++ * with udev's hwdb which does matches on "`cat dmi/id/modalias`*". ++ */ + static const struct mafield { + const char *prefix; + int field; +@@ -85,13 +89,13 @@ static ssize_t get_modalias(char *buffer + { "svn", DMI_SYS_VENDOR }, + { "pn", DMI_PRODUCT_NAME }, + { "pvr", DMI_PRODUCT_VERSION }, +- { "sku", DMI_PRODUCT_SKU }, + { "rvn", DMI_BOARD_VENDOR }, + { "rn", DMI_BOARD_NAME }, + { "rvr", DMI_BOARD_VERSION }, + { "cvn", DMI_CHASSIS_VENDOR }, + { "ct", DMI_CHASSIS_TYPE }, + { "cvr", DMI_CHASSIS_VERSION }, ++ { "sku", DMI_PRODUCT_SKU }, + { NULL, DMI_NONE } + }; +