diff mbox

[for-1.4] net: Avoid NULL function pointer dereference on cleanup

Message ID 1360707366-9271-1-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Feb. 12, 2013, 10:16 p.m. UTC
The pSeries machine and some other devices don't supply a cleanup
callback. Revert part of 1ceef9f27359cbe92ef124bf74de6f792e71f6fb that
started calling it unconditionally.

Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 net/net.c |    4 +++-
 1 Datei geändert, 3 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

Comments

David Gibson Feb. 12, 2013, 11:13 p.m. UTC | #1
On Tue, Feb 12, 2013 at 11:16:06PM +0100, Andreas Färber wrote:
> The pSeries machine and some other devices don't supply a cleanup
> callback. Revert part of 1ceef9f27359cbe92ef124bf74de6f792e71f6fb that
> started calling it unconditionally.

Note that Alex Graf has now accepted a patch from me which adds a
cleanup callback to pseries.  I expect this is still a good idea for
the other cases, though.
Alexander Graf Feb. 13, 2013, 5:44 a.m. UTC | #2
Am 13.02.2013 um 00:13 schrieb David Gibson <dwg@au1.ibm.com>:

> On Tue, Feb 12, 2013 at 11:16:06PM +0100, Andreas Färber wrote:
>> The pSeries machine and some other devices don't supply a cleanup
>> callback. Revert part of 1ceef9f27359cbe92ef124bf74de6f792e71f6fb that
>> started calling it unconditionally.
> 
> Note that Alex Graf has now accepted a patch from me which adds a
> cleanup callback to pseries.  I expect this is still a good idea for
> the other cases, though.

But only for 1.5. 1.4 should simply get this one applied.

Alex

> 
> -- 
> David Gibson            | I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au    | minimalist, thank you.  NOT _the_ _other_
>                | _way_ _around_!
> http://www.ozlabs.org/~dgibson
Stefan Hajnoczi Feb. 13, 2013, 8:38 a.m. UTC | #3
On Tue, Feb 12, 2013 at 11:16:06PM +0100, Andreas Färber wrote:
> The pSeries machine and some other devices don't supply a cleanup
> callback. Revert part of 1ceef9f27359cbe92ef124bf74de6f792e71f6fb that
> started calling it unconditionally.
> 
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  net/net.c |    4 +++-
>  1 Datei geändert, 3 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Anthony Liguori Feb. 18, 2013, 4:02 p.m. UTC | #4
Applied.  Thanks.

Regards,

Anthony Liguori
diff mbox

Patch

diff --git a/net/net.c b/net/net.c
index f9e7136..be03a8d 100644
--- a/net/net.c
+++ b/net/net.c
@@ -287,7 +287,9 @@  static void qemu_cleanup_net_client(NetClientState *nc)
 {
     QTAILQ_REMOVE(&net_clients, nc, next);
 
-    nc->info->cleanup(nc);
+    if (nc->info->cleanup) {
+        nc->info->cleanup(nc);
+    }
 }
 
 static void qemu_free_net_client(NetClientState *nc)