From nobody Mon Apr 29 18:11:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1500101183160616.2458492856084; Fri, 14 Jul 2017 23:46:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C3675D689; Sat, 15 Jul 2017 06:46:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C2B9377A04; Sat, 15 Jul 2017 06:46:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 39B431853E31; Sat, 15 Jul 2017 06:46:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6F6kDa3021092 for ; Sat, 15 Jul 2017 02:46:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1C3DF7F1BD; Sat, 15 Jul 2017 06:46:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 13B497F1BB for ; Sat, 15 Jul 2017 06:46:11 +0000 (UTC) Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.217.80.70]) by mx1.redhat.com (Postfix) with ESMTP id C617EC0587E3 for ; Sat, 15 Jul 2017 06:46:08 +0000 (UTC) Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 15 Jul 2017 06:36:20 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v6F6k2UB070723 for ; Sat, 15 Jul 2017 14:46:02 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017071514460919-4006290 ; Sat, 15 Jul 2017 14:46:09 +0800 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8C3675D689 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=zte.com.cn Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8C3675D689 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C617EC0587E3 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=zte.com.cn Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peng.hao2@zte.com.cn DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C617EC0587E3 X-scanvirus: By SEG_CYREN AntiVirus Engine X-scanresult: CLEAN X-MAILFROM: X-RCPTTO: X-FROMIP: 10.30.3.20 X-SEG-Scaned: 1 X-Received: unknown,10.30.3.20,20170715143620 From: Peng Hao To: libvir-list@redhat.com Date: Sat, 15 Jul 2017 23:00:12 +0800 Message-Id: <1500130812-21082-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-07-15 14:46:09, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-07-15 14:45:42, Serialize complete at 2017-07-15 14:45:42 X-MAIL: mse01.zte.com.cn v6F6k2UB070723 X-HQIP: 127.0.0.1 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 15 Jul 2017 06:46:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 15 Jul 2017 06:46:09 +0000 (UTC) for IP:'63.217.80.70' DOMAIN:'mxhk.zte.com.cn' HELO:'mxhk.zte.com.cn' FROM:'peng.hao2@zte.com.cn' RCPT:'' X-RedHat-Spam-Score: 0.445 (BAYES_50, DATE_IN_FUTURE_06_12, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, SPF_PASS) 63.217.80.70 mxhk.zte.com.cn 63.217.80.70 mxhk.zte.com.cn X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Liu Yun , peng.hao2@zte.com.cn Subject: [libvirt] [PATCH] rpc : fix a access for null pointer X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sat, 15 Jul 2017 06:46:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" virNetSocketRemoveIOCallback get sock's ObjectLock and will call virNetSocketEventFree. virNetSocketEventFree may be free sock object and virNetSocketRemoveIOCallback will access a null pointer in release sock's ObjectLock. Signed-off-by: Liu Yun Signed-off-by: Peng Hao --- src/rpc/virnetsocket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index d228c8a..8b550e8 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -2140,14 +2140,12 @@ static void virNetSocketEventFree(void *opaque) virFreeCallback ff; void *eopaque; =20 - virObjectLock(sock); ff =3D sock->ff; eopaque =3D sock->opaque; sock->func =3D NULL; sock->ff =3D NULL; sock->opaque =3D NULL; - virObjectUnlock(sock); - + =20 if (ff) ff(eopaque); =20 @@ -2207,6 +2205,7 @@ void virNetSocketUpdateIOCallback(virNetSocketPtr soc= k, =20 void virNetSocketRemoveIOCallback(virNetSocketPtr sock) { + virObjectRef(sock); virObjectLock(sock); =20 if (sock->watch < 0) { @@ -2220,6 +2219,7 @@ void virNetSocketRemoveIOCallback(virNetSocketPtr soc= k) sock->watch =3D -1; =20 virObjectUnlock(sock); + virObjectRef(sock); } =20 void virNetSocketClose(virNetSocketPtr sock) --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list