Skip to contentSkip to conversation

Fix VIDIOCGAP corruption in ivtv

PATCH In review Alan Cox 6 participants 11 messages Apr 20, 2008 – Apr 24, 2008 Media (V4L/DVB)

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 Fix VIDIOCGAP corruption in ivtv

Frank Bennett reported that ivtv was causing skype to crash. With help from one of their developers he showed it was a kernel problem. VIDIOCGCAP copies a name into a fixed length buffer - ivtv uses names that are too long and does not truncate them so corrupts a few bytes of the app data area.

Possibly the names also want trimming but for now this should fix the corruption case.

drivers/media/video/ivtv/ivtv-ioctl.c +2 -1
@@ -742,7 +742,8 @@
 
 		memset(vcap, 0, sizeof(*vcap));
 		strcpy(vcap->driver, IVTV_DRIVER_NAME);     /* driver name */
-		strcpy(vcap->card, itv->card_name); 	    /* card type */
+		strncpy(vcap->card, itv->card_name,
+				sizeof(vcap->card)-1); 	    /* card type */
 		strcpy(vcap->bus_info, pci_name(itv->dev)); /* bus info... */
 		vcap->version = IVTV_DRIVER_VERSION; 	    /* version */
 		vcap->capabilities = itv->v4l2_cap; 	    /* capabilities */

--
"Hello, welcome to Jon Masters' house of pain"
- Jon after a particularly good night

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#1 lore raw
Quoted 8 lines · On Sunday 20 April 2008 13:27:36 Alan Cox wrote:

Frank Bennett reported that ivtv was causing skype to crash. With help from one of their developers he showed it was a kernel problem. VIDIOCGCAP copies a name into a fixed length buffer - ivtv uses names that are too long and does not truncate them so corrupts a few bytes of the app data area.

Possibly the names also want trimming but for now this should fix the corruption case.

Ouch, nasty one.

Mauro, can you apply this patch to the v4l-dvb master?

Mike, this one should obviously go into a 2.6.25 dot-release, and I think also to a 2.6.24 dot-release.

Frank, thank you for reporting this!

Hans

Quoted 22 lines

---
linux.vanilla-2.6.25-rc8-mm2/drivers/media/video/ivtv/ivtv-ioctl.c 20
08-04-13 15:36:53.000000000 +0100 +++
linux-2.6.25-rc8-mm2/drivers/media/video/ivtv/ivtv-ioctl.c 2008-04-20
12:15:33.000000000 +0100 @@ -742,7 +742,8 @@

drivers/media/video/ivtv/ivtv-ioctl.c +2 -2
 		memset(vcap, 0, sizeof(*vcap));
 		strcpy(vcap->driver, IVTV_DRIVER_NAME);     /* driver name */
-		strcpy(vcap->card, itv->card_name); 	    /* card type */
+		strncpy(vcap->card, itv->card_name,
+				sizeof(vcap->card)-1); 	    /* card type */
 		strcpy(vcap->bus_info, pci_name(itv->dev)); /* bus info... */
 		vcap->version = IVTV_DRIVER_VERSION; 	    /* version */
 		vcap->capabilities = itv->v4l2_cap; 	    /* capabilities */
 
--

"Hello, welcome to Jon Masters' house of pain"
- Jon after a particularly good night

Quoted 5 lines

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#2 lore raw
Quoted 16 lines · Hans Verkuil
Quoted 9 lines · On Sunday 20 April 2008 13:27:36 Alan Cox wrote:

Frank Bennett reported that ivtv was causing skype to crash. With help from one of their developers he showed it was a kernel problem. VIDIOCGCAP copies a name into a fixed length buffer - ivtv uses names that are too long and does not truncate them so corrupts a few bytes of the app data area.

Possibly the names also want trimming but for now this should fix the corruption case.

Ouch, nasty one.

Mauro, can you apply this patch to the v4l-dvb master?

Quoted 9 lines

Mike, this one should obviously go into a 2.6.25 dot-release, and I think also to a 2.6.24 dot-release.

Frank, thank you for reporting this!

Hans

Mauro,

I'll get this into -stable for 2.6.24.y and 2.6.25.y as soon as it's in Linus' tree. Please send this with your first round of patches for 2.6.26

Regards,

Mike

Quoted 31 lines
Quoted 28 lines

---
linux.vanilla-2.6.25-rc8-mm2/drivers/media/video/ivtv/ivtv-ioctl.c 20
08-04-13 15:36:53.000000000 +0100 +++
linux-2.6.25-rc8-mm2/drivers/media/video/ivtv/ivtv-ioctl.c 2008-04-20
12:15:33.000000000 +0100 @@ -742,7 +742,8 @@

drivers/media/video/ivtv/ivtv-ioctl.c +2 -2
 		memset(vcap, 0, sizeof(*vcap));
 		strcpy(vcap->driver, IVTV_DRIVER_NAME);     /* driver name */
-		strcpy(vcap->card, itv->card_name); 	    /* card type */
+		strncpy(vcap->card, itv->card_name,
+				sizeof(vcap->card)-1); 	    /* card type */
 		strcpy(vcap->bus_info, pci_name(itv->dev)); /* bus info... */
 		vcap->version = IVTV_DRIVER_VERSION; 	    /* version */
 		vcap->capabilities = itv->v4l2_cap; 	    /* capabilities */
 
--

"Hello, welcome to Jon Masters' house of pain"
- Jon after a particularly good night

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#3 lore raw
Quoted 20 lines · On Sun, 20 Apr 2008 12:10:00 -0400 Michael Krufky <[email protected]> wrote:
Quoted 19 lines · Hans Verkuil
Quoted 9 lines · On Sunday 20 April 2008 13:27:36 Alan Cox wrote:

Frank Bennett reported that ivtv was causing skype to crash. With help from one of their developers he showed it was a kernel problem. VIDIOCGCAP copies a name into a fixed length buffer - ivtv uses names that are too long and does not truncate them so corrupts a few bytes of the app data area.

Possibly the names also want trimming but for now this should fix the corruption case.

Ouch, nasty one.

Mauro, can you apply this patch to the v4l-dvb master?

Mike, this one should obviously go into a 2.6.25 dot-release, and I think also to a 2.6.24 dot-release.

Quoted 8 lines
Quoted 6 lines

Frank, thank you for reporting this!

Hans

In this case, it should be reviewed-by.

I should be sending this soon to Linus.

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#4 lore raw
Quoted 33 lines · Mauro Carvalho Chehab
Quoted 29 lines · On Sun, 20 Apr 2008 12:10:00 -0400 Michael Krufky <[email protected]> wrote:
Quoted 27 lines · Hans Verkuil
Quoted 10 lines · On Sunday 20 April 2008 13:27:36 Alan Cox wrote:

Frank Bennett reported that ivtv was causing skype to crash. With help from one of their developers he showed it was a kernel problem. VIDIOCGCAP copies a name into a fixed length buffer - ivtv uses names that are too long and does not truncate them so corrupts a few bytes of the app data area.

Possibly the names also want trimming but for now this should fix the corruption case.

Ouch, nasty one.

Mauro, can you apply this patch to the v4l-dvb master?

Mike, this one should obviously go into a 2.6.25 dot-release, and I think also to a 2.6.24 dot-release.

Frank, thank you for reporting this!

Hans

Quoted 6 lines
Quoted 2 lines

In this case, it should be reviewed-by.

I should be sending this soon to Linus.

Mauro,

I think it's wrong that you alter signatures. You did this:

Reviewed-by <[email protected] <mailto:[email protected]>>

But I provided this:

I sign the patch, because I have handled it in my -stable queue.

You put my email address without my name!

A signature is sacred and nobody should fudge it.

Please fix it before you send to -git.

-Mike

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#7 lore raw
In reply to Mauro Carvalho Chehab

Maruo,

I don't want to make your life more complicated than necessary, but while we're on the topic of attribution ...

The real work in identifying this issue was done by Andrew Macks, the engineer at Skype. My role in the affair consisted of complaining, sending along a log file, recompiling the kernel, and writing an email message.

I relayed the initial response I received from Hans Verkuil to Andrew (via skype chat, I do not have an email address for him), to let him know that the problem was being addressed in the kernel, and he was glad to hear the news. But watching things unfold, I have been feeling slightly incomfortable that only my name might end up in the chain of correspondence, and not his. I would just like to slip in a note here to that effect.

Frank Bennett

Quoted 39 lines · Mauro Carvalho Chehab
Quoted 20 lines · On Sun, 20 Apr 2008 12:10:00 -0400 Michael Krufky <[email protected]> wrote:
Quoted 19 lines · Hans Verkuil
Quoted 9 lines · On Sunday 20 April 2008 13:27:36 Alan Cox wrote:

Frank Bennett reported that ivtv was causing skype to crash. With help from one of their developers he showed it was a kernel problem. VIDIOCGCAP copies a name into a fixed length buffer - ivtv uses names that are too long and does not truncate them so corrupts a few bytes of the app data area.

Possibly the names also want trimming but for now this should fix the corruption case.

Ouch, nasty one.

Mauro, can you apply this patch to the v4l-dvb master?

Mike, this one should obviously go into a 2.6.25 dot-release, and I think also to a 2.6.24 dot-release.

Quoted 8 lines
Quoted 6 lines

Frank, thank you for reporting this!

Hans

In this case, it should be reviewed-by.

I should be sending this soon to Linus.

Cheers,
Mauro

#5 lore raw
In reply to [email protected]
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

In this case, it should be reviewed-by.

Quoted 8 lines
Quoted 1 line

I should be sending this soon to Linus.

Mauro,

I think it's wrong that you alter signatures. You did this:

Reviewed-by <[email protected] <mailto:[email protected]>>

Argh! I didn't notice that weird stuff. This should be fixed before forwarding the patch. Sorry for the mess.

Quoted 5 lines

But I provided this:

I sign the patch, because I have handled it in my -stable queue.

SOB is the proper tag for your -stable queue. However, asking me to add this to my tree is not what it is expected.

SOB is meant to track the patch history until it reaches the kernel. So, the first SOB(s) is(are) from its author(s). The author(s) will send this to a driver maintainer, that will send to a subsystem maintainer, etc, until reach mainstream.

In the case of this patch, it was sent to the ML. Hans picked it, as the maintainer of ivtv, and asked me to pull.

You didn't wrote the patch, not forwarded it to me, so, the tag doesn't apply on my tree.

After the merge at mainstream, you'll send this to stable. In this case, you'll take it from my tree, add your SOB, and forward it.

Unfortunately, it is a common mistake of people sending SOB's instead of acked-by or reviewed-by, so several maintainers warns about the improper usage of the tags and corrects it on their trees, or simply ignores such improper usage.

If you prefer, I may just drop the tag from my tree, or fix the "reviewed-by".

Cheers,
Mauro.

#6 lore raw
Quoted 18 lines · Mauro Carvalho Chehab
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

In this case, it should be reviewed-by.

Quoted 8 lines
Quoted 1 line

I should be sending this soon to Linus.

Mauro,

I think it's wrong that you alter signatures. You did this:

Reviewed-by <[email protected] <mailto:[email protected]>>

Argh! I didn't notice that weird stuff. This should be fixed before forwarding the patch. Sorry for the mess.

[snip]

Quoted 7 lines

After the merge at mainstream, you'll send this to stable. In this case, you'll take it from my tree, add your SOB, and forward it.

Unfortunately, it is a common mistake of people sending SOB's instead of acked-by or reviewed-by, so several maintainers warns about the improper usage of the tags and corrects it on their trees, or simply ignores such improper usage.

Good point.

Quoted 3 lines

If you prefer, I may just drop the tag from my tree, or fix the "reviewed-by".

Perhaps it makes most sense to just drop my tag, in this case -- that's fine with me.

Regards,

Mike

#8 lore raw
In reply to Frank Bennett

Hi Frank/Alan,

Quoted 10 lines · On Thu, 24 Apr 2008 04:26:46 +0900 "Frank Bennett" <[email protected]>…

Maruo,

I don't want to make your life more complicated than necessary, but while we're on the topic of attribution ...

The real work in identifying this issue was done by Andrew Macks, the engineer at Skype. My role in the affair consisted of complaining, sending along a log file, recompiling the kernel, and writing an email message.

Quoted 7 lines

I relayed the initial response I received from Hans Verkuil to Andrew (via skype chat, I do not have an email address for him), to let him know that the problem was being addressed in the kernel, and he was glad to hear the news. But watching things unfold, I have been feeling slightly incomfortable that only my name might end up in the chain of correspondence, and not his. I would just like to slip in a note here to that effect.

Maybe we can just add his name in parenthesis. Would this patch description be ok for you, Andrew and Alan?

Fix VIDIOCGAP corruption in ivtv

From: Alan Cox <[email protected]>

Frank Bennett reported that ivtv was causing skype to crash. With help from one of their developers (Andrew Macks) he showed it was a kernel problem. VIDIOCGCAP copies a name into a fixed length buffer - ivtv uses names that are too long and does not truncate them so corrupts a few bytes of the app data area.

Possibly the names also want trimming but for now this should fix the corruption case.

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#9 lore raw
Quoted 2 lines · Mauro Carvalho Chehab

Maybe we can just add his name in parenthesis. Would this patch description be ok for you, Andrew and Alan?

I have no idea if Mr Macks did the work or minds his name being used so I can form no view on the change. Obviously please remove my sign off if you make the change

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#10 lore raw
Quoted 7 lines · On Thu, 24 Apr 2008 12:00:43 -0400 Alan Cox <[email protected]> wrote:
Quoted 2 lines · Mauro Carvalho Chehab

Maybe we can just add his name in parenthesis. Would this patch description be ok for you, Andrew and Alan?

I have no idea if Mr Macks did the work or minds his name being used so I can form no view on the change. Obviously please remove my sign off if you make the change

So, I'll keep the patch as-is.

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list