USB: resizing usbmon binary interface buffer causes protection faults
authorSteven Robertson <steven@strobe.cc>
Wed, 21 Jul 2010 20:38:44 +0000 (16:38 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Aug 2010 21:35:41 +0000 (14:35 -0700)
Enlarging the buffer size via the MON_IOCT_RING_SIZE ioctl causes
general protection faults. It appears the culprit is an incorrect
argument to mon_free_buff: instead of passing the size of the current
buffer being freed, the size of the new buffer is passed.

Use the correct size argument to mon_free_buff when changing the size of
the buffer.

Signed-off-by: Steven Robertson <steven@strobe.cc>
Acked-by: Pete Zaitcev <zaitcev@redhat.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/mon/mon_bin.c

index 1be0b9f933662b59ba32e4b1e96e57df9e110017..44cb37b5a4dc1f9b27075e3db5346b9ebe307b22 100644 (file)
@@ -1004,7 +1004,7 @@ static long mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg
 
                mutex_lock(&rp->fetch_lock);
                spin_lock_irqsave(&rp->b_lock, flags);
-               mon_free_buff(rp->b_vec, size/CHUNK_SIZE);
+               mon_free_buff(rp->b_vec, rp->b_size/CHUNK_SIZE);
                kfree(rp->b_vec);
                rp->b_vec  = vec;
                rp->b_size = size;