xenbus_xs.c: fix a use-after-free
authorAdrian Bunk <[email protected]>
Thu, 26 Jul 2007 17:41:10 +0000 (10:41 -0700)
committerLinus Torvalds <[email protected]>
Thu, 26 Jul 2007 18:35:17 +0000 (11:35 -0700)
This patch fixes an obvious use-after-free spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <[email protected]>
Acked-by: Jeremy Fitzhardinge <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/xen/xenbus/xenbus_xs.c

index 9e943fbce81b7a58a38c06fcde362bae7999d1de..227d53b12a5cc05490687f6e9f3c9e5725b147f2 100644 (file)
@@ -782,8 +782,8 @@ static int process_msg(void)
                msg->u.watch.vec = split(body, msg->hdr.len,
                                         &msg->u.watch.vec_size);
                if (IS_ERR(msg->u.watch.vec)) {
-                       kfree(msg);
                        err = PTR_ERR(msg->u.watch.vec);
+                       kfree(msg);
                        goto out;
                }