Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751549Ab2KLSDi (ORCPT ); Mon, 12 Nov 2012 13:03:38 -0500 Received: from mga02.intel.com ([134.134.136.20]:52569 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750988Ab2KLSDh (ORCPT ); Mon, 12 Nov 2012 13:03:37 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,764,1344236400"; d="scan'208";a="240820207" Date: Mon, 12 Nov 2012 10:03:37 -0800 From: Sarah Sharp To: Julius Werner Cc: Andy Shevchenko , Julius Werner , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Greg Kroah-Hartman , Vincent Palatin Subject: Re: [PATCH] xhci: fix null-pointer dereference when destroying half-built segment rings Message-ID: <20121112180337.GB6217@xanatos> References: <20121101175217.GJ29270@xanatos> <1351799279-23824-1-git-send-email-jwerner@chromium.org> <20121101201552.GA9472@xanatos> <95F2AD07-450E-422C-AB0B-9DFC4734CA1C@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <95F2AD07-450E-422C-AB0B-9DFC4734CA1C@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 873 Lines: 21 On Thu, Nov 01, 2012 at 01:28:46PM -0700, Julius Werner wrote: > >> Is it just > >> for (prev = *first; prev; prev = prev->next) > >> xhci_segment_free(xhci, prev); > >> > >> ? > > > > Yeah, that seems cleaner. > > > > Sarah Sharp > > I can submit it that way if you want, but I would advise against it. This way you access the prev pointer after it has been freed already… that's probably not a problem in the current kernel, but it depends on how the underlying memory is managed and is generally just not a good idea in my opinion. Yep, you're right. I'll take the second patch you submitted, thanks. Sarah Sharp -- 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/