]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
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>
Fri, 13 Aug 2010 20:27:25 +0000 (13:27 -0700)
commit 33d973ad88ceb83ed1449592b7574b5b5bb33ac6 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/mon/mon_bin.c

index 8a7968df278f95bb769853dc02b08a38d016205e..6ee9d76d38333d8c6692d608d9b2781b546b979d 100644 (file)
@@ -1010,7 +1010,7 @@ static int mon_bin_ioctl(struct inode *inode, struct file *file,
 
                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;