[{"id":5303,"web_url":"https://patchwork.libcamera.org/comment/5303/","msgid":"<20200620022640.GA5823@pendragon.ideasonboard.com>","date":"2020-06-20T02:26:40","subject":"Re: [libcamera-devel] [PATCH v2 15/17] v4l2: v4l2_camera_proxy:\n\tDon't allow streamon if no buffers have been requested","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Fri, Jun 19, 2020 at 02:41:21PM +0900, Paul Elder wrote:\n> Make VIDIOC_STREAMON return -EINVAL if no buffers have been allocated\n> with reqbufs.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> \n> ---\n> New in v2\n> - split from \"Fix v4l2-compliance streaming tests\"\n> ---\n>  src/v4l2/v4l2_camera_proxy.cpp | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> index 8396f58..a7f987a 100644\n> --- a/src/v4l2/v4l2_camera_proxy.cpp\n> +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> @@ -637,6 +637,9 @@ int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *cf, int *arg)\n>  {\n>  \tLOG(V4L2Compat, Debug) << \"Servicing vidioc_streamon fd = \" << cf->efd();\n>  \n> +\tif (bufferCount_ == 0)\n> +\t\treturn -EINVAL;\n> +\n\nThis should also be after the lock(), and I would move it after the\nisRunning() test.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \tif (vcam_->isRunning())\n>  \t\treturn 0;\n>","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CEDE760710\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 20 Jun 2020 04:27:05 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5C1EC592;\n\tSat, 20 Jun 2020 04:27:04 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"mv6ExkSE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1592620024;\n\tbh=ebfN+diIPlSAq1KnYsGiuUVRWUiKv8/Ckh0hWrXUeHI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=mv6ExkSEL99q372EgCu0U+rlDtPpM/piLYXGPecBzzaK6k6NWcvbWXNH3PkAmPjbD\n\tdLx5nwXY62t/Nz+hYz5vcBeIjAlJSy+9CnuWgy4I0yVGRyI8vTBoCZv5VGfuUTGEnU\n\tmTuDT1/XtGR6ug+BNnCj4MMbRvkC5vNwgk5kGn2Q=","Date":"Sat, 20 Jun 2020 05:26:40 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200620022640.GA5823@pendragon.ideasonboard.com>","References":"<20200619054123.19052-1-paul.elder@ideasonboard.com>\n\t<20200619054123.19052-16-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200619054123.19052-16-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 15/17] v4l2: v4l2_camera_proxy:\n\tDon't allow streamon if no buffers have been requested","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Sat, 20 Jun 2020 02:27:06 -0000"}},{"id":5342,"web_url":"https://patchwork.libcamera.org/comment/5342/","msgid":"<20200623055919.GA2843@jade.amanokami.net>","date":"2020-06-23T05:59:19","subject":"Re: [libcamera-devel] [PATCH v2 15/17] v4l2: v4l2_camera_proxy:\n\tDon't allow streamon if no buffers have been requested","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Laurent,\n\nThank you for the review.\n\nOn Sat, Jun 20, 2020 at 05:26:40AM +0300, Laurent Pinchart wrote:\n> Hi Paul,\n> \n> Thank you for the patch.\n> \n> On Fri, Jun 19, 2020 at 02:41:21PM +0900, Paul Elder wrote:\n> > Make VIDIOC_STREAMON return -EINVAL if no buffers have been allocated\n> > with reqbufs.\n> > \n> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> > \n> > ---\n> > New in v2\n> > - split from \"Fix v4l2-compliance streaming tests\"\n> > ---\n> >  src/v4l2/v4l2_camera_proxy.cpp | 3 +++\n> >  1 file changed, 3 insertions(+)\n> > \n> > diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> > index 8396f58..a7f987a 100644\n> > --- a/src/v4l2/v4l2_camera_proxy.cpp\n> > +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> > @@ -637,6 +637,9 @@ int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *cf, int *arg)\n> >  {\n> >  \tLOG(V4L2Compat, Debug) << \"Servicing vidioc_streamon fd = \" << cf->efd();\n> >  \n> > +\tif (bufferCount_ == 0)\n> > +\t\treturn -EINVAL;\n> > +\n> \n> This should also be after the lock(), and I would move it after the\n> isRunning() test.\n\nv4l2-compliance fails if it's before lock() (now hasOwnership()).\n\nIt does reqbufs 0 -> expect streamon EINVAL\n\nSo if it does hasOwnership() first, then it'll return EBUSY instead and\nfail.\n\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> >  \tif (vcam_->isRunning())\n> >  \t\treturn 0;\n> >  \n\n\nThanks,\n\nPaul","headers":{"Return-Path":"<paul.elder@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3144D603B8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jun 2020 07:59:30 +0200 (CEST)","from jade.amanokami.net (unknown\n\t[IPv6:2400:4051:61:600:8147:f2a2:a8c6:9087])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 47E502A9;\n\tTue, 23 Jun 2020 07:59:27 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Rr9tvx97\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1592891969;\n\tbh=sTI1+GHCPnMaY8QNx9LuZnhq3bISS7qCCjczvJ2A038=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Rr9tvx97FG3f6PpkPIQ7Fp6e76Ko9UN162rZwm1VUl7LbocYFBsWMBbmww+4Xtp9x\n\tvRj06SSWKudiRP5rrA1vYhOSSDdTt+cO1VWJngZEOKU0cWSV0nODzhDKs+UXWOHE4s\n\tDWdyJr/F2T41aVnrQLgfVWk1BIrpGm/fnFXLLkEY=","Date":"Tue, 23 Jun 2020 14:59:19 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200623055919.GA2843@jade.amanokami.net>","References":"<20200619054123.19052-1-paul.elder@ideasonboard.com>\n\t<20200619054123.19052-16-paul.elder@ideasonboard.com>\n\t<20200620022640.GA5823@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20200620022640.GA5823@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 15/17] v4l2: v4l2_camera_proxy:\n\tDon't allow streamon if no buffers have been requested","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 23 Jun 2020 05:59:30 -0000"}}]