Re: [PATCH 2/2] cifs: fix module refcount leak in find_domain_name

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

 



On Fri, 24 Sep 2010 08:58:32 -0400
Jeff Layton <jlayton@xxxxxxxxxx> wrote:

> find_domain_name() uses load_nls_default which takes a module reference
> on the appropriate NLS module, but doesn't put it.
> 
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> Cc: Shirish Pargaonkar <shirishpargaonkar@xxxxxxxxx>
> ---
>  fs/cifs/cifsencrypt.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
> index 388ebe3..ccb13e6 100644
> --- a/fs/cifs/cifsencrypt.c
> +++ b/fs/cifs/cifsencrypt.c
> @@ -363,13 +363,16 @@ find_domain_name(struct cifsSesInfo *ses)
>  			if (!attrsize)
>  				break;
>  			if (!ses->domainName) {
> +				struct nls_table *default_nls;
>  				ses->domainName =
>  					kmalloc(attrsize + 1, GFP_KERNEL);
>  				if (!ses->domainName)
>  						return -ENOMEM;
> +				default_nls = load_nls_default();
>  				cifs_from_ucs2(ses->domainName,
>  					(__le16 *)blobptr, attrsize, attrsize,
> -					load_nls_default(), false);
> +					default_nls, false);
> +				unload_nls(default_nls);
>  				break;
>  			}
>  		}

My apologies for the misleading subject prefix. This patch isn't part
of a series. It's a standalone patch. There is no patch 1/2.

-- 
Jeff Layton <jlayton@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux