From: Sebastian Fricke <sebastian.fricke.linux@gmail.com> To: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com, helen.koike@collabora.com, ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com, dafna3@gmail.com, sakari.ailus@linux.intel.com, linux-rockchip@lists.infradead.org, mchehab@kernel.org, tfiga@chromium.org Subject: Re: [PATCH] media: rkisp1: rsz: crash fix when setting src format Date: Wed, 9 Dec 2020 20:13:07 +0100 [thread overview] Message-ID: <20201209191307.smr27xutbizjp56w@basti.Speedport_W_724V_Typ_A_05011603_06_001> (raw) In-Reply-To: <20201209161510.31399-1-dafna.hirschfeld@collabora.com> Hey Dafna, Thanks for the patch, I quickly tested it and did some proofreading. I was able to recreate the crash with following commands: "media-ctl" "-d" "platform:rkisp1" "--set-v4l2" '"rkisp1_resizer_mainpath":1 [fmt:YUYV8_1_5X8/900x800]' "media-ctl" "-d" "platform:rkisp1" "--set-v4l2" '"rkisp1_resizer_mainpath":1 [fmt:YUYV8_2X8/900x800]' # This causes the crash: "Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004" This patch fixed the problem. On 09.12.2020 17:15, Dafna Hirschfeld wrote: >When setting the source media bus code in the resizer, >we first check that the current media bus code in the >source is yuv encoded format. This is done by s/is/is a/ >retrieving the data from the formats list of the isp >entity. This cause a crash when the media bus code on the s/cause/causes/ >source is YUYV8_1_5X8 which is not supported by the isp >entity. Instead we should test the sink format of the resizer >which is guaranteed to be supported by the isp entity. > >Fixes: 251b6eebb6c49 ("media: staging: rkisp1: rsz: Add support to more YUV encoded mbus codes on src pad") >Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Tested-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com> >--- > drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > >diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c >index 813670ed9577..79deed8adcea 100644 >--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c >+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c >@@ -520,14 +520,15 @@ static void rkisp1_rsz_set_src_fmt(struct rkisp1_resizer *rsz, > struct v4l2_mbus_framefmt *format, > unsigned int which) > { >- const struct rkisp1_isp_mbus_info *mbus_info; >- struct v4l2_mbus_framefmt *src_fmt; >+ const struct rkisp1_isp_mbus_info *sink_mbus_info; >+ struct v4l2_mbus_framefmt *src_fmt, *sink_fmt; > >+ sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SINK, which); > src_fmt = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SRC, which); >- mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code); >+ sink_mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code); > > /* for YUV formats, userspace can change the mbus code on the src pad if it is supported */ >- if (mbus_info->pixel_enc == V4L2_PIXEL_ENC_YUV && >+ if (sink_mbus_info->pixel_enc == V4L2_PIXEL_ENC_YUV && > rkisp1_rsz_get_yuv_mbus_info(format->code)) > src_fmt->code = format->code; > >-- >2.17.1 >
WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Fricke <sebastian.fricke.linux@gmail.com> To: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Cc: mchehab@kernel.org, dafna3@gmail.com, tfiga@chromium.org, hverkuil@xs4all.nl, linux-rockchip@lists.infradead.org, helen.koike@collabora.com, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, kernel@collabora.com, ezequiel@collabora.com, linux-media@vger.kernel.org Subject: Re: [PATCH] media: rkisp1: rsz: crash fix when setting src format Date: Wed, 9 Dec 2020 20:13:07 +0100 [thread overview] Message-ID: <20201209191307.smr27xutbizjp56w@basti.Speedport_W_724V_Typ_A_05011603_06_001> (raw) In-Reply-To: <20201209161510.31399-1-dafna.hirschfeld@collabora.com> Hey Dafna, Thanks for the patch, I quickly tested it and did some proofreading. I was able to recreate the crash with following commands: "media-ctl" "-d" "platform:rkisp1" "--set-v4l2" '"rkisp1_resizer_mainpath":1 [fmt:YUYV8_1_5X8/900x800]' "media-ctl" "-d" "platform:rkisp1" "--set-v4l2" '"rkisp1_resizer_mainpath":1 [fmt:YUYV8_2X8/900x800]' # This causes the crash: "Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004" This patch fixed the problem. On 09.12.2020 17:15, Dafna Hirschfeld wrote: >When setting the source media bus code in the resizer, >we first check that the current media bus code in the >source is yuv encoded format. This is done by s/is/is a/ >retrieving the data from the formats list of the isp >entity. This cause a crash when the media bus code on the s/cause/causes/ >source is YUYV8_1_5X8 which is not supported by the isp >entity. Instead we should test the sink format of the resizer >which is guaranteed to be supported by the isp entity. > >Fixes: 251b6eebb6c49 ("media: staging: rkisp1: rsz: Add support to more YUV encoded mbus codes on src pad") >Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Tested-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com> >--- > drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > >diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c >index 813670ed9577..79deed8adcea 100644 >--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c >+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c >@@ -520,14 +520,15 @@ static void rkisp1_rsz_set_src_fmt(struct rkisp1_resizer *rsz, > struct v4l2_mbus_framefmt *format, > unsigned int which) > { >- const struct rkisp1_isp_mbus_info *mbus_info; >- struct v4l2_mbus_framefmt *src_fmt; >+ const struct rkisp1_isp_mbus_info *sink_mbus_info; >+ struct v4l2_mbus_framefmt *src_fmt, *sink_fmt; > >+ sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SINK, which); > src_fmt = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SRC, which); >- mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code); >+ sink_mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code); > > /* for YUV formats, userspace can change the mbus code on the src pad if it is supported */ >- if (mbus_info->pixel_enc == V4L2_PIXEL_ENC_YUV && >+ if (sink_mbus_info->pixel_enc == V4L2_PIXEL_ENC_YUV && > rkisp1_rsz_get_yuv_mbus_info(format->code)) > src_fmt->code = format->code; > >-- >2.17.1 > _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2020-12-09 19:14 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-09 16:15 [PATCH] media: rkisp1: rsz: crash fix when setting src format Dafna Hirschfeld 2020-12-09 16:15 ` Dafna Hirschfeld 2020-12-09 16:53 ` Helen Koike 2020-12-09 16:53 ` Helen Koike 2020-12-09 19:13 ` Sebastian Fricke [this message] 2020-12-09 19:13 ` Sebastian Fricke 2021-02-10 6:09 ` Tomasz Figa 2021-02-10 6:09 ` Tomasz Figa
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201209191307.smr27xutbizjp56w@basti.Speedport_W_724V_Typ_A_05011603_06_001 \ --to=sebastian.fricke.linux@gmail.com \ --cc=dafna.hirschfeld@collabora.com \ --cc=dafna3@gmail.com \ --cc=ezequiel@collabora.com \ --cc=helen.koike@collabora.com \ --cc=hverkuil@xs4all.nl \ --cc=kernel@collabora.com \ --cc=laurent.pinchart@ideasonboard.com \ --cc=linux-media@vger.kernel.org \ --cc=linux-rockchip@lists.infradead.org \ --cc=mchehab@kernel.org \ --cc=sakari.ailus@linux.intel.com \ --cc=tfiga@chromium.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.