hvc_xen: NULL dereference on allocation failure
PATCH 1/1 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.
drivers/tty/hvc/hvc_xen.c +2 -2
@@ -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);
Quoted 7 lines · Dan Carpenter
If
kzalloc()returns a NULL here, we pass a NULL toxencons_disconnect_backend()which will cause an Oops.Also I removed the
__GFP_ZEROwhile I was at it sincekzalloc()implies__GFP_ZERO.Signed-off-by Dan Carpenter <[email protected]>
Konrad Rzeszutek Wilk
AppliedQuoted 10 lines · Stefano Stabellini
Quoted 7 lines · Dan Carpenter
If
kzalloc()returns a NULL here, we pass a NULL toxencons_disconnect_backend()which will cause an Oops.Also I removed the
__GFP_ZEROwhile I was at it sincekzalloc()implies__GFP_ZERO.Signed-off-by Dan Carpenter <[email protected]>
applied.
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/