Patch "media: av7110: prevent underflow in write_ts_to_decoder()" has been added to the 6.2-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    media: av7110: prevent underflow in write_ts_to_decoder()

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     media-av7110-prevent-underflow-in-write_ts_to_decode.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 300fcaace963460816ecdad380dd0d526d8b246e
Author: Dan Carpenter <error27@xxxxxxxxx>
Date:   Tue Mar 7 11:00:23 2023 +0100

    media: av7110: prevent underflow in write_ts_to_decoder()
    
    [ Upstream commit eed9496a0501357aa326ddd6b71408189ed872eb ]
    
    The buf[4] value comes from the user via ts_play().  It is a value in
    the u8 range.  The final length we pass to av7110_ipack_instant_repack()
    is "len - (buf[4] + 1) - 4" so add a check to ensure that the length is
    not negative.  It's not clear that passing a negative len value does
    anything bad necessarily, but it's not best practice.
    
    With the new bounds checking the "if (!len)" condition is no longer
    possible or required so remove that.
    
    Fixes: fd46d16d602a ("V4L/DVB (11759): dvb-ttpci: Add TS replay capability")
    Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/staging/media/deprecated/saa7146/av7110/av7110_av.c b/drivers/staging/media/deprecated/saa7146/av7110/av7110_av.c
index 0bf513c26b6b5..a5c5bebad3061 100644
--- a/drivers/staging/media/deprecated/saa7146/av7110/av7110_av.c
+++ b/drivers/staging/media/deprecated/saa7146/av7110/av7110_av.c
@@ -823,10 +823,10 @@ static int write_ts_to_decoder(struct av7110 *av7110, int type, const u8 *buf, s
 		av7110_ipack_flush(ipack);
 
 	if (buf[3] & ADAPT_FIELD) {
+		if (buf[4] > len - 1 - 4)
+			return 0;
 		len -= buf[4] + 1;
 		buf += buf[4] + 1;
-		if (!len)
-			return 0;
 	}
 
 	av7110_ipack_instant_repack(buf + 4, len - 4, ipack);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux