Message ID | 1483449131-18075-1-git-send-email-kieran.bingham+renesas@ideasonboard.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Sakari Ailus |
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 1cOOw0-00053F-16; Tue, 03 Jan 2017 13:15:24 +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.84_2/mailfrontend-8) with esmtp id 1cOOvx-000529-mK; Tue, 03 Jan 2017 14:15:23 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756479AbdACNMq (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Tue, 3 Jan 2017 08:12:46 -0500 Received: from mail.kernel.org ([198.145.29.136]:36626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757376AbdACNMf (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 3 Jan 2017 08:12:35 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B055204EA; Tue, 3 Jan 2017 13:12:33 +0000 (UTC) Received: from CookieMonster.cookiemonster.local (cpc89244-aztw30-2-0-cust5770.18-1.cable.virginm.net [86.31.182.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A06D203E3; Tue, 3 Jan 2017 13:12:30 +0000 (UTC) From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> To: sakari.ailus@iki.fi, laurent.pinchart@ideasonboard.com, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Subject: [PATCH] media: entity: Catch unbalanced media_pipeline_stop calls Date: Tue, 3 Jan 2017 13:12:11 +0000 Message-Id: <1483449131-18075-1-git-send-email-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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.1.3.130618 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_1400_1499 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, LEGITIMATE_NEGATE 0, LEGITIMATE_SIGNS 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __CP_URI_IN_BODY 0, __FROM_DOMAIN_IN_ANY_CC2 0, __FROM_DOMAIN_IN_ANY_TO2 0, __FROM_DOMAIN_IN_RCPT 0, __HAS_CC_HDR 0, __HAS_FROM 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, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0' |
Commit Message
Kieran Bingham
Jan. 3, 2017, 1:12 p.m. UTC
Drivers must not perform unbalanced calls to stop the entity pipeline,
however if they do they will fault in the core media code, as the
entity->pipe will be set as NULL. We handle this gracefully in the core
with a WARN for the developer.
Replace the erroneous check on zero streaming counts, with a check on
NULL pipe elements instead, as this is the symptom of unbalanced
media_pipeline_stop calls.
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
---
drivers/media/media-entity.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Comments
Hi Kieran, Thank you for the patch. On Tuesday 03 Jan 2017 13:12:11 Kieran Bingham wrote: > Drivers must not perform unbalanced calls to stop the entity pipeline, > however if they do they will fault in the core media code, as the > entity->pipe will be set as NULL. We handle this gracefully in the core > with a WARN for the developer. > > Replace the erroneous check on zero streaming counts, with a check on > NULL pipe elements instead, as this is the symptom of unbalanced > media_pipeline_stop calls. > > Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> This looks good to me, Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> I'll let Sakari review and merge the patch. > --- > drivers/media/media-entity.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c > index caa13e6f09f5..cb1fb2c17f85 100644 > --- a/drivers/media/media-entity.c > +++ b/drivers/media/media-entity.c > @@ -534,8 +534,13 @@ void __media_pipeline_stop(struct media_entity *entity) > struct media_graph *graph = &entity->pipe->graph; > struct media_pipeline *pipe = entity->pipe; > > + /* > + * If the following check fails, the driver has performed an > + * unbalanced call to media_pipeline_stop() > + */ > + if (WARN_ON(!pipe)) > + return; > > - WARN_ON(!pipe->streaming_count); > media_graph_walk_start(graph, entity); > > while ((entity = media_graph_walk_next(graph))) {
On 03/01/17 13:36, Laurent Pinchart wrote: > Hi Kieran, > > Thank you for the patch. > > On Tuesday 03 Jan 2017 13:12:11 Kieran Bingham wrote: >> Drivers must not perform unbalanced calls to stop the entity pipeline, >> however if they do they will fault in the core media code, as the >> entity->pipe will be set as NULL. We handle this gracefully in the core >> with a WARN for the developer. >> >> Replace the erroneous check on zero streaming counts, with a check on >> NULL pipe elements instead, as this is the symptom of unbalanced >> media_pipeline_stop calls. >> >> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> > > This looks good to me, > > Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > I'll let Sakari review and merge the patch. Ahh, yes - I forgot to mention, although perhaps it will be obvious for Sakari - but this patch is based on top of Sakari's pending media pipeline and graph walk cleanup series :D -- Regards Kieran > >> --- >> drivers/media/media-entity.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c >> index caa13e6f09f5..cb1fb2c17f85 100644 >> --- a/drivers/media/media-entity.c >> +++ b/drivers/media/media-entity.c >> @@ -534,8 +534,13 @@ void __media_pipeline_stop(struct media_entity *entity) >> struct media_graph *graph = &entity->pipe->graph; >> struct media_pipeline *pipe = entity->pipe; >> >> + /* >> + * If the following check fails, the driver has performed an >> + * unbalanced call to media_pipeline_stop() >> + */ >> + if (WARN_ON(!pipe)) >> + return; >> >> - WARN_ON(!pipe->streaming_count); >> media_graph_walk_start(graph, entity); >> >> while ((entity = media_graph_walk_next(graph))) { > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Kieran, Thanks for the patch! On Tue, Jan 03, 2017 at 05:05:58PM +0000, Kieran Bingham wrote: > On 03/01/17 13:36, Laurent Pinchart wrote: > > Hi Kieran, > > > > Thank you for the patch. > > > > On Tuesday 03 Jan 2017 13:12:11 Kieran Bingham wrote: > >> Drivers must not perform unbalanced calls to stop the entity pipeline, > >> however if they do they will fault in the core media code, as the > >> entity->pipe will be set as NULL. We handle this gracefully in the core > >> with a WARN for the developer. > >> > >> Replace the erroneous check on zero streaming counts, with a check on > >> NULL pipe elements instead, as this is the symptom of unbalanced > >> media_pipeline_stop calls. > >> > >> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> > > > > This looks good to me, > > > > Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > > I'll let Sakari review and merge the patch. > > Ahh, yes - I forgot to mention, although perhaps it will be obvious for > Sakari - but this patch is based on top of Sakari's pending media > pipeline and graph walk cleanup series :D I've applied this on top of the other patches. It's always good to mention dependencies to other patches, that's very relevant for reviewers.
Hi Sakari, On 04/01/17 08:57, Sakari Ailus wrote: > Hi Kieran, > > Thanks for the patch! > > On Tue, Jan 03, 2017 at 05:05:58PM +0000, Kieran Bingham wrote: >> On 03/01/17 13:36, Laurent Pinchart wrote: >>> Hi Kieran, >>> >>> Thank you for the patch. >>> >>> On Tuesday 03 Jan 2017 13:12:11 Kieran Bingham wrote: >>>> Drivers must not perform unbalanced calls to stop the entity pipeline, >>>> however if they do they will fault in the core media code, as the >>>> entity->pipe will be set as NULL. We handle this gracefully in the core >>>> with a WARN for the developer. >>>> >>>> Replace the erroneous check on zero streaming counts, with a check on >>>> NULL pipe elements instead, as this is the symptom of unbalanced >>>> media_pipeline_stop calls. >>>> >>>> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> >>> >>> This looks good to me, >>> >>> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> >>> >>> I'll let Sakari review and merge the patch. >> >> Ahh, yes - I forgot to mention, although perhaps it will be obvious for >> Sakari - but this patch is based on top of Sakari's pending media >> pipeline and graph walk cleanup series :D > > I've applied this on top of the other patches. > > It's always good to mention dependencies to other patches, that's very > relevant for reviewers. I've just been going through my old branches doing some clean up - and I can't see that this patch [0] made it to integration anywhere. Did it get lost? It looks like the cleanup series it was based on made it through... Mauro, perhaps you could pick this one up now ? Regards Kieran [0] https://www.spinics.net/lists/linux-media/msg109715.html
Hi Kieran / Mauro, On Fri, May 05, 2017 at 06:33:22PM +0100, Kieran Bingham wrote: > Hi Sakari, > > On 04/01/17 08:57, Sakari Ailus wrote: > > Hi Kieran, > > > > Thanks for the patch! > > > > On Tue, Jan 03, 2017 at 05:05:58PM +0000, Kieran Bingham wrote: > >> On 03/01/17 13:36, Laurent Pinchart wrote: > >>> Hi Kieran, > >>> > >>> Thank you for the patch. > >>> > >>> On Tuesday 03 Jan 2017 13:12:11 Kieran Bingham wrote: > >>>> Drivers must not perform unbalanced calls to stop the entity pipeline, > >>>> however if they do they will fault in the core media code, as the > >>>> entity->pipe will be set as NULL. We handle this gracefully in the core > >>>> with a WARN for the developer. > >>>> > >>>> Replace the erroneous check on zero streaming counts, with a check on > >>>> NULL pipe elements instead, as this is the symptom of unbalanced > >>>> media_pipeline_stop calls. > >>>> > >>>> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> > >>> > >>> This looks good to me, > >>> > >>> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > >>> > >>> I'll let Sakari review and merge the patch. > >> > >> Ahh, yes - I forgot to mention, although perhaps it will be obvious for > >> Sakari - but this patch is based on top of Sakari's pending media > >> pipeline and graph walk cleanup series :D > > > > I've applied this on top of the other patches. > > > > It's always good to mention dependencies to other patches, that's very > > relevant for reviewers. > > I've just been going through my old branches doing some clean up - and I can't > see that this patch [0] made it to integration anywhere. > > Did it get lost? > It looks like the cleanup series it was based on made it through... What I think happened was that I had applied it to the correct branch BUT I already had sent a pull request on it. My apologies. > > Mauro, perhaps you could pick this one up now ? The patchwork link is here: <URL:https://patchwork.linuxtv.org/patch/38883/>
Hi Sakari, >> Did it get lost? >> It looks like the cleanup series it was based on made it through... > > What I think happened was that I had applied it to the correct branch BUT I > already had sent a pull request on it. My apologies. No worries - thanks for checking! > >> >> Mauro, perhaps you could pick this one up now ? > > The patchwork link is here: > > <URL:https://patchwork.linuxtv.org/patch/38883/> Regards Kieran
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index caa13e6f09f5..cb1fb2c17f85 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -534,8 +534,13 @@ void __media_pipeline_stop(struct media_entity *entity) struct media_graph *graph = &entity->pipe->graph; struct media_pipeline *pipe = entity->pipe; + /* + * If the following check fails, the driver has performed an + * unbalanced call to media_pipeline_stop() + */ + if (WARN_ON(!pipe)) + return; - WARN_ON(!pipe->streaming_count); media_graph_walk_start(graph, entity); while ((entity = media_graph_walk_next(graph))) {