From: Chris Wright <chrisw@osdl.org>
To: Avi Kivity <avi@argo.co.il>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: local denial-of-service with file leases
Date: Fri, 11 Nov 2005 00:45:54 -0800 [thread overview]
Message-ID: <20051111084554.GZ7991@shell0.pdx.osdl.net> (raw)
In-Reply-To: <43737CBE.2030005@argo.co.il>
* Avi Kivity (avi@argo.co.il) wrote:
> the following program will oom a the 2.6.14.1 kernel, running as an
> ordinary user:
I don't have a good mechanism for testing leases, but this should fix
the leak. Mind testing?
thanks,
-chris
--
When unlocking lease make sure to release fasync_struct.
Signed-off-by: Chris Wright <chrisw@osdl.org>
---
diff --git a/fs/locks.c b/fs/locks.c
index a1e8b22..abba0f6 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1412,7 +1412,7 @@ int fcntl_setlease(unsigned int fd, stru
struct file_lock fl, *flp = &fl;
struct dentry *dentry = filp->f_dentry;
struct inode *inode = dentry->d_inode;
- int error;
+ int error, on = 1;
if ((current->fsuid != inode->i_uid) && !capable(CAP_LEASE))
return -EACCES;
@@ -1433,7 +1433,10 @@ int fcntl_setlease(unsigned int fd, stru
if (error)
goto out_unlock;
- error = fasync_helper(fd, filp, 1, &flp->fl_fasync);
+ if (arg == F_UNLCK)
+ on = 0;
+
+ error = fasync_helper(fd, filp, on, &flp->fl_fasync);
if (error < 0) {
/* remove lease just inserted by __setlease */
flp->fl_type = F_UNLCK | F_INPROGRESS;
next prev parent reply other threads:[~2005-11-11 8:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-10 17:00 Avi Kivity
2005-11-11 8:45 ` Chris Wright [this message]
2005-11-11 10:05 ` Avi Kivity
2005-11-11 11:14 ` Avi Kivity
2005-11-11 14:21 ` Trond Myklebust
2005-11-11 18:35 ` Chris Wright
2005-11-11 19:25 ` Trond Myklebust
2005-11-12 1:20 ` Chris Wright
2005-11-13 9:05 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051111084554.GZ7991@shell0.pdx.osdl.net \
--to=chrisw@osdl.org \
--cc=avi@argo.co.il \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome