linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [patch] hvc_xen: NULL dereference on allocation failure
@ 2012-05-15  8:47 Dan Carpenter
  2012-05-15 10:20 ` Stefano Stabellini
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-05-15  8:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Konrad Rzeszutek Wilk, Stefano Stabellini, kernel-janitors,
	linux-kernel, linuxppc-dev, Alan Cox

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>

diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index 83d5c88..d3d91da 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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] hvc_xen: NULL dereference on allocation failure
  2012-05-15  8:47 [patch] hvc_xen: NULL dereference on allocation failure Dan Carpenter
@ 2012-05-15 10:20 ` Stefano Stabellini
  2012-05-21 14:40   ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 3+ messages in thread
From: Stefano Stabellini @ 2012-05-15 10:20 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Konrad Rzeszutek Wilk, Greg Kroah-Hartman, Stefano Stabellini,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, Alan Cox

On Tue, 15 May 2012, Dan Carpenter wrote:
> 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>
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] hvc_xen: NULL dereference on allocation failure
  2012-05-15 10:20 ` Stefano Stabellini
@ 2012-05-21 14:40   ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 3+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-05-21 14:40 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Greg Kroah-Hartman, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	Dan Carpenter, Alan Cox

On Tue, May 15, 2012 at 11:20:23AM +0100, Stefano Stabellini wrote:
> On Tue, 15 May 2012, Dan Carpenter wrote:
> > 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>

applied.
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-21 15:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-15  8:47 [patch] hvc_xen: NULL dereference on allocation failure Dan Carpenter
2012-05-15 10:20 ` Stefano Stabellini
2012-05-21 14:40   ` Konrad Rzeszutek Wilk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).