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, 24 Jan 2007 12:51:52 +0100
From:	Sébastien Dugué <sebastien.dugue@...l.net>
To:	Andrew Morton <akpm@...l.org>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	linux-aio <linux-aio@...ck.org>,
	Bharata B Rao <bharata@...ibm.com>,
	Christoph Hellwig <hch@...radead.org>,
	Suparna Bhattacharya <suparna@...ibm.com>,
	Ulrich Drepper <drepper@...hat.com>,
	Zach Brown <zach.brown@...cle.com>,
	Jean Pierre Dion <jean-pierre.dion@...l.net>,
	Badari Pulavarty <pbadari@...ibm.com>
Subject: Re: [PATCH -mm 5/5][AIO] - Add listio syscall support

On Tue, 23 Jan 2007 21:50:47 -0800 Andrew Morton <akpm@...l.org> wrote:

> On Wed, 17 Jan 2007 10:55:54 +0100
> Sébastien Dugué <sebastien.dugue@...l.net> wrote:
> 
> > +asmlinkage long
> > +compat_sys_lio_submit(aio_context_t ctx_id, int mode, int nr, u32 __user *iocb,
> > +		struct compat_sigevent __user *sig_user)
> > +{
> > +	struct kioctx *ctx;
> > +	struct lio_event *lio = NULL;
> > +	struct sigevent __user *event = NULL;
> > +	long ret = 0;
> > +
> > +	if (unlikely(nr < 0))
> > +		return -EINVAL;
> > +
> > +	if (unlikely(!access_ok(VERIFY_READ, iocb, (nr * sizeof(u32)))))
> > +		return -EFAULT;
> > +
> > +	ctx = lookup_ioctx(ctx_id);
> > +	if (unlikely(!ctx))
> > +		return -EINVAL;
> > +
> > +	if (sig_user) {
> > +		struct sigevent kevent;
> > +		event = compat_alloc_user_space(sizeof(struct sigevent));
> > +		if (get_compat_sigevent(&kevent, sig_user) ||
> > +			copy_to_user(event, &kevent, sizeof(struct sigevent)))
> > +			return -EFAULT;
> 
> I think we just leaked a ref against the ioctx.

  Right, will fix.

> 
> That's two.  Please re-review the whole patchset for leaks like this.

  Well, this particular patch did not have much review so far (contrary to the
the other patches in the patchset). That's why I posted it mainly
for comments and not expecting it to make it to -mm so soon.

> 
> Please also do not do returns from the middle of functions like this.  It's just
> asking for resource leaks, either now or in the future.
> 

  Argh, yes. Who wrote that code? ;-)

  Thanks,

  Sébastien.


-
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