mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: "Igor Yu. Zhbanov" <bsg@uniyar.ac.ru>
Cc: Andi Kleen <ak@suse.de>,
	linux-kernel@vger.kernel.org, andy@lysaker.kvaerner.no,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: Kernel Oops on locking sockets via fcntl()
Date: Mon, 27 Nov 2000 14:23:01 +0100	[thread overview]
Message-ID: <20001127142301.A30980@gruyere.muc.suse.de> (raw)
In-Reply-To: <20001124145540.A13064@gruyere.muc.suse.de> <Pine.GSO.3.96.SK.1001127155810.24276A-100000@univ.uniyar.ac.ru>
In-Reply-To: <Pine.GSO.3.96.SK.1001127155810.24276A-100000@univ.uniyar.ac.ru>; from bsg@uniyar.ac.ru on Mon, Nov 27, 2000 at 03:59:05PM +0300

On Mon, Nov 27, 2000 at 03:59:05PM +0300, Igor Yu. Zhbanov wrote:
> On Fri, 24 Nov 2000, Andi Kleen wrote:
> 
> > On Fri, Nov 24, 2000 at 04:32:26PM +0300, Igor Yu. Zhbanov wrote:
> > > Hello!
> > > 
> > > One fine day accidentally I have opened an Xserver's socket placed in /tmp
> > > with my favourite text editor "le". I have got a message from the kernel similar
> > > to this:
> > 
> > 
> > Which kernel version are you using ? It should be already fixed in all 
> > modern kernels (newer 2.2 and 2.4) 
> > 
> > 
> > -Andi
> > 
> 
> My Kernel version is 2.2.17

Oops, looks like the patch got lost. I cannot find it in 2.2.18pre23 anymore.
It came up a few weeks ago and was included in some distribution kernels
(e.g. the SuSE one), but apparently fell through the tracks in the official
2.2 kernel.

Alan? Would you consider including it still in 2.2.18 ?


-Andi


diff -urN linux.a/fs/locks.c linux.s/fs/locks.c
--- linux.a/fs/locks.c	Fri Sep  1 01:01:12 2000
+++ linux.s/fs/locks.c	Fri Sep  1 01:33:05 2000
@@ -345,6 +345,9 @@
 	if (!filp->f_dentry || !filp->f_dentry->d_inode)
 		goto out_putf;
 
+	if (!filp->f_op)
+		goto out_putf;
+
 	if (!flock_to_posix_lock(filp, &file_lock, &flock))
 		goto out_putf;
 
@@ -425,6 +428,8 @@
 		goto out_putf;
 	if (!(inode = dentry->d_inode))
 		goto out_putf;
+	if (!filp->f_op)
+		goto out_putf;	
 
 	/* Don't allow mandatory locks on files that may be memory mapped
 	 * and shared.
@@ -517,6 +522,8 @@
 	error = -EINVAL;
 	if (!filp->f_dentry || !filp->f_dentry->d_inode)
 		goto out_putf;
+	if (!filp->f_op)
+		goto out_putf;
 
 	if (!flock64_to_posix_lock(filp, &file_lock, &flock))
 		goto out_putf;
@@ -585,6 +592,8 @@
 		goto out_putf;
 	if (!(inode = dentry->d_inode))
 		goto out_putf;
+	if (!filp->f_op)
+		goto out_putf;
 
 	/* Don't allow mandatory locks on files that may be memory mapped
 	 * and shared.
@@ -669,8 +678,9 @@
 	before = &inode->i_flock;
 	while ((fl = *before) != NULL) {
 		if ((fl->fl_flags & FL_POSIX) && fl->fl_owner == owner) {
-			int (*lock)(struct file *, int, struct file_lock *);
-			lock = filp->f_op->lock;
+			int (*lock)(struct file *, int, struct file_lock *) = NULL; 
+			if (filp->f_op)
+				lock = filp->f_op->lock;
 			if (lock) {
 				file_lock = *fl;
 				file_lock.fl_type = F_UNLCK;



-Andi

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

  reply	other threads:[~2000-11-27 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-24 13:32 Igor Yu. Zhbanov
2000-11-24 13:55 ` Andi Kleen
2000-11-27 12:59   ` Igor Yu. Zhbanov
2000-11-27 13:23     ` Andi Kleen [this message]
2000-11-28 11:21 ` David S. Miller

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=20001127142301.A30980@gruyere.muc.suse.de \
    --to=ak@suse.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andy@lysaker.kvaerner.no \
    --cc=bsg@uniyar.ac.ru \
    --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

all inboxes | Powered by JetHome®