linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Markus Pargmann <mpa@pengutronix.de>
Cc: nbd-general@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH -mm 2/3] nbd: nbd_thread_recv: remove the buggy kernel_dequeue_signal()
Date: Sun, 25 Oct 2015 16:26:39 +0100	[thread overview]
Message-ID: <20151025152639.GA1402@redhat.com> (raw)
In-Reply-To: <20151025152625.GA1385@redhat.com>

nbd_thread_recv() is called by userspace, it is very wrong to dequeue
and throw out a signal.

I do not understand why nbd_thread_recv() (and nbd_thread_send() btw)
does sock_shutdown(); the caller, __nbd_ioctl(NBD_DO_IT) does this too.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 drivers/block/nbd.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index e5d96e5..0ffd73c 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -444,9 +444,8 @@ static int nbd_thread_recv(struct nbd_device *nbd)
 	spin_unlock_irqrestore(&nbd->tasks_lock, flags);
 
 	if (signal_pending(current)) {
-		ret = kernel_dequeue_signal(NULL);
-		dev_warn(nbd_to_dev(nbd), "pid %d, %s, got signal %d\n",
-			 task_pid_nr(current), current->comm, ret);
+		dev_warn(nbd_to_dev(nbd), "pid %d, %s, got signal",
+			 task_pid_nr(current), current->comm);
 		mutex_lock(&nbd->tx_lock);
 		sock_shutdown(nbd);
 		mutex_unlock(&nbd->tx_lock);
-- 
1.5.5.1


  parent reply	other threads:[~2015-10-25 14:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-25 15:26 [PATCH -mm 0/3] nbd: fix/cleanup the usage of kernel_dequeue_signal() Oleg Nesterov
2015-10-25 15:26 ` [PATCH -mm 1/3] nbd: nbd_thread_send: remove the unnecessary kernel_dequeue_signal() Oleg Nesterov
2015-10-26  7:48   ` Markus Pargmann
2015-10-25 15:26 ` Oleg Nesterov [this message]
2015-10-26  7:44   ` [PATCH -mm 2/3] nbd: nbd_thread_recv: remove the buggy kernel_dequeue_signal() Markus Pargmann
2015-10-28 15:53     ` Oleg Nesterov
2015-10-25 15:26 ` [PATCH -mm 3/3] nbd: don't abuse irqsave/irqrestore while taking nbd->tasks_lock Oleg Nesterov
2015-10-26  7:50   ` Markus Pargmann

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=20151025152639.GA1402@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpa@pengutronix.de \
    --cc=nbd-general@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).