[PATCH] media: uvcvideo: Fix loop exit condition in uvc_xu_ctrl_query()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The list_for_each_entry() loop exits when "entity" is a offset off the
list head.  In that situation the "entity" pointer doesn't point to a
valid uvc_entity struct, so it doesn't make sense to check "entity->id".
Since the "entity->id" is a u8 it's plausible that it could be equal to
"xqry->unit" by chance.

Fixes: c0efd232929c ("V4L/DVB (8145a): USB Video Class driver")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
 drivers/media/usb/uvc/uvc_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index e399b9fad757..47ab6c315db6 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1857,7 +1857,7 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain,
 			break;
 	}
 
-	if (entity->id != xqry->unit) {
+	if (&entity->chain == &chain->entities) {
 		uvc_trace(UVC_TRACE_CONTROL, "Extension unit %u not found.\n",
 			xqry->unit);
 		return -ENOENT;
-- 
2.27.0




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux