From: Hans de Goede <hdegoede@redhat.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Harshit Mogalapalli" <harshit.m.mogalapalli@oracle.com>
Cc: "Jorge Lopez" <jorge.lopez2@hp.com>,
"Mark Gross" <markgross@kernel.org>,
"Thomas Weißschuh" <linux@weissschuh.net>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org,
error27@gmail.com, vegard.nossum@oracle.com,
"kernel test robot" <lkp@intel.com>
Subject: Re: [PATCH v4 3/4] platform/x86: hp-bioscfg: Fix error handling in hp_add_other_attributes()
Date: Tue, 14 Nov 2023 13:43:59 +0100 [thread overview]
Message-ID: <b3d2f6aa-4dc4-4570-9c00-54b7211fb851@redhat.com> (raw)
In-Reply-To: <36e7a170-bd87-4462-fc6b-eec446fbb551@linux.intel.com>
Hi Ilpo,
On 11/14/23 11:31, Ilpo Järvinen wrote:
> On Mon, 13 Nov 2023, Harshit Mogalapalli wrote:
>
>> 'attr_name_kobj' is allocated using kzalloc, but on all the error paths
>> it is not freed, hence we have a memory leak.
>>
>> Fix the error path before kobject_init_and_add() by adding kfree().
>>
>> kobject_put() must be always called after passing the object to
>> kobject_init_and_add(). Only the error path which is immediately next
>> to kobject_init_and_add() calls kobject_put() and not any other error
>> path after it.
>>
>> Fix the error handling after kobject_init_and_add() by moving the
>> kobject_put() into the goto label err_other_attr_init that is already
>> used by all the error paths after kobject_init_and_add().
>>
>> Fixes: a34fc329b189 ("platform/x86: hp-bioscfg: bioscfg")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Reported-by: Dan Carpenter <error27@gmail.com>
>> Closes: https://lore.kernel.org/r/202309201412.on0VXJGo-lkp@intel.com/
>> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
>> ---
>> This is based on static analysis, only compile tested.
>>
>> v3->v4: Add more explicit statement on how we are fixing it, suggested
>> by Ilpo
>
> Thanks a lot, this looks fine too now.
>
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thank you for reviewing this series. I believe that it is best
to submit this as fixes for the current cycle.
Under the assumption that you agree with this I've delegated
these 4 patches to you (Ilpo) in patchwork.
Regards,
Hans
next prev parent reply other threads:[~2023-11-14 12:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 20:07 [PATCH v4 1/4] platform/x86: hp-bioscfg: Simplify return check " Harshit Mogalapalli
2023-11-13 20:07 ` [PATCH v4 2/4] platform/x86: hp-bioscfg: move mutex_lock() down " Harshit Mogalapalli
2023-11-13 20:07 ` [PATCH v4 3/4] platform/x86: hp-bioscfg: Fix error handling " Harshit Mogalapalli
2023-11-14 10:31 ` Ilpo Järvinen
2023-11-14 12:43 ` Hans de Goede [this message]
2023-11-14 12:53 ` Ilpo Järvinen
2023-11-13 20:07 ` [PATCH v4 4/4] platform/x86: hp-bioscfg: Remove unused obj " Harshit Mogalapalli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b3d2f6aa-4dc4-4570-9c00-54b7211fb851@redhat.com \
--to=hdegoede@redhat.com \
--cc=dan.carpenter@linaro.org \
--cc=error27@gmail.com \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jorge.lopez2@hp.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=lkp@intel.com \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=vegard.nossum@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®