summaryrefslogtreecommitdiff
path: root/drivers/tty/hvc
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-05-15 12:47:47 +0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-05-21 19:03:29 +0400
commit201a52bea928687b7557728b176ac4f8a37d5cbd (patch)
treeff5f609f12d6cc69e5ffec1ca971bbcb36694776 /drivers/tty/hvc
parentd79d5959a023fd637e90ed1ff6547ff09d19396b (diff)
downloadlinux-201a52bea928687b7557728b176ac4f8a37d5cbd.tar.xz
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. 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>
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,
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);