From patchwork Tue Jan 26 08:59:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: wzt wzt X-Patchwork-Id: 75159 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0Q905WM023278 for ; Tue, 26 Jan 2010 09:00:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751772Ab0AZI7n (ORCPT ); Tue, 26 Jan 2010 03:59:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751441Ab0AZI7n (ORCPT ); Tue, 26 Jan 2010 03:59:43 -0500 Received: from mail-yx0-f187.google.com ([209.85.210.187]:52245 "EHLO mail-yx0-f187.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751772Ab0AZI7j convert rfc822-to-8bit (ORCPT ); Tue, 26 Jan 2010 03:59:39 -0500 Received: by yxe17 with SMTP id 17so3487591yxe.33 for ; Tue, 26 Jan 2010 00:59:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=OI5ifg1OK/InmKsiqJK3mM5MupHLwm3mb6/l1kgjr2E=; b=KAFx85MpJRLo9CM83/+od6SNZJmjk6IsA04XpChSsfFoRFsTsnbShCO7dUI2uAESTh ADDglVepGq/6oWr4hgTlDldowAwi0ul1yYtRhnmeeDStYIqilppz8ko7TKymRzaOKCDK BcNuFhdgPSZdyVx/RSXnwwQjDa6dh2WSDFfxE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=qKjdRBNgEAxRs+oVYgvTAnScLvUDPVSTEcgc9t9/igHugbwZB7DT7YV9G44HhCDw+b 8NyilYhqc+BQJwevNriHOpbgWLa02Xy2UfbznCHiDiX6Hb9XD6iql9tJIH/E3iF0wfQK r5Y/vU2yKFCsceRXeG4J5HiJvWPWPRJ1cRyVo= MIME-Version: 1.0 Received: by 10.101.133.38 with SMTP id k38mr800465ann.219.1264496378832; Tue, 26 Jan 2010 00:59:38 -0800 (PST) Date: Tue, 26 Jan 2010 16:59:38 +0800 Message-ID: <628d1651001260059p65dab6d0y86084b181f5273fc@mail.gmail.com> Subject: 2.6.32-KVM-pit_ioport_read() integer buffer overflow hole From: wzt wzt To: kvm@vger.kernel.org Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 296aba4..bf8637f 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -463,6 +463,8 @@ static int pit_ioport_read(struct kvm_io_device *this,        struct kvm *kvm = pit->kvm;        int ret, count;        struct kvm_kpit_channel_state *s; +       if (len < 0) +               return -EOPNOTSUPP;        if (!pit_in_range(addr))                return -EOPNOTSUPP; @@ -516,6 +518,7 @@ static int pit_ioport_read(struct kvm_io_device *this,        if (len > sizeof(ret))                len = sizeof(ret); +        memcpy(data, (char *)&ret, len);        mutex_unlock(&pit_state->lock); @@ -547,6 +550,9 @@ static int speaker_ioport_read(struct kvm_io_device *this,        struct kvm *kvm = pit->kvm;        unsigned int refresh_clock;        int ret; + +       if (len < 0) +               return -EOPNOTSUPP;        if (addr != KVM_SPEAKER_BASE_ADDRESS)                return -EOPNOTSUPP; -- To unsubscribe from this list: send the line "unsubscribe kvm" in