* [PATCH 5.10/5.15 0/1] media: atomisp: add error checking to atomisp_create_pipes_stream()
@ 2023-11-09 15:00 Anastasia Belova
2023-11-09 15:00 ` [PATCH 5.10/5.15 1/1] " Anastasia Belova
2024-02-01 12:15 ` [PATCH 5.10/5.15] " Anastasia Belova
0 siblings, 2 replies; 3+ messages in thread
From: Anastasia Belova @ 2023-11-09 15:00 UTC (permalink / raw
To: stable, Greg Kroah-Hartman .
Cc: Anastasia Belova, lvc-project, Mauro Carvalho Chehab,
Sakari Ailus, Hans de Goede, Andy Shevchenko, Tsuchiya Yuto,
linux-media, linux-staging, linux-kernel
atomisp_create_pipes_stream does not handle errors in
__create_pipes and __create_streams in versions 5.10
and 5.15. The following patch may fix it.
Found by Linux Verification Center (linuxtesting.org) with Svace.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 5.10/5.15 1/1] media: atomisp: add error checking to atomisp_create_pipes_stream()
2023-11-09 15:00 [PATCH 5.10/5.15 0/1] media: atomisp: add error checking to atomisp_create_pipes_stream() Anastasia Belova
@ 2023-11-09 15:00 ` Anastasia Belova
2024-02-01 12:15 ` [PATCH 5.10/5.15] " Anastasia Belova
1 sibling, 0 replies; 3+ messages in thread
From: Anastasia Belova @ 2023-11-09 15:00 UTC (permalink / raw
To: stable, Greg Kroah-Hartman .
Cc: Anastasia Belova, lvc-project, Mauro Carvalho Chehab,
Sakari Ailus, Hans de Goede, Andy Shevchenko, Tsuchiya Yuto,
linux-media, linux-staging, linux-kernel
From: Hans de Goede <hdegoede@redhat.com>
commit 798d2ad739da5343122eff386578f259278f2594 upstream.
The functions called by atomisp_create_pipes_stream() can fail,
add error checking for them.
Link: https://lore.kernel.org/linux-media/20220615205037.16549-35-hdegoede@redhat.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
---
.../media/atomisp/pci/atomisp_compat.h | 2 +-
.../media/atomisp/pci/atomisp_compat_css20.c | 20 ++++++++++++++++---
.../staging/media/atomisp/pci/atomisp_ioctl.c | 13 ++++++++++--
3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat.h b/drivers/staging/media/atomisp/pci/atomisp_compat.h
index c16eaf3d126f..75c978c4e6f3 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat.h
@@ -242,7 +242,7 @@ int atomisp_css_input_configure_port(struct atomisp_sub_device *asd,
unsigned int metadata_width,
unsigned int metadata_height);
-void atomisp_create_pipes_stream(struct atomisp_sub_device *asd);
+int atomisp_create_pipes_stream(struct atomisp_sub_device *asd);
void atomisp_destroy_pipes_stream_force(struct atomisp_sub_device *asd);
void atomisp_css_stop(struct atomisp_sub_device *asd,
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index 99a632f33d2d..f64d73b4c4b7 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -795,10 +795,24 @@ static int __create_pipes(struct atomisp_sub_device *asd)
return -EINVAL;
}
-void atomisp_create_pipes_stream(struct atomisp_sub_device *asd)
+int atomisp_create_pipes_stream(struct atomisp_sub_device *asd)
{
- __create_pipes(asd);
- __create_streams(asd);
+ int ret;
+
+ ret = __create_pipes(asd);
+ if (ret) {
+ dev_err(asd->isp->dev, "create pipe failed %d.\n", ret);
+ return ret;
+ }
+
+ ret = __create_streams(asd);
+ if (ret) {
+ dev_warn(asd->isp->dev, "create stream failed %d.\n", ret);
+ __destroy_pipes(asd, true);
+ return ret;
+ }
+
+ return 0;
}
int atomisp_css_update_stream(struct atomisp_sub_device *asd)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index b7dda4b96d49..06bb1c87c814 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -2243,8 +2243,17 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
dev_err(isp->dev, "atomisp_reset");
atomisp_reset(isp);
for (i = 0; i < isp->num_of_streams; i++) {
- if (recreate_streams[i])
- atomisp_create_pipes_stream(&isp->asd[i]);
+ if (recreate_streams[i]) {
+ int ret2;
+
+ ret2 = atomisp_create_pipes_stream(&isp->asd[i]);
+ if (ret2) {
+ dev_err(isp->dev, "%s error re-creating streams: %d\n",
+ __func__, ret2);
+ if (!ret)
+ ret = ret2;
+ }
+ }
}
isp->isp_timeout = false;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 5.10/5.15] media: atomisp: add error checking to atomisp_create_pipes_stream()
2023-11-09 15:00 [PATCH 5.10/5.15 0/1] media: atomisp: add error checking to atomisp_create_pipes_stream() Anastasia Belova
2023-11-09 15:00 ` [PATCH 5.10/5.15 1/1] " Anastasia Belova
@ 2024-02-01 12:15 ` Anastasia Belova
1 sibling, 0 replies; 3+ messages in thread
From: Anastasia Belova @ 2024-02-01 12:15 UTC (permalink / raw
To: stable, Greg Kroah-Hartman .
Cc: Anastasia Belova, lvc-project, Mauro Carvalho Chehab,
Sakari Ailus, Hans de Goede, Andy Shevchenko, Tsuchiya Yuto,
linux-media, linux-staging, linux-kernel
Just a friendly reminder.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-01 12:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 15:00 [PATCH 5.10/5.15 0/1] media: atomisp: add error checking to atomisp_create_pipes_stream() Anastasia Belova
2023-11-09 15:00 ` [PATCH 5.10/5.15 1/1] " Anastasia Belova
2024-02-01 12:15 ` [PATCH 5.10/5.15] " Anastasia Belova
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).