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]
Message-ID: <20120313154945.GA7349@google.com>
Date:	Tue, 13 Mar 2012 08:49:45 -0700
From:	Tejun Heo <tj@...nel.org>
To:	Vivek Goyal <vgoyal@...hat.com>
Cc:	Xiaotian Feng <xtfeng@...il.com>, axboe@...nel.dk,
	linux-kernel@...r.kernel.org, Xiaotian Feng <dannyfeng@...cent.com>
Subject: Re: [PATCH v2] block: fix ioc leak in put_io_context

On Tue, Mar 13, 2012 at 10:28:20AM -0400, Vivek Goyal wrote:
> On Tue, Mar 13, 2012 at 01:21:06PM -0400, Xiaotian Feng wrote:
> > diff --git a/block/blk-ioc.c b/block/blk-ioc.c
> > index 8b782a6..9690f27 100644
> > --- a/block/blk-ioc.c
> > +++ b/block/blk-ioc.c
> > @@ -145,6 +145,7 @@ static void ioc_release_fn(struct work_struct *work)
> >  void put_io_context(struct io_context *ioc)
> >  {
> >  	unsigned long flags;
> > +	bool free_ioc = false;
> >  
> >  	if (ioc == NULL)
> >  		return;
> > @@ -159,8 +160,13 @@ void put_io_context(struct io_context *ioc)
> >  		spin_lock_irqsave(&ioc->lock, flags);
> >  		if (!hlist_empty(&ioc->icq_list))
> >  			schedule_work(&ioc->release_work);
> > +		else
> > +			free_ioc = true;

Calling kmem_cache_free() here directly is probably better.

> >  		spin_unlock_irqrestore(&ioc->lock, flags);
> >  	}
> > +
> > +	if (free_ioc)
> > +		kmem_cache_free(iocontext_cachep, ioc);
> >  }
> >  EXPORT_SYMBOL(put_io_context);
> 
> This one looks good to me. Tejun?
> 
> Acked-by: Vivek Goyal <vgoyal@...hat.com>

Acked-by: Tejun Heo <tj@...nel.org>

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ