]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
hvc_xen: NULL dereference on allocation failure
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 15 May 2012 08:47:47 +0000 (11:47 +0300)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 21 May 2012 15:03:29 +0000 (11:03 -0400)
If kzalloc() returns a NULL here, we pass a NULL to
xencons_disconnect_backend() which will cause an Oops.

Also I removed the __GFP_ZERO while I was at it since kzalloc() implies
__GFP_ZERO.

CC: stable@kernel.org
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/tty/hvc/hvc_xen.c

index 83d5c88e7165d5a95cc743812a6075fa7a0ff621..d3d91dae065cfdceb3c6b4918c27ad6c252caf33 100644 (file)
@@ -430,9 +430,9 @@ static int __devinit xencons_probe(struct xenbus_device *dev,
        if (devid == 0)
                return -ENODEV;
 
-       info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL | __GFP_ZERO);
+       info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL);
        if (!info)
-               goto error_nomem;
+               return -ENOMEM;
        dev_set_drvdata(&dev->dev, info);
        info->xbdev = dev;
        info->vtermno = xenbus_devid_to_vtermno(devid);