From: Greg Kroah-Hartman Date: Tue, 19 Nov 2024 12:08:32 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v6.12.1~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=781148d526e368c06913f341b6de392a1c79afd8;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: media-dvbdev-fix-the-logic-when-dvb_dynamic_minors-is-not-set.patch --- diff --git a/queue-5.4/media-dvbdev-fix-the-logic-when-dvb_dynamic_minors-is-not-set.patch b/queue-5.4/media-dvbdev-fix-the-logic-when-dvb_dynamic_minors-is-not-set.patch new file mode 100644 index 00000000000..79f25d946f9 --- /dev/null +++ b/queue-5.4/media-dvbdev-fix-the-logic-when-dvb_dynamic_minors-is-not-set.patch @@ -0,0 +1,57 @@ +From a4aebaf6e6efff548b01a3dc49b4b9074751c15b Mon Sep 17 00:00:00 2001 +From: Mauro Carvalho Chehab +Date: Wed, 6 Nov 2024 21:50:55 +0100 +Subject: media: dvbdev: fix the logic when DVB_DYNAMIC_MINORS is not set + +From: Mauro Carvalho Chehab + +commit a4aebaf6e6efff548b01a3dc49b4b9074751c15b upstream. + +When CONFIG_DVB_DYNAMIC_MINORS, ret is not initialized, and a +semaphore is left at the wrong state, in case of errors. + +Make the code simpler and avoid mistakes by having just one error +check logic used weather DVB_DYNAMIC_MINORS is used or not. + +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Closes: https://lore.kernel.org/r/202410201717.ULWWdJv8-lkp@intel.com/ +Signed-off-by: Mauro Carvalho Chehab +Link: https://lore.kernel.org/r/9e067488d8935b8cf00959764a1fa5de85d65725.1730926254.git.mchehab+huawei@kernel.org +Cc: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/dvb-core/dvbdev.c | 15 ++++----------- + 1 file changed, 4 insertions(+), 11 deletions(-) + +--- a/drivers/media/dvb-core/dvbdev.c ++++ b/drivers/media/dvb-core/dvbdev.c +@@ -544,6 +544,9 @@ int dvb_register_device(struct dvb_adapt + for (minor = 0; minor < MAX_DVB_MINORS; minor++) + if (dvb_minors[minor] == NULL) + break; ++#else ++ minor = nums2minor(adap->num, type, id); ++#endif + if (minor >= MAX_DVB_MINORS) { + if (new_node) { + list_del (&new_node->list_head); +@@ -557,17 +560,7 @@ int dvb_register_device(struct dvb_adapt + mutex_unlock(&dvbdev_register_lock); + return -EINVAL; + } +-#else +- minor = nums2minor(adap->num, type, id); +- if (minor >= MAX_DVB_MINORS) { +- dvb_media_device_free(dvbdev); +- list_del(&dvbdev->list_head); +- kfree(dvbdev); +- *pdvbdev = NULL; +- mutex_unlock(&dvbdev_register_lock); +- return ret; +- } +-#endif ++ + dvbdev->minor = minor; + dvb_minors[minor] = dvb_device_get(dvbdev); + up_write(&minor_rwsem); diff --git a/queue-5.4/series b/queue-5.4/series index 9815cc05c3c..91d0e0000a4 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -7,3 +7,4 @@ nilfs2-fix-null-ptr-deref-in-block_touch_buffer-tracepoint.patch ocfs2-fix-ubsan-warning-in-ocfs2_verify_volume.patch nilfs2-fix-null-ptr-deref-in-block_dirty_buffer-tracepoint.patch revert-mmc-dw_mmc-fix-idmac-operation-with-pages-bigger-than-4k.patch +media-dvbdev-fix-the-logic-when-dvb_dynamic_minors-is-not-set.patch