Search Linux Wireless

Re: [PATCH 20/24] regulatory: fix memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 6, 2012 at 8:47 AM, Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote:
> From: Johannes Berg <johannes.berg@xxxxxxxxx>
>
> If duplicating here fails, we leak the original.
>
> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
> ---
>  net/wireless/reg.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index 011fab9..5a34830 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -2120,8 +2120,10 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
>                         return -EALREADY;
>
>                 regd = reg_copy_regd(rd);
> -               if (IS_ERR(regd))
> +               if (IS_ERR(regd)) {
> +                       kfree(rd);
>                         return PTR_ERR(regd);
> +               }

The caller, set_regdom() free's t for us if we fail though so I don't
see how this was leaked.

int set_regdom(const struct ieee80211_regdomain *rd)
{
        int r;

        assert_cfg80211_lock();

        mutex_lock(&reg_mutex);

        /* Note that this doesn't update the wiphys, this is done below */
        r = __set_regdom(rd);
        if (r) {
                if (r == -EALREADY)
                        reg_set_request_processed();

                kfree(rd);
                mutex_unlock(&reg_mutex);
                return r;
        }
...
}

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux