Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760610AbZFIKVG (ORCPT ); Tue, 9 Jun 2009 06:21:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760564AbZFIKSd (ORCPT ); Tue, 9 Jun 2009 06:18:33 -0400 Received: from kroah.org ([198.145.64.141]:54565 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760522AbZFIKSc (ORCPT ); Tue, 9 Jun 2009 06:18:32 -0400 X-Mailbox-Line: From greg@blue.kroah.org Tue Jun 9 02:40:57 2009 Message-Id: <20090609094057.382414792@blue.kroah.org> User-Agent: quilt/0.48-1 Date: Tue, 09 Jun 2009 02:39:11 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , Willy Tarreau , Rodrigo Rubira Branco , Jake Edge , Eugene Teo , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Ian Campbell , Jeremy Fitzhardinge , Jens Axboe , Greg Kroah-Hartman Subject: [patch 23/87] xen/blkfront: allow xenbus state transition to Closing->Closed when not Connected References: <20090609093848.204935043@blue.kroah.org> Content-Disposition: inline; filename=xen-blkfront-allow-xenbus-state-transition-to-closing-closed-when-not-connected.patch In-Reply-To: <20090609094451.GA26439@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1530 Lines: 35 2.6.29-stable review patch. If anyone has any objections, please let us know. ------------------ From: Ian Campbell commit 28afea5b2ffaa48f4f43d22ae8edcc384c05df80 upstream. This situation can occur when attempting to attach a block device whose backend is an empty physical CD-ROM driver. The backend in this case will go directly from the Initialising state to Closing->Closed. Previously this would result in a NULL pointer deref on info->gd (xenbus_dev_fatal does not return as a1a15ac5 seems to expect) Signed-off-by: Ian Campbell Acked-by: Jeremy Fitzhardinge Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/block/xen-blkfront.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -977,8 +977,10 @@ static void backend_changed(struct xenbu break; case XenbusStateClosing: - if (info->gd == NULL) - xenbus_dev_fatal(dev, -ENODEV, "gd is NULL"); + if (info->gd == NULL) { + xenbus_frontend_closed(dev); + break; + } bd = bdget_disk(info->gd, 0); if (bd == NULL) xenbus_dev_fatal(dev, -ENODEV, "bdget failed"); -- 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/