media: omap3isp: handle NULL return of omap3isp_video_format_info() in ccdc_is_shiftable().
Message ID | a601fdb6d224f2e4f1a3c1249ebf8438f4b8b5ce.1498499658.git.hns@goldelico.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Laurent Pinchart |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from <linux-media-owner@vger.kernel.org>) id 1dPYDa-00005d-QH; Mon, 26 Jun 2017 17:54:34 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.89/mailfrontend-8) with esmtp id 1dPYDZ-0003SL-jL; Mon, 26 Jun 2017 19:54:34 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751376AbdFZRyZ (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Mon, 26 Jun 2017 13:54:25 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.218]:20092 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751101AbdFZRyY (ORCPT <rfc822;linux-media@vger.kernel.org>); Mon, 26 Jun 2017 13:54:24 -0400 X-Greylist: delayed 42760 seconds by postgrey-1.27 at vger.kernel.org; Mon, 26 Jun 2017 13:54:24 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1498499662; l=869; s=domk; d=goldelico.com; h=Date:Subject:Cc:To:From; bh=jTiuVymlOw6x7KrMrQ44eiO4dnKz7lVkwdThOhK7Jrs=; b=QVbLDEfjzBKQazFoiWh0PkXHliqdwFg0DJBL5pHDJbQGrYX32vit5Se8VCRKtptUuf O6PImi+zIuAT/kY4all/4lw9vN9cb/eZ5o+WSmeT86CydiXfxiI0NFbkzZtz2/lqoKiq 9hqSS0W6+pSiYqMMLiwghfp4HzbufDY1fu6fU= X-RZG-AUTH: :JGIXVUS7cutRB/49FwqZ7WcecEarQROEYabkiUo6mSAGQ+qKID8yPJWK6w== X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain (p57AE0E2E.dip0.t-ipconnect.de [87.174.14.46]) by smtp.strato.de (RZmta 41.0 DYNA|AUTH) with ESMTPSA id w03374t5QHsKpOm (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Mon, 26 Jun 2017 19:54:20 +0200 (CEST) From: "H. Nikolaus Schaller" <hns@goldelico.com> To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, s-anna@ti.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, "H. Nikolaus Schaller" <hns@goldelico.com> Subject: [PATCH] media: omap3isp: handle NULL return of omap3isp_video_format_info() in ccdc_is_shiftable(). Date: Mon, 26 Jun 2017 19:54:19 +0200 Message-Id: <a601fdb6d224f2e4f1a3c1249ebf8438f4b8b5ce.1498499658.git.hns@goldelico.com> X-Mailer: git-send-email 2.12.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2017.6.26.174816 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_LESS 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, BODY_SIZE_800_899 0, DKIM_SIGNATURE 0, FROM_NAME_PHRASE 0, LEGITIMATE_SIGNS 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, __ANY_URI 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __FROM_DOMAIN_IN_ANY_CC2 0, __FROM_DOMAIN_IN_RCPT 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_LIST_ID 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MULTIPLE_RCPTS_CC_X2 0, __NO_HTML_TAG_RAW 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NAME 0, __TO_NAME_DIFF_FROM_ACC 0, __TO_REAL_NAMES 0, __URI_NO_WWW 0, __URI_NS ' |
Commit Message
H. Nikolaus Schaller
June 26, 2017, 5:54 p.m. UTC
If a camera module driver specifies a format that is not
supported by omap3isp this ends in a NULL pointer
dereference instead of a simple fail.
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
drivers/media/platform/omap3isp/ispccdc.c | 3 +++
1 file changed, 3 insertions(+)
Comments
Hi Nikolaus, On Mon, Jun 26, 2017 at 07:54:19PM +0200, H. Nikolaus Schaller wrote: > If a camera module driver specifies a format that is not > supported by omap3isp this ends in a NULL pointer > dereference instead of a simple fail. Has this happened in practice? If it does, it is probably a driver bug --- the formats on its pads should be recognised by the driver. WARN_ON() around the condition would be good to avoid silently ignoring such issues. I wonder what Laurent thinks. > > Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> > --- > drivers/media/platform/omap3isp/ispccdc.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c > index 2fb755f20a6b..dcf16ee7c612 100644 > --- a/drivers/media/platform/omap3isp/ispccdc.c > +++ b/drivers/media/platform/omap3isp/ispccdc.c > @@ -2397,6 +2397,9 @@ static bool ccdc_is_shiftable(u32 in, u32 out, unsigned int additional_shift) > in_info = omap3isp_video_format_info(in); > out_info = omap3isp_video_format_info(out); > > + if (!in_info || !out_info) > + return false; > + > if ((in_info->flavor == 0) || (out_info->flavor == 0)) > return false; >
Hi, > Am 26.06.2017 um 22:12 schrieb Sakari Ailus <sakari.ailus@iki.fi>: > > Hi Nikolaus, > > On Mon, Jun 26, 2017 at 07:54:19PM +0200, H. Nikolaus Schaller wrote: >> If a camera module driver specifies a format that is not >> supported by omap3isp this ends in a NULL pointer >> dereference instead of a simple fail. > > Has this happened in practice? Yes. I wouldn't have noticed it otherwise. It happens with a new ov965x driver just submitted for review. It seems to provide some format that the omap3isp does not understand. I can send you a console stack log if needed. > If it does, it is probably a driver bug --- > the formats on its pads should be recognised by the driver. > > WARN_ON() around the condition would be good to avoid silently ignoring such > issues. > > I wonder what Laurent thinks. > >> >> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> >> --- >> drivers/media/platform/omap3isp/ispccdc.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c >> index 2fb755f20a6b..dcf16ee7c612 100644 >> --- a/drivers/media/platform/omap3isp/ispccdc.c >> +++ b/drivers/media/platform/omap3isp/ispccdc.c >> @@ -2397,6 +2397,9 @@ static bool ccdc_is_shiftable(u32 in, u32 out, unsigned int additional_shift) >> in_info = omap3isp_video_format_info(in); >> out_info = omap3isp_video_format_info(out); >> >> + if (!in_info || !out_info) >> + return false; >> + >> if ((in_info->flavor == 0) || (out_info->flavor == 0)) >> return false; >> > > -- > Regards, > > Sakari Ailus > e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk BR and thanks, Nikolaus
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c index 2fb755f20a6b..dcf16ee7c612 100644 --- a/drivers/media/platform/omap3isp/ispccdc.c +++ b/drivers/media/platform/omap3isp/ispccdc.c @@ -2397,6 +2397,9 @@ static bool ccdc_is_shiftable(u32 in, u32 out, unsigned int additional_shift) in_info = omap3isp_video_format_info(in); out_info = omap3isp_video_format_info(out); + if (!in_info || !out_info) + return false; + if ((in_info->flavor == 0) || (out_info->flavor == 0)) return false;