From dca5fb80cc1e46b1cfea9fd3acfaeb7ba647f5c8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 12 Mar 2021 15:10:51 +0100 Subject: [PATCH] 5.4-stable patches added patches: media-rc-compile-rc-cec.c-into-rc-core.patch media-usbtv-fix-deadlock-on-suspend.patch media-v4l-vsp1-fix-bru-null-pointer-access.patch media-v4l-vsp1-fix-uif-null-pointer-access.patch sh_eth-fix-trscer-mask-for-r7s9210.patch --- ...dia-rc-compile-rc-cec.c-into-rc-core.patch | 140 ++++++++++++++++++ .../media-usbtv-fix-deadlock-on-suspend.patch | 42 ++++++ ...v4l-vsp1-fix-bru-null-pointer-access.patch | 32 ++++ ...v4l-vsp1-fix-uif-null-pointer-access.patch | 35 +++++ queue-5.4/series | 5 + .../sh_eth-fix-trscer-mask-for-r7s9210.patch | 33 +++++ 6 files changed, 287 insertions(+) create mode 100644 queue-5.4/media-rc-compile-rc-cec.c-into-rc-core.patch create mode 100644 queue-5.4/media-usbtv-fix-deadlock-on-suspend.patch create mode 100644 queue-5.4/media-v4l-vsp1-fix-bru-null-pointer-access.patch create mode 100644 queue-5.4/media-v4l-vsp1-fix-uif-null-pointer-access.patch create mode 100644 queue-5.4/sh_eth-fix-trscer-mask-for-r7s9210.patch diff --git a/queue-5.4/media-rc-compile-rc-cec.c-into-rc-core.patch b/queue-5.4/media-rc-compile-rc-cec.c-into-rc-core.patch new file mode 100644 index 00000000000..9f86f045125 --- /dev/null +++ b/queue-5.4/media-rc-compile-rc-cec.c-into-rc-core.patch @@ -0,0 +1,140 @@ +From f09f9f93afad770a04b35235a0aa465fcc8d6e3d Mon Sep 17 00:00:00 2001 +From: Hans Verkuil +Date: Fri, 26 Feb 2021 11:37:47 +0100 +Subject: media: rc: compile rc-cec.c into rc-core + +From: Hans Verkuil + +commit f09f9f93afad770a04b35235a0aa465fcc8d6e3d upstream. + +The rc-cec keymap is unusual in that it can't be built as a module, +instead it is registered directly in rc-main.c if CONFIG_MEDIA_CEC_RC +is set. This is because it can be called from drm_dp_cec_set_edid() via +cec_register_adapter() in an asynchronous context, and it is not +allowed to use request_module() to load rc-cec.ko in that case. Trying to +do so results in a 'WARN_ON_ONCE(wait && current_is_async())'. + +Since this keymap is only used if CONFIG_MEDIA_CEC_RC is set, we +just compile this keymap into the rc-core module and never as a +separate module. + +Signed-off-by: Hans Verkuil +Fixes: 2c6d1fffa1d9 (drm: add support for DisplayPort CEC-Tunneling-over-AUX) +Reported-by: Hans de Goede +Signed-off-by: Sean Young +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/rc/Makefile | 1 + + drivers/media/rc/keymaps/Makefile | 1 - + drivers/media/rc/keymaps/rc-cec.c | 28 +++++++++++----------------- + drivers/media/rc/rc-main.c | 6 ++++++ + include/media/rc-map.h | 7 +++++++ + 5 files changed, 25 insertions(+), 18 deletions(-) + +--- a/drivers/media/rc/Makefile ++++ b/drivers/media/rc/Makefile +@@ -5,6 +5,7 @@ obj-y += keymaps/ + obj-$(CONFIG_RC_CORE) += rc-core.o + rc-core-y := rc-main.o rc-ir-raw.o + rc-core-$(CONFIG_LIRC) += lirc_dev.o ++rc-core-$(CONFIG_MEDIA_CEC_RC) += keymaps/rc-cec.o + rc-core-$(CONFIG_BPF_LIRC_MODE2) += bpf-lirc.o + obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o + obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -20,7 +20,6 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t + rc-behold.o \ + rc-behold-columbus.o \ + rc-budget-ci-old.o \ +- rc-cec.o \ + rc-cinergy-1400.o \ + rc-cinergy.o \ + rc-d680-dmb.o \ +--- a/drivers/media/rc/keymaps/rc-cec.c ++++ b/drivers/media/rc/keymaps/rc-cec.c +@@ -1,6 +1,16 @@ + // SPDX-License-Identifier: GPL-2.0-or-later + /* Keytable for the CEC remote control + * ++ * This keymap is unusual in that it can't be built as a module, ++ * instead it is registered directly in rc-main.c if CONFIG_MEDIA_CEC_RC ++ * is set. This is because it can be called from drm_dp_cec_set_edid() via ++ * cec_register_adapter() in an asynchronous context, and it is not ++ * allowed to use request_module() to load rc-cec.ko in that case. ++ * ++ * Since this keymap is only used if CONFIG_MEDIA_CEC_RC is set, we ++ * just compile this keymap into the rc-core module and never as a ++ * separate module. ++ * + * Copyright (c) 2015 by Kamil Debski + */ + +@@ -152,7 +162,7 @@ static struct rc_map_table cec[] = { + /* 0x77-0xff: Reserved */ + }; + +-static struct rc_map_list cec_map = { ++struct rc_map_list cec_map = { + .map = { + .scan = cec, + .size = ARRAY_SIZE(cec), +@@ -160,19 +170,3 @@ static struct rc_map_list cec_map = { + .name = RC_MAP_CEC, + } + }; +- +-static int __init init_rc_map_cec(void) +-{ +- return rc_map_register(&cec_map); +-} +- +-static void __exit exit_rc_map_cec(void) +-{ +- rc_map_unregister(&cec_map); +-} +- +-module_init(init_rc_map_cec); +-module_exit(exit_rc_map_cec); +- +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Kamil Debski"); +--- a/drivers/media/rc/rc-main.c ++++ b/drivers/media/rc/rc-main.c +@@ -2033,6 +2033,9 @@ static int __init rc_core_init(void) + + led_trigger_register_simple("rc-feedback", &led_feedback); + rc_map_register(&empty_map); ++#ifdef CONFIG_MEDIA_CEC_RC ++ rc_map_register(&cec_map); ++#endif + + return 0; + } +@@ -2042,6 +2045,9 @@ static void __exit rc_core_exit(void) + lirc_dev_exit(); + class_unregister(&rc_class); + led_trigger_unregister_simple(led_feedback); ++#ifdef CONFIG_MEDIA_CEC_RC ++ rc_map_unregister(&cec_map); ++#endif + rc_map_unregister(&empty_map); + } + +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -126,6 +126,13 @@ struct rc_map_list { + struct rc_map map; + }; + ++#ifdef CONFIG_MEDIA_CEC_RC ++/* ++ * rc_map_list from rc-cec.c ++ */ ++extern struct rc_map_list cec_map; ++#endif ++ + /* Routines from rc-map.c */ + + /** diff --git a/queue-5.4/media-usbtv-fix-deadlock-on-suspend.patch b/queue-5.4/media-usbtv-fix-deadlock-on-suspend.patch new file mode 100644 index 00000000000..ec8ae0534e5 --- /dev/null +++ b/queue-5.4/media-usbtv-fix-deadlock-on-suspend.patch @@ -0,0 +1,42 @@ +From 8a7e27fd5cd696ba564a3f62cedef7269cfd0723 Mon Sep 17 00:00:00 2001 +From: Maxim Mikityanskiy +Date: Fri, 5 Feb 2021 23:51:39 +0100 +Subject: media: usbtv: Fix deadlock on suspend + +From: Maxim Mikityanskiy + +commit 8a7e27fd5cd696ba564a3f62cedef7269cfd0723 upstream. + +usbtv doesn't support power management, so on system suspend the +.disconnect callback of the driver is called. The teardown sequence +includes a call to snd_card_free. Its implementation waits until the +refcount of the sound card device drops to zero, however, if its file is +open, snd_card_file_add takes a reference, which can't be dropped during +the suspend, because the userspace processes are already frozen at this +point. snd_card_free waits for completion forever, leading to a hang on +suspend. + +This commit fixes this deadlock condition by replacing snd_card_free +with snd_card_free_when_closed, that doesn't wait until all references +are released, allowing suspend to progress. + +Fixes: 63ddf68de52e ("[media] usbtv: add audio support") +Signed-off-by: Maxim Mikityanskiy +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/usb/usbtv/usbtv-audio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/usb/usbtv/usbtv-audio.c ++++ b/drivers/media/usb/usbtv/usbtv-audio.c +@@ -399,7 +399,7 @@ void usbtv_audio_free(struct usbtv *usbt + cancel_work_sync(&usbtv->snd_trigger); + + if (usbtv->snd && usbtv->udev) { +- snd_card_free(usbtv->snd); ++ snd_card_free_when_closed(usbtv->snd); + usbtv->snd = NULL; + } + } diff --git a/queue-5.4/media-v4l-vsp1-fix-bru-null-pointer-access.patch b/queue-5.4/media-v4l-vsp1-fix-bru-null-pointer-access.patch new file mode 100644 index 00000000000..4d17f1eb74f --- /dev/null +++ b/queue-5.4/media-v4l-vsp1-fix-bru-null-pointer-access.patch @@ -0,0 +1,32 @@ +From ac8d82f586c8692b501cb974604a71ef0e22a04c Mon Sep 17 00:00:00 2001 +From: Biju Das +Date: Mon, 1 Mar 2021 13:08:27 +0100 +Subject: media: v4l: vsp1: Fix bru null pointer access + +From: Biju Das + +commit ac8d82f586c8692b501cb974604a71ef0e22a04c upstream. + +RZ/G2L SoC has only BRS. This patch fixes null pointer access,when only +BRS is enabled. + +Fixes: cbb7fa49c7466("media: v4l: vsp1: Rename BRU to BRx") +Signed-off-by: Biju Das +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/platform/vsp1/vsp1_drm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/platform/vsp1/vsp1_drm.c ++++ b/drivers/media/platform/vsp1/vsp1_drm.c +@@ -245,7 +245,7 @@ static int vsp1_du_pipeline_setup_brx(st + brx = &vsp1->bru->entity; + else if (pipe->brx && !drm_pipe->force_brx_release) + brx = pipe->brx; +- else if (!vsp1->bru->entity.pipe) ++ else if (vsp1_feature(vsp1, VSP1_HAS_BRU) && !vsp1->bru->entity.pipe) + brx = &vsp1->bru->entity; + else + brx = &vsp1->brs->entity; diff --git a/queue-5.4/media-v4l-vsp1-fix-uif-null-pointer-access.patch b/queue-5.4/media-v4l-vsp1-fix-uif-null-pointer-access.patch new file mode 100644 index 00000000000..fe9e66e19d2 --- /dev/null +++ b/queue-5.4/media-v4l-vsp1-fix-uif-null-pointer-access.patch @@ -0,0 +1,35 @@ +From 6732f313938027a910e1f7351951ff52c0329e70 Mon Sep 17 00:00:00 2001 +From: Biju Das +Date: Mon, 1 Mar 2021 13:08:28 +0100 +Subject: media: v4l: vsp1: Fix uif null pointer access + +From: Biju Das + +commit 6732f313938027a910e1f7351951ff52c0329e70 upstream. + +RZ/G2L SoC has no UIF. This patch fixes null pointer access, when UIF +module is not used. + +Fixes: 5e824f989e6e8("media: v4l: vsp1: Integrate DISCOM in display pipeline") +Signed-off-by: Biju Das +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/platform/vsp1/vsp1_drm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/media/platform/vsp1/vsp1_drm.c ++++ b/drivers/media/platform/vsp1/vsp1_drm.c +@@ -462,9 +462,9 @@ static int vsp1_du_pipeline_setup_inputs + * make sure it is present in the pipeline's list of entities if it + * wasn't already. + */ +- if (!use_uif) { ++ if (drm_pipe->uif && !use_uif) { + drm_pipe->uif->pipe = NULL; +- } else if (!drm_pipe->uif->pipe) { ++ } else if (drm_pipe->uif && !drm_pipe->uif->pipe) { + drm_pipe->uif->pipe = pipe; + list_add_tail(&drm_pipe->uif->list_pipe, &pipe->entities); + } diff --git a/queue-5.4/series b/queue-5.4/series index 934d5bf1110..a2c5974628c 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -53,3 +53,8 @@ drm-meson_drv-add-shutdown-function.patch s390-cio-return-efault-if-copy_to_user-fails-take-2.patch s390-crypto-return-efault-if-copy_to_user-fails.patch qxl-fix-uninitialised-struct-field-head.surface_id.patch +sh_eth-fix-trscer-mask-for-r7s9210.patch +media-usbtv-fix-deadlock-on-suspend.patch +media-v4l-vsp1-fix-uif-null-pointer-access.patch +media-v4l-vsp1-fix-bru-null-pointer-access.patch +media-rc-compile-rc-cec.c-into-rc-core.patch diff --git a/queue-5.4/sh_eth-fix-trscer-mask-for-r7s9210.patch b/queue-5.4/sh_eth-fix-trscer-mask-for-r7s9210.patch new file mode 100644 index 00000000000..b7c2c1fd329 --- /dev/null +++ b/queue-5.4/sh_eth-fix-trscer-mask-for-r7s9210.patch @@ -0,0 +1,33 @@ +From 165bc5a4f30eee4735845aa7dbd6b738643f2603 Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Sun, 28 Feb 2021 23:27:32 +0300 +Subject: sh_eth: fix TRSCER mask for R7S9210 + +From: Sergey Shtylyov + +commit 165bc5a4f30eee4735845aa7dbd6b738643f2603 upstream. + +According to the RZ/A2M Group User's Manual: Hardware, Rev. 2.00, +the TRSCER register has bit 9 reserved, hence we can't use the driver's +default TRSCER mask. Add the explicit initializer for sh_eth_cpu_data:: +trscer_err_mask for R7S9210. + +Fixes: 6e0bb04d0e4f ("sh_eth: Add R7S9210 support") +Signed-off-by: Sergey Shtylyov +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/renesas/sh_eth.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -828,6 +828,8 @@ static struct sh_eth_cpu_data r7s9210_da + + .fdr_value = 0x0000070f, + ++ .trscer_err_mask = DESC_I_RINT8 | DESC_I_RINT5, ++ + .apr = 1, + .mpr = 1, + .tpauser = 1, -- 2.47.3