Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Jouni Malinen <jouni.malinen@atheros.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH] mac80211: Fix debugfs union misuse and pointer corruption
Date: Thu, 28 Aug 2008 14:18:43 +0200	[thread overview]
Message-ID: <1219925923.25321.12.camel@johannes.berg> (raw)
In-Reply-To: <20080828121206.GA4863@jm.kir.nu>

[-- Attachment #1: Type: text/plain, Size: 2596 bytes --]

On Thu, 2008-08-28 at 15:12 +0300, Jouni Malinen wrote:
> debugfs union in struct ieee80211_sub_if_data is misused by including a
> common default_key dentry as a union member. This ends occupying the same
> memory area with the first dentry in other union members (structures;
> usually drop_unencrypted). Consequently, debugfs operations on
> default_key symlinks and drop_unencrypted entry are using the same
> dentry pointer even though they are supposed to be separate ones. This
> can lead to removing entries incorrectly or potentially leaving
> something behind since one of the dentry pointers gets lost.
> 
> Fix this by moving the default_key dentry to a new struct
> (common_debugfs) that contains dentries (more to be added in future)
> that are shared by all vif types. The debugfs union must only be used
> for vif type-specific entries to avoid this type of pointer corruption.
> 
> Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

Acked-by: Johannes Berg <johannes@sipsolutions.net>

also the other similar patch, sorry about this, it's surely my mistake.

> 
> Index: wireless-testing/net/mac80211/ieee80211_i.h
> ===================================================================
> --- wireless-testing.orig/net/mac80211/ieee80211_i.h
> +++ wireless-testing/net/mac80211/ieee80211_i.h
> @@ -498,8 +498,10 @@ struct ieee80211_sub_if_data {
>  		struct {
>  			struct dentry *mode;
>  		} monitor;
> -		struct dentry *default_key;
>  	} debugfs;
> +	struct {
> +		struct dentry *default_key;
> +	} common_debugfs;
>  
>  #ifdef CONFIG_MAC80211_MESH
>  	struct dentry *mesh_stats_dir;
> Index: wireless-testing/net/mac80211/debugfs_key.c
> ===================================================================
> --- wireless-testing.orig/net/mac80211/debugfs_key.c
> +++ wireless-testing/net/mac80211/debugfs_key.c
> @@ -265,7 +265,7 @@ void ieee80211_debugfs_key_add_default(s
>  	key = sdata->default_key;
>  	if (key) {
>  		sprintf(buf, "../keys/%d", key->debugfs.cnt);
> -		sdata->debugfs.default_key =
> +		sdata->common_debugfs.default_key =
>  			debugfs_create_symlink("default_key",
>  					       sdata->debugfsdir, buf);
>  	} else
> @@ -277,8 +277,8 @@ void ieee80211_debugfs_key_remove_defaul
>  	if (!sdata)
>  		return;
>  
> -	debugfs_remove(sdata->debugfs.default_key);
> -	sdata->debugfs.default_key = NULL;
> +	debugfs_remove(sdata->common_debugfs.default_key);
> +	sdata->common_debugfs.default_key = NULL;
>  }
>  
>  void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key,
> 
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2008-08-28 12:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-28 12:12 [PATCH] mac80211: Fix debugfs union misuse and pointer corruption Jouni Malinen
2008-08-28 12:18 ` Johannes Berg [this message]
2008-08-28 12:34   ` Jouni Malinen

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=1219925923.25321.12.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=jouni.malinen@atheros.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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