Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 885644

Summary: Memory leak and use after free in qxl_render_update_area_unlocked()
Product: Red Hat Enterprise Linux 6 Reporter: Markus Armbruster <armbru>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4CC: acathrow, areis, bsarathy, dyasny, juzhang, michen, mkenneth, mrezanin, tlavigne, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.351.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:45:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Markus Armbruster 2012-12-10 10:04:25 UTC
Description of problem:
Coverity points out

120  	        if (qxl->guest_primary.qxl_stride > 0) {
121  	            qemu_free_displaysurface(vga->ds);

(4) Event alloc_fn: 	Storage is returned from allocation function "qemu_create_displaysurface_from(int, int, int, int, uint8_t *)". [details]
(5) Event leaked_storage: 	Ignoring storage allocated by "qemu_create_displaysurface_from(qxl->guest_primary.surface.width, qxl->guest_primary.surface.height, qxl->guest_primary.bits_pp, qxl->guest_primary.abs_stride, qxl->guest_primary.data)" leaks it.

122  	            qemu_create_displaysurface_from(qxl->guest_primary.surface.width,
123  	                                            qxl->guest_primary.surface.height,
124  	                                            qxl->guest_primary.bits_pp,
125  	                                            qxl->guest_primary.abs_stride,
126  	                                            qxl->guest_primary.data);
127  	        } else {
128  	            qemu_resize_displaysurface(vga->ds,
129  	                    qxl->guest_primary.surface.width,
130  	                    qxl->guest_primary.surface.height);
131  	        }
132  	        dpy_resize(vga->ds);

Not only does this leak the memory allocated by qemu_create_displaysurface_from() in line 122, it also keeps vga->ds pointing to the memory freed by qemu_free_displaysurface() in line 121, then passes it to dpy_resize() in line 132.

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.340.el6

How reproducible:
Not tried; bug found by static analysis

Steps to Reproduce:
Non known

Actual results:
Memory leak, and use-after-free with unknown impact.

Expected results:
No leak, no use after free.

Comment 2 RHEL Program Management 2012-12-14 08:21:11 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 3 Markus Armbruster 2012-12-20 10:21:12 UTC
Fixed upstream in commit 2f464b5a.

Comment 14 errata-xmlrpc 2013-02-21 07:45:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0527.html