qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Out off array access in usb-net
@ 2010-11-09  7:36 Gleb Natapov
  2010-11-09  9:29 ` [Qemu-devel] " Paolo Bonzini
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Gleb Natapov @ 2010-11-09  7:36 UTC (permalink / raw)
  To: qemu-devel

Properly check array bounds before accessing array element.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/hw/usb-net.c b/hw/usb-net.c
index 70f9263..84e2d79 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1142,7 +1142,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value,
                 break;
 
             default:
-                if (usb_net_stringtable[value & 0xff]) {
+                if (ARRAY_SIZE(usb_net_stringtable) > (value & 0xff)) {
                     ret = set_usb_string(data,
                                     usb_net_stringtable[value & 0xff]);
                     break;
--
			Gleb.

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] Re: [PATCH] Out off array access in usb-net
  2010-11-09  7:36 [Qemu-devel] [PATCH] Out off array access in usb-net Gleb Natapov
@ 2010-11-09  9:29 ` Paolo Bonzini
  2010-11-09  9:30 ` [Qemu-devel] " Markus Armbruster
  2010-11-16 22:24 ` Anthony Liguori
  2 siblings, 0 replies; 10+ messages in thread
From: Paolo Bonzini @ 2010-11-09  9:29 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: qemu-devel

On 11/09/2010 08:36 AM, Gleb Natapov wrote:
> Properly check array bounds before accessing array element.
>
> Signed-off-by: Gleb Natapov<gleb@redhat.com>
> diff --git a/hw/usb-net.c b/hw/usb-net.c
> index 70f9263..84e2d79 100644
> --- a/hw/usb-net.c
> +++ b/hw/usb-net.c
> @@ -1142,7 +1142,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value,
>                   break;
>
>               default:
> -                if (usb_net_stringtable[value&  0xff]) {
> +                if (ARRAY_SIZE(usb_net_stringtable)>  (value&  0xff)) {
>                       ret = set_usb_string(data,
>                                       usb_net_stringtable[value&  0xff]);
>                       break;
> --
> 			Gleb.
>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] Out off array access in usb-net
  2010-11-09  7:36 [Qemu-devel] [PATCH] Out off array access in usb-net Gleb Natapov
  2010-11-09  9:29 ` [Qemu-devel] " Paolo Bonzini
@ 2010-11-09  9:30 ` Markus Armbruster
  2010-11-09  9:39   ` Gleb Natapov
  2010-11-16 22:24 ` Anthony Liguori
  2 siblings, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2010-11-09  9:30 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: qemu-devel

Gleb Natapov <gleb@redhat.com> writes:

> Properly check array bounds before accessing array element.

Impact?

Apply to stable as well?

> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> diff --git a/hw/usb-net.c b/hw/usb-net.c
> index 70f9263..84e2d79 100644
> --- a/hw/usb-net.c
> +++ b/hw/usb-net.c
> @@ -1142,7 +1142,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value,
>                  break;
>  
>              default:
> -                if (usb_net_stringtable[value & 0xff]) {
> +                if (ARRAY_SIZE(usb_net_stringtable) > (value & 0xff)) {
>                      ret = set_usb_string(data,
>                                      usb_net_stringtable[value & 0xff]);
>                      break;

Makes sense.

Nitpick: LIMIT > INDEX looks unusual to me; INDEX < LIMIT is more
common.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] Out off array access in usb-net
  2010-11-09  9:30 ` [Qemu-devel] " Markus Armbruster
@ 2010-11-09  9:39   ` Gleb Natapov
  2010-11-09 10:16     ` Markus Armbruster
  0 siblings, 1 reply; 10+ messages in thread
From: Gleb Natapov @ 2010-11-09  9:39 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

On Tue, Nov 09, 2010 at 10:30:54AM +0100, Markus Armbruster wrote:
> Gleb Natapov <gleb@redhat.com> writes:
> 
> > Properly check array bounds before accessing array element.
> 
> Impact?
> 
Gapping security hole for those unfortunate enough to use usb-net?

> Apply to stable as well?
> 
Definitely. Actually for me Windows7 crashed when usb-net is present.

> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> > diff --git a/hw/usb-net.c b/hw/usb-net.c
> > index 70f9263..84e2d79 100644
> > --- a/hw/usb-net.c
> > +++ b/hw/usb-net.c
> > @@ -1142,7 +1142,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value,
> >                  break;
> >  
> >              default:
> > -                if (usb_net_stringtable[value & 0xff]) {
> > +                if (ARRAY_SIZE(usb_net_stringtable) > (value & 0xff)) {
> >                      ret = set_usb_string(data,
> >                                      usb_net_stringtable[value & 0xff]);
> >                      break;
> 
> Makes sense.
> 
> Nitpick: LIMIT > INDEX looks unusual to me; INDEX < LIMIT is more
> common.

--
			Gleb.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] Out off array access in usb-net
  2010-11-09  9:39   ` Gleb Natapov
@ 2010-11-09 10:16     ` Markus Armbruster
  2010-11-09 10:34       ` Gleb Natapov
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2010-11-09 10:16 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: qemu-devel

Gleb Natapov <gleb@redhat.com> writes:

> On Tue, Nov 09, 2010 at 10:30:54AM +0100, Markus Armbruster wrote:
>> Gleb Natapov <gleb@redhat.com> writes:
>> 
>> > Properly check array bounds before accessing array element.
>> 
>> Impact?
>> 
> Gapping security hole for those unfortunate enough to use usb-net?

Doesn't that bit of information belong in the commit message.

>> Apply to stable as well?
>> 
> Definitely. Actually for me Windows7 crashed when usb-net is present.

And that as well.

Good catch!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] Out off array access in usb-net
  2010-11-09 10:16     ` Markus Armbruster
@ 2010-11-09 10:34       ` Gleb Natapov
  2010-11-09 10:51         ` Markus Armbruster
  0 siblings, 1 reply; 10+ messages in thread
From: Gleb Natapov @ 2010-11-09 10:34 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

On Tue, Nov 09, 2010 at 11:16:43AM +0100, Markus Armbruster wrote:
> Gleb Natapov <gleb@redhat.com> writes:
> 
> > On Tue, Nov 09, 2010 at 10:30:54AM +0100, Markus Armbruster wrote:
> >> Gleb Natapov <gleb@redhat.com> writes:
> >> 
> >> > Properly check array bounds before accessing array element.
> >> 
> >> Impact?
> >> 
> > Gapping security hole for those unfortunate enough to use usb-net?
> 
> Doesn't that bit of information belong in the commit message.
> 
Some people prefer not to put such information into commit message.

> >> Apply to stable as well?
> >> 
> > Definitely. Actually for me Windows7 crashed when usb-net is present.
> 
> And that as well.
> 
> Good catch!

--
			Gleb.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] Out off array access in usb-net
  2010-11-09 10:34       ` Gleb Natapov
@ 2010-11-09 10:51         ` Markus Armbruster
  2010-11-16 20:08           ` Anthony Liguori
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2010-11-09 10:51 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: qemu-devel

Gleb Natapov <gleb@redhat.com> writes:

> On Tue, Nov 09, 2010 at 11:16:43AM +0100, Markus Armbruster wrote:
>> Gleb Natapov <gleb@redhat.com> writes:
>> 
>> > On Tue, Nov 09, 2010 at 10:30:54AM +0100, Markus Armbruster wrote:
>> >> Gleb Natapov <gleb@redhat.com> writes:
>> >> 
>> >> > Properly check array bounds before accessing array element.
>> >> 
>> >> Impact?
>> >> 
>> > Gapping security hole for those unfortunate enough to use usb-net?
>> 
>> Doesn't that bit of information belong in the commit message.
>> 
> Some people prefer not to put such information into commit message.

Correct, but does "some people" include the QEMU maintainers?  Anthony?

[...]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] Out off array access in usb-net
  2010-11-09 10:51         ` Markus Armbruster
@ 2010-11-16 20:08           ` Anthony Liguori
  2010-11-16 20:14             ` Gleb Natapov
  0 siblings, 1 reply; 10+ messages in thread
From: Anthony Liguori @ 2010-11-16 20:08 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, Gleb Natapov

On 11/09/2010 04:51 AM, Markus Armbruster wrote:
> Gleb Natapov<gleb@redhat.com>  writes:
>
>    
>> On Tue, Nov 09, 2010 at 11:16:43AM +0100, Markus Armbruster wrote:
>>      
>>> Gleb Natapov<gleb@redhat.com>  writes:
>>>
>>>        
>>>> On Tue, Nov 09, 2010 at 10:30:54AM +0100, Markus Armbruster wrote:
>>>>          
>>>>> Gleb Natapov<gleb@redhat.com>  writes:
>>>>>
>>>>>            
>>>>>> Properly check array bounds before accessing array element.
>>>>>>              
>>>>> Impact?
>>>>>
>>>>>            
>>>> Gapping security hole for those unfortunate enough to use usb-net?
>>>>          
>>> Doesn't that bit of information belong in the commit message.
>>>
>>>        
>> Some people prefer not to put such information into commit message.
>>      
> Correct, but does "some people" include the QEMU maintainers?  Anthony?
>    

I don't have a strong opinion either way.  If there's a CVE, I'd prefer 
the CVE number was prominent in the commit log but other than that, I'd 
leave it to the author's discretion.

Regards,

Anthony Liguori

> [...]
>
>
>    

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] Out off array access in usb-net
  2010-11-16 20:08           ` Anthony Liguori
@ 2010-11-16 20:14             ` Gleb Natapov
  0 siblings, 0 replies; 10+ messages in thread
From: Gleb Natapov @ 2010-11-16 20:14 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Markus Armbruster, qemu-devel

On Tue, Nov 16, 2010 at 02:08:13PM -0600, Anthony Liguori wrote:
> On 11/09/2010 04:51 AM, Markus Armbruster wrote:
> >Gleb Natapov<gleb@redhat.com>  writes:
> >
> >>On Tue, Nov 09, 2010 at 11:16:43AM +0100, Markus Armbruster wrote:
> >>>Gleb Natapov<gleb@redhat.com>  writes:
> >>>
> >>>>On Tue, Nov 09, 2010 at 10:30:54AM +0100, Markus Armbruster wrote:
> >>>>>Gleb Natapov<gleb@redhat.com>  writes:
> >>>>>
> >>>>>>Properly check array bounds before accessing array element.
> >>>>>Impact?
> >>>>>
> >>>>Gapping security hole for those unfortunate enough to use usb-net?
> >>>Doesn't that bit of information belong in the commit message.
> >>>
> >>Some people prefer not to put such information into commit message.
> >Correct, but does "some people" include the QEMU maintainers?  Anthony?
> 
> I don't have a strong opinion either way.  If there's a CVE, I'd
> prefer the CVE number was prominent in the commit log but other than
> that, I'd leave it to the author's discretion.
> 
No CVE. Please apply as is.


--
			Gleb.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] Out off array access in usb-net
  2010-11-09  7:36 [Qemu-devel] [PATCH] Out off array access in usb-net Gleb Natapov
  2010-11-09  9:29 ` [Qemu-devel] " Paolo Bonzini
  2010-11-09  9:30 ` [Qemu-devel] " Markus Armbruster
@ 2010-11-16 22:24 ` Anthony Liguori
  2 siblings, 0 replies; 10+ messages in thread
From: Anthony Liguori @ 2010-11-16 22:24 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: qemu-devel

On 11/09/2010 01:36 AM, Gleb Natapov wrote:
> Properly check array bounds before accessing array element.
>
> Signed-off-by: Gleb Natapov<gleb@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori
> diff --git a/hw/usb-net.c b/hw/usb-net.c
> index 70f9263..84e2d79 100644
> --- a/hw/usb-net.c
> +++ b/hw/usb-net.c
> @@ -1142,7 +1142,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value,
>                   break;
>
>               default:
> -                if (usb_net_stringtable[value&  0xff]) {
> +                if (ARRAY_SIZE(usb_net_stringtable)>  (value&  0xff)) {
>                       ret = set_usb_string(data,
>                                       usb_net_stringtable[value&  0xff]);
>                       break;
> --
> 			Gleb.
>
>
>    

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-11-16 22:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-09  7:36 [Qemu-devel] [PATCH] Out off array access in usb-net Gleb Natapov
2010-11-09  9:29 ` [Qemu-devel] " Paolo Bonzini
2010-11-09  9:30 ` [Qemu-devel] " Markus Armbruster
2010-11-09  9:39   ` Gleb Natapov
2010-11-09 10:16     ` Markus Armbruster
2010-11-09 10:34       ` Gleb Natapov
2010-11-09 10:51         ` Markus Armbruster
2010-11-16 20:08           ` Anthony Liguori
2010-11-16 20:14             ` Gleb Natapov
2010-11-16 22:24 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).