From: Matt Fleming <matt@console-pimps.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Petr Vandrovec <petr@vandrovec.name>,
Al Viro <viro@zeniv.linux.org.uk>, Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH v2 43/43] ncpfs: Use set_current_blocked()
Date: Fri, 19 Aug 2011 17:46:59 +0100 [thread overview]
Message-ID: <1313772419-21951-44-git-send-email-matt@console-pimps.org> (raw)
In-Reply-To: <1313772419-21951-1-git-send-email-matt@console-pimps.org>
From: Matt Fleming <matt.fleming@intel.com>
As described in e6fa16ab ("signal: sigprocmask() should do
retarget_shared_pending()") the modification of current->blocked is
incorrect as we need to check whether the signal we're about to block
is pending in the shared queue.
Also, there's no need to hold sighand->siglock while reading
sighand->action[] because the lock is dropped across the call to
do_ncp_rpc_call() during which time another thread could modify
->action[].
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Petr Vandrovec <petr@vandrovec.name>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
---
fs/ncpfs/sock.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c
index 3a15872..850768a 100644
--- a/fs/ncpfs/sock.c
+++ b/fs/ncpfs/sock.c
@@ -749,10 +749,9 @@ static int ncp_do_request(struct ncp_server *server, int size,
return -EIO;
}
{
- sigset_t old_set;
- unsigned long mask, flags;
+ sigset_t old_set, blocked;
+ unsigned long mask;
- spin_lock_irqsave(¤t->sighand->siglock, flags);
old_set = current->blocked;
if (current->flags & PF_EXITING)
mask = 0;
@@ -769,16 +768,12 @@ static int ncp_do_request(struct ncp_server *server, int size,
if (current->sighand->action[SIGQUIT - 1].sa.sa_handler == SIG_DFL)
mask |= sigmask(SIGQUIT);
}
- siginitsetinv(¤t->blocked, mask);
- recalc_sigpending();
- spin_unlock_irqrestore(¤t->sighand->siglock, flags);
+ siginitsetinv(&blocked, mask);
+ set_current_blocked(&blocked);
result = do_ncp_rpc_call(server, size, reply, max_reply_size);
- spin_lock_irqsave(¤t->sighand->siglock, flags);
- current->blocked = old_set;
- recalc_sigpending();
- spin_unlock_irqrestore(¤t->sighand->siglock, flags);
+ set_current_blocked(&old_set);
}
DDPRINTK("do_ncp_rpc_call returned %d\n", result);
--
1.7.4.4
next prev parent reply other threads:[~2011-08-19 16:48 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-19 16:46 [PATCH v2 00/43] signal: set_current_blocked() and block_sigmask() Matt Fleming
2011-08-19 16:46 ` [PATCH 01/43] signal: Add block_sigmask() for adding sigmask to current->blocked Matt Fleming
2011-08-22 10:19 ` Matt Fleming
2011-08-22 14:01 ` Oleg Nesterov
2011-08-22 14:04 ` Oleg Nesterov
2011-08-22 15:56 ` Matt Fleming
2011-08-19 16:46 ` [PATCH v2 02/43] alpha: Use set_current_blocked() and block_sigmask() Matt Fleming
2011-08-19 16:46 ` [PATCH v2 03/43] arm: " Matt Fleming
2011-08-25 17:15 ` Will Deacon
2011-08-26 10:06 ` Matt Fleming
2011-08-26 14:18 ` Oleg Nesterov
2011-08-19 16:46 ` [PATCH v2 04/43] avr32: Don't mask signals in the error path Matt Fleming
2011-08-19 16:46 ` [PATCH v2 05/43] avr32: use set_current_blocked() in handle_signal/sys_rt_sigreturn Matt Fleming
2011-08-19 16:46 ` [PATCH v2 06/43] avr32: Use block_sigmask() Matt Fleming
2011-08-19 16:46 ` [PATCH v2 07/43] blackfin: Use set_current_blocked() and block_sigmask() Matt Fleming
2011-08-20 4:00 ` Mike Frysinger
2011-08-20 8:36 ` Matt Fleming
2011-08-20 17:31 ` Mike Frysinger
2011-08-19 16:46 ` [PATCH v2 08/43] cris: " Matt Fleming
2011-08-19 16:46 ` [PATCH v2 09/43] frv: " Matt Fleming
2011-08-19 16:46 ` [PATCH v2 10/43] h8300: " Matt Fleming
2011-08-19 16:46 ` [PATCH v2 11/43] ia64: " Matt Fleming
2011-08-19 16:46 ` [PATCH v2 12/43] m32r: " Matt Fleming
2011-08-19 16:46 ` [PATCH v2 13/43] m68k: " Matt Fleming
2011-08-24 4:38 ` Greg Ungerer
2011-08-19 16:46 ` [PATCH v2 14/43] microblaze: Don't reimplement force_sigsegv() Matt Fleming
2011-08-19 16:46 ` [PATCH v2 15/43] microblaze: No need to reset handler if SA_ONESHOT Matt Fleming
2011-08-19 16:46 ` [PATCH v2 16/43] microblaze: Fix signal masking Matt Fleming
2011-08-19 16:46 ` [PATCH v2 17/43] microblaze: Use set_current_blocked() and block_sigmask() Matt Fleming
2011-08-24 8:49 ` Michal Simek
2011-08-24 10:21 ` Matt Fleming
2011-08-24 13:53 ` Oleg Nesterov
2011-08-24 14:02 ` Michal Simek
2011-08-19 16:46 ` [PATCH v2 18/43] MIPS: " Matt Fleming
2011-08-19 17:27 ` Ralf Baechle
2011-08-19 16:46 ` [PATCH v2 19/43] mn10300: " Matt Fleming
2011-08-19 16:46 ` [PATCH v2 20/43] OpenRISC: Don't reimplement force_sigsegv() Matt Fleming
2011-08-19 16:46 ` [PATCH v2 21/43] OpenRISC: No need to reset handler if SA_ONESHOT Matt Fleming
2011-08-19 16:46 ` [PATCH v2 22/43] OpenRISC: Don't mask signals if we fail to setup signal stack Matt Fleming
2011-08-19 16:46 ` [PATCH v2 23/43] OpenRISC: Use set_current_blocked() and block_sigmask() Matt Fleming
2011-08-19 16:46 ` [PATCH v2 24/43] parisc: " Matt Fleming
2011-08-19 16:46 ` [PATCH v2 25/43] powerpc: " Matt Fleming
2011-08-19 16:46 ` [PATCH 26/43] [S390]: Use block_sigmask() Matt Fleming
2011-08-23 6:04 ` Martin Schwidefsky
2011-08-19 16:46 ` [PATCH v2 27/43] score: Don't mask signals if we fail to setup signal stack Matt Fleming
2011-08-19 16:46 ` [PATCH v2 28/43] score: Use set_current_blocked() and block_sigmask() Matt Fleming
2011-08-19 16:46 ` [PATCH v2 29/43] sh: No need to reset handler if SA_ONESHOT Matt Fleming
2011-08-19 16:46 ` [PATCH v2 30/43] sh: Use set_current_blocked() and block_sigmask() Matt Fleming
2011-08-19 16:46 ` [PATCH v2 31/43] sparc: " Matt Fleming
2011-08-19 16:46 ` [PATCH v2 32/43] tile: " Matt Fleming
2011-08-29 20:44 ` Chris Metcalf
2011-08-19 16:46 ` [PATCH v2 33/43] um: " Matt Fleming
2011-08-19 16:46 ` [PATCH v2 34/43] um: Don't restore current->blocked on error Matt Fleming
2011-08-19 16:46 ` [PATCH v2 35/43] unicore32: Use set_current_blocked() and block_sigmask() Matt Fleming
2011-08-22 2:15 ` Guan Xuetao
2011-08-22 10:26 ` Matt Fleming
2011-08-24 2:03 ` Guan Xuetao
2011-08-19 16:46 ` [PATCH v2 36/43] xtensa: Don't reimplement force_sigsegv() Matt Fleming
2011-08-19 16:46 ` [PATCH v2 37/43] xtensa: No need to reset handler if SA_ONESHOT Matt Fleming
2011-08-19 16:46 ` [PATCH v2 38/43] xtensa: Don't mask signals if we fail to setup signal stack Matt Fleming
2011-08-19 16:46 ` [PATCH v2 39/43] xtensa: Use set_current_blocked() and block_sigmask() Matt Fleming
2011-08-19 16:46 ` [PATCH v2 40/43] autofs4: Use set_current_blocked() Matt Fleming
2011-08-19 16:46 ` [PATCH v2 41/43] coda: " Matt Fleming
2011-08-19 16:46 ` [PATCH v2 42/43] dlm: Remove another superfluous call to recalc_sigpending() Matt Fleming
2011-08-19 16:46 ` Matt Fleming [this message]
2011-08-24 17:36 ` [PATCH v2 43/43] ncpfs: Use set_current_blocked() Oleg Nesterov
2011-08-24 17:52 ` Oleg Nesterov
2011-08-24 19:08 ` Matt Fleming
2011-08-24 18:24 ` [PATCH v2 00/43] signal: set_current_blocked() and block_sigmask() Oleg Nesterov
2011-08-25 4:30 ` Ian Kent
2011-08-25 15:31 ` Oleg Nesterov
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=1313772419-21951-44-git-send-email-matt@console-pimps.org \
--to=matt@console-pimps.org \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=petr@vandrovec.name \
--cc=viro@zeniv.linux.org.uk \
/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®