aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/hvc
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-05-15 04:47:47 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-15 11:48:45 -0400
commitbdb595b4a906b8124d0dc5ff852f84302e2e7955 (patch)
treea4fc2dd1b5b52690b030845a05525cec0d267cc5 /drivers/tty/hvc
parent05f843b5d3406c29c8af7d1eb39ea9143b21d6dc (diff)
tty: hvc_xen: NULL dereference on allocation failure
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. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/hvc')
-rw-r--r--drivers/tty/hvc/hvc_xen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index 83d5c88e7165..d3d91dae065c 100644
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -430,9 +430,9 @@ static int __devinit xencons_probe(struct xenbus_device *dev,
430 if (devid == 0) 430 if (devid == 0)
431 return -ENODEV; 431 return -ENODEV;
432 432
433 info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL | __GFP_ZERO); 433 info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL);
434 if (!info) 434 if (!info)
435 goto error_nomem; 435 return -ENOMEM;
436 dev_set_drvdata(&dev->dev, info); 436 dev_set_drvdata(&dev->dev, info);
437 info->xbdev = dev; 437 info->xbdev = dev;
438 info->vtermno = xenbus_devid_to_vtermno(devid); 438 info->vtermno = xenbus_devid_to_vtermno(devid);