From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] media: uvcvideo: Remove redundant NULL assignment
Date: Thu, 28 Nov 2024 23:47:27 +0200 [thread overview]
Message-ID: <20241128214727.GE25839@pendragon.ideasonboard.com> (raw)
In-Reply-To: <CANiDSCvb8OCGJjggermRPeD6R2Rt79hMuwF6xc6YQvvSqUNObA@mail.gmail.com>
On Thu, Nov 28, 2024 at 10:34:38PM +0100, Ricardo Ribalda wrote:
> On Thu, 28 Nov 2024 at 22:26, Laurent Pinchart wrote:
> > On Wed, Nov 27, 2024 at 12:14:52PM +0000, Ricardo Ribalda wrote:
> > > ctrl->handle will only be different than NULL for controls that have
> > > mappings. This is because that assignment is only done inside
> > > uvc_ctrl_set() for mapped controls.
> >
> > That seems right. I checked the unplug paths, and the mappings are
> > destroyed from uvc_delete(), after all file handles get closed.
> >
> > I think this patch should go first in the series, as otherwise there's a
> > temporary state where you rely on handle never being touched without
> > holding the proper lock, and this code path violates that requirement.
> > Is there anything I may be missing that would cause issues with
> > bisection if I move this patch at the beginning of the series ?
>
> You probably want to add the Cc: stable and Fixes: tags if you make
> this patch the first one.
Good point. Given that ctrl->handle for controls without mappings can't
be touched anywhere else, I think it's safe to keep this patch last, and
not backport it. There may be a theoretical issue with mappings
dynamically added at runtime, as the list could then become non-empty
and the condition change, but the condition should never turn from false
to true, only from true to false, so I think it's safe.
I'll keep the patch last.
> > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> >
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >
> > > ---
> > > drivers/media/usb/uvc/uvc_ctrl.c | 4 +---
> > > 1 file changed, 1 insertion(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> > > index 99ddc5e9dff8..b9c9ff629ab6 100644
> > > --- a/drivers/media/usb/uvc/uvc_ctrl.c
> > > +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> > > @@ -1645,10 +1645,8 @@ bool uvc_ctrl_status_event_async(struct urb *urb, struct uvc_video_chain *chain,
> > > struct uvc_device *dev = chain->dev;
> > > struct uvc_ctrl_work *w = &dev->async_ctrl;
> > >
> > > - if (list_empty(&ctrl->info.mappings)) {
> > > - ctrl->handle = NULL;
> > > + if (list_empty(&ctrl->info.mappings))
> > > return false;
> > > - }
> > >
> > > w->data = data;
> > > w->urb = urb;
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2024-11-28 21:47 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 12:14 [PATCH v2 0/4] media: uvcvideo: Two fixes for async controls Ricardo Ribalda
2024-11-27 12:14 ` [PATCH v2 1/4] media: uvcvideo: Remove dangling pointers Ricardo Ribalda
2024-11-28 22:16 ` Laurent Pinchart
2024-11-28 22:25 ` Ricardo Ribalda
2024-11-28 22:28 ` Laurent Pinchart
2024-11-29 0:21 ` Ricardo Ribalda
2024-11-29 21:22 ` Ricardo Ribalda
2024-11-27 12:14 ` [PATCH v2 2/4] media: uvcvideo: Do not set an async control owned by other fh Ricardo Ribalda
2024-11-28 22:22 ` Laurent Pinchart
2024-11-28 22:28 ` Ricardo Ribalda
2024-11-28 22:33 ` Laurent Pinchart
2024-11-29 10:36 ` Hans Verkuil
2024-11-29 10:59 ` Ricardo Ribalda
2024-11-29 11:06 ` Laurent Pinchart
2024-11-29 11:54 ` Ricardo Ribalda
2024-11-29 13:13 ` Hans Verkuil
2024-11-29 13:41 ` Ricardo Ribalda
2024-11-29 18:47 ` Ricardo Ribalda
2024-11-29 22:03 ` Laurent Pinchart
2024-11-29 22:18 ` Ricardo Ribalda
2024-12-02 0:18 ` Laurent Pinchart
2024-12-02 7:28 ` Ricardo Ribalda
2024-12-02 8:38 ` Laurent Pinchart
2024-12-02 10:11 ` Ricardo Ribalda
2024-12-02 8:05 ` Hans Verkuil
2024-12-02 8:11 ` Laurent Pinchart
2024-12-02 8:44 ` Hans Verkuil
2024-12-02 10:26 ` Hans de Goede
2024-12-02 10:50 ` Ricardo Ribalda
2024-12-02 12:19 ` Hans de Goede
2024-12-02 13:29 ` Ricardo Ribalda
2024-12-03 19:32 ` Laurent Pinchart
2024-12-04 13:46 ` Hans de Goede
2024-12-02 10:55 ` Hans Verkuil
2024-12-03 17:18 ` Laurent Pinchart
2024-12-04 7:59 ` Hans Verkuil
2024-12-04 8:04 ` Hans Verkuil
2024-12-04 9:13 ` Laurent Pinchart
2024-12-04 9:02 ` Laurent Pinchart
2024-11-29 13:10 ` Hans Verkuil
2024-11-29 13:32 ` Hans Verkuil
2024-11-29 13:37 ` Ricardo Ribalda
2024-11-29 21:47 ` Laurent Pinchart
2024-11-29 11:01 ` Laurent Pinchart
2024-11-27 12:14 ` [PATCH v2 3/4] media: uvcvideo: Annotate lock requirements for uvc_ctrl_set Ricardo Ribalda
2024-11-28 21:51 ` Laurent Pinchart
2024-11-27 12:14 ` [PATCH v2 4/4] media: uvcvideo: Remove redundant NULL assignment Ricardo Ribalda
2024-11-28 21:26 ` Laurent Pinchart
2024-11-28 21:34 ` Ricardo Ribalda
2024-11-28 21:47 ` Laurent Pinchart [this message]
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=20241128214727.GE25839@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=guennadi.liakhovetski@intel.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab+samsung@kernel.org \
--cc=mchehab@kernel.org \
--cc=ribalda@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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox