lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 30 Oct 2013 12:41:44 +0100
From:	Pavel Machek <pavel@....cz>
To:	Pali Rohár <pali.rohar@...il.com>
Cc:	Luciano Coelho <luca@...lho.fi>,
	"John W. Linville" <linville@...driver.com>,
	Johannes Berg <johannes@...solutions.net>,
	"David S. Miller" <davem@...emloft.net>,
	linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, freemangordon@....bg,
	aaro.koskinen@....fi, sre@...g0.de, joni.lapilainen@...il.com,
	David Gnedt <david.gnedt@...izone.at>
Subject: Re: [PATCH 08/16] wl1251: implement multicast address filtering

Hi!

> Port multicast address filtering from wl1271 driver.
> It sets up the hardware multicast address filter in configure_filter() with
> addresses supplied through prepare_multicast().

> +static u64 wl1251_op_prepare_multicast(struct ieee80211_hw *hw,
> +				       struct netdev_hw_addr_list *mc_list)
> +{
> +	struct wl1251_filter_params *fp;
> +	struct netdev_hw_addr *ha;
> +	struct wl1251 *wl = hw->priv;
> +
> +	if (unlikely(wl->state == WL1251_STATE_OFF))
> +		return 0;
> +
> +	fp = kzalloc(sizeof(*fp), GFP_ATOMIC);
> +	if (!fp) {
> +		wl1251_error("Out of memory setting filters.");
> +		return 0;
> +	}

So if there's not enough memory, we return 0.

> +	/* update multicast filtering parameters */
> +	fp->mc_list_length = 0;
> +	if (netdev_hw_addr_list_count(mc_list) > ACX_MC_ADDRESS_GROUP_MAX) {
> +		fp->enabled = false;
> +	} else {
> +		fp->enabled = true;
> +		netdev_hw_addr_list_for_each(ha, mc_list) {
> +			memcpy(fp->mc_list[fp->mc_list_length],
> +					ha->addr, ETH_ALEN);
> +			fp->mc_list_length++;
> +		}
> +	}
> +
> +	return (u64)(unsigned long)fp;
> +}

Hiding pointers into u64 is not exactly nice, but I guess that's how
interface is designed? :-(.

> @@ -737,6 +779,15 @@ static void wl1251_op_configure_filter(struct ieee80211_hw *hw,
>  	if (ret < 0)
>  		goto out;
>  
> +	if (*total & FIF_ALLMULTI || *total & FIF_PROMISC_IN_BSS)
> +		ret = wl1251_acx_group_address_tbl(wl, false, NULL, 0);
> +	else if (fp)
> +		ret = wl1251_acx_group_address_tbl(wl, fp->enabled,
> +						   fp->mc_list,
> +						     	fp->mc_list_length);

Is it correct not to call anything in !fp case (for example because we
were out of memory?)

> +	if (ret < 0)
> +		goto out;
> +
>  	/* send filters to firmware */
>  	wl1251_acx_rx_config(wl, wl->rx_config, wl->rx_filter);
>  
> @@ -744,6 +795,7 @@ static void wl1251_op_configure_filter(struct ieee80211_hw *hw,
>  
>  out:
>  	mutex_unlock(&wl->mutex);
> +	kfree(fp);
>  }

Umm, this is interesting. Who frees the memory in the success case?

Thanks,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ