summaryrefslogtreecommitdiff
path: root/drivers/media/usb/hdpvr
diff options
context:
space:
mode:
authorNiels Dossche <dossche.niels@gmail.com>2022-06-14 20:50:02 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-08-17 15:40:53 +0300
commiteb2d5531c17c3c1b993aef48b141cc13b929fd73 (patch)
treebe923952cdaff9521342f13ffc243774fc68a3dd /drivers/media/usb/hdpvr
parent7214902de5b1fb2b632a7b8b3b9540e41aabab38 (diff)
downloadlinux-eb2d5531c17c3c1b993aef48b141cc13b929fd73.tar.xz
media: hdpvr: fix error value returns in hdpvr_read
[ Upstream commit 359c27c6ddbde404f44a9c0d3ec88ccd1e2042f2 ] Error return values are supposed to be negative in hdpvr_read. Most error returns are currently handled via an unsigned integer "ret". When setting a negative error value to "ret", the value actually becomes a large positive value, because "ret" is unsigned. Later on, the "ret" value is returned. But as ssize_t is a 64-bit signed number, the error return value stays a large positive integer instead of a negative integer. This can cause an error value to be interpreted as the read size, which can cause a buffer overread for applications relying on the returned size. Fixes: 9aba42efe85b ("V4L/DVB (11096): V4L2 Driver for the Hauppauge HD PVR usb capture device") Signed-off-by: Niels Dossche <dossche.niels@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/media/usb/hdpvr')
-rw-r--r--drivers/media/usb/hdpvr/hdpvr-video.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c
index 60e57e0f1927..fd7d2a9d0449 100644
--- a/drivers/media/usb/hdpvr/hdpvr-video.c
+++ b/drivers/media/usb/hdpvr/hdpvr-video.c
@@ -409,7 +409,7 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count,
struct hdpvr_device *dev = video_drvdata(file);
struct hdpvr_buffer *buf = NULL;
struct urb *urb;
- unsigned int ret = 0;
+ int ret = 0;
int rem, cnt;
if (*pos)