From: "Jan Beulich" Subject: [PATCH] qemu: fix use after free Date: Fri, 14 Jan 2011 10:58:32 +0000 Message-ID: <4D303A68020000780002C685@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part715D0148.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" Cc: Chun Yan Liu List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part715D0148.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Commit 99d53fbb69d3e03be61ae10506a304a3d08d792f introduced this, and the compiler indirectly warned about it. The patch is only compile tested (I don't even know how to reproduce the original problem), but I suppose worth applying regardless. Signed-off-by: Jan Beulich Cc: Chun Yan Liu --- a/keymaps.c +++ b/keymaps.c @@ -56,15 +56,12 @@ typedef struct { =20 static void del_key_range(struct key_range **krp, int code) { struct key_range *kr; - struct key_range *kr_pr; - for (kr =3D *krp; kr; kr_pr =3D kr, kr =3D kr->next) { + while ((kr =3D *krp) !=3D NULL) { if (code >=3D kr->start && code <=3D kr->end) { - if (kr =3D=3D *krp) - *krp =3D kr->next; - else - kr_pr->next =3D kr->next; + *krp =3D kr->next; qemu_free(kr); - } + } else + krp =3D &kr->next; } } =20 --=__Part715D0148.0__= Content-Type: text/plain; name="qemu-fix-7433.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="qemu-fix-7433.patch" Commit 99d53fbb69d3e03be61ae10506a304a3d08d792f introduced this, and=0Athe = compiler indirectly warned about it.=0A=0AThe patch is only compile tested = (I don't even know how to reproduce=0Athe original problem), but I suppose = worth applying regardless.=0A=0ASigned-off-by: Jan Beulich =0ACc: Chun Yan Liu =0A=0A--- a/keymaps.c=0A+++ = b/keymaps.c=0A@@ -56,15 +56,12 @@ typedef struct {=0A =0A static void = del_key_range(struct key_range **krp, int code) {=0A struct key_range = *kr;=0A- struct key_range *kr_pr;=0A- for (kr =3D *krp; kr; kr_pr = =3D kr, kr =3D kr->next) {=0A+ while ((kr =3D *krp) !=3D NULL) {=0A = if (code >=3D kr->start && code <=3D kr->end) {=0A- if (kr = =3D=3D *krp)=0A- *krp =3D kr->next;=0A- else=0A- = kr_pr->next =3D kr->next;=0A+ *krp =3D = kr->next;=0A qemu_free(kr);=0A- }=0A+ } else=0A+ = krp =3D &kr->next;=0A }=0A }=0A =0A --=__Part715D0148.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part715D0148.0__=--