From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Kosina Subject: Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind Date: Sat, 1 Aug 2015 14:11:40 +0200 (CEST) Message-ID: References: <1438042590-17719-1-git-send-email-k.kozlowski@samsung.com> <20150729174619.GC23178@dtor-ws> <20150730001026.GH23178@dtor-ws> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Return-path: Received: from mx2.suse.de ([195.135.220.15]:52253 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751235AbbHAMLm (ORCPT ); Sat, 1 Aug 2015 08:11:42 -0400 In-Reply-To: <20150730001026.GH23178@dtor-ws> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Dmitry Torokhov Cc: Krzysztof Kozlowski , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, sre@kernel.org, linux-pm@vger.kernel.org, "H.J. Lu" , stable@vger.kernel.org On Wed, 29 Jul 2015, Dmitry Torokhov wrote: > > Another and less intrusive fix would be: > > > > char *name = dev->battery->desc->name; > > struct power_supply_desc *psy_desc = dev->battery->desc; > > power_supply_unregister(dev->battery); > > kfree(name); > > kfree(psy_desc); > > I would much rather prefer this to the other version as it does not > leave memory hanging around, potentially indefinitely, but ultimately it > is up to Jiri. I must have been in some broken state of mind when applying the original one, thanks a lot for catching my brainfart, Dmitry! Kryzstof, could you please send me properly formatted patch with the above, on top of your previous fix? Thanks. -- Jiri Kosina SUSE Labs