linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Laura Abbott <labbott@redhat.com>,
	linux-kernel@vger.kernel.org,
	Johannes Berg <johannes.berg@intel.com>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
	Intel Linux Wireless <linuxwifi@intel.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	linux-wireless@vger.kernel.org, stable <stable@vger.kernel.org>
Subject: Re: [PATCH] iwlwifi: properly check debugfs dentry before using it
Date: Wed, 17 Apr 2019 10:02:54 +0300	[thread overview]
Message-ID: <05f0923dce988a9c4cfb870013c49ca4136afbdb.camel@coelho.fi> (raw)
In-Reply-To: <20190330093152.GB14300@kroah.com>

On Sat, 2019-03-30 at 10:31 +0100, Greg Kroah-Hartman wrote:
> debugfs can now report an error code if something went wrong instead
> of
> just NULL.  So if the return value is to be used as a "real" dentry,
> it
> needs to be checked if it is an error before dereferencing it.
> 
> This is now happening because of ff9fb72bc077 ("debugfs: return error
> values, not NULL").  If multiple iwlwifi devices are in the system,
> this
> can cause problems when the driver attempts to create the main
> debugfs
> directory again.  Later on in the code we fail horribly by trying to
> dereference a pointer that is an error value.
> 
> Reported-by: Laura Abbott <labbott@redhat.com>
> Cc: Johannes Berg <johannes.berg@intel.com>
> Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> Cc: Luca Coelho <luciano.coelho@intel.com>
> Cc: Intel Linux Wireless <linuxwifi@intel.com>
> Cc: Kalle Valo <kvalo@codeaurora.org>
> Cc: stable <stable@vger.kernel.org> # 5.0
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> index 2453ceabf00d..6925527d8457 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> @@ -774,8 +774,7 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm
> *mvm, struct ieee80211_vif *vif)
>  		return;
>  
>  	mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir);
> -
> -	if (!mvmvif->dbgfs_dir) {
> +	if (IS_ERR_OR_NULL(mvmvif->dbgfs_dir)) {
>  		IWL_ERR(mvm, "Failed to create debugfs directory under
> %pd\n",
>  			dbgfs_dir);
>  		return;

Thanks! I've applied this internally and will send upstream for v5.1-
rc* following our normal upstreaming process.

I added the other Reported-by that Laura asked for and added "mvm:" to
the subject.

--
Cheers,
Luca.


      parent reply	other threads:[~2019-04-17  7:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 15:21 [PATCH] iwlwifi: mvm: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-01-25 19:30 ` Luciano Coelho
2019-03-26 23:55 ` Laura Abbott
2019-03-27  1:26   ` Greg Kroah-Hartman
2019-03-27  1:47     ` Laura Abbott
2019-03-27  1:53       ` Greg Kroah-Hartman
2019-03-27  6:35         ` Luca Coelho
2019-03-30  9:22           ` Greg Kroah-Hartman
2019-03-30  9:31             ` [PATCH] iwlwifi: properly check debugfs dentry before using it Greg Kroah-Hartman
2019-04-01 15:39               ` Laura Abbott
2019-04-17  7:02               ` Luca Coelho [this message]

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=05f0923dce988a9c4cfb870013c49ca4136afbdb.camel@coelho.fi \
    --to=luca@coelho.fi \
    --cc=emmanuel.grumbach@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johannes.berg@intel.com \
    --cc=kvalo@codeaurora.org \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linuxwifi@intel.com \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).