stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Krzysztof Kozlowski <krzk@kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: [PATCH 4.11 033/114] crypto: s5p-sss - Close possible race for completed requests
Date: Thu, 18 May 2017 12:45:43 +0200	[thread overview]
Message-ID: <20170518103609.860045933@linuxfoundation.org> (raw)
In-Reply-To: <20170518103604.736737251@linuxfoundation.org>

4.11-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Krzysztof Kozlowski <krzk@kernel.org>

commit 42d5c176b76e190a4a3e0dfeffdae661755955b6 upstream.

Driver is capable of handling only one request at a time and it stores
it in its state container struct s5p_aes_dev.  This stored request must be
protected between concurrent invocations (e.g. completing current
request and scheduling new one).  Combination of lock and "busy" field
is used for that purpose.

When "busy" field is true, the driver will not accept new request thus
it will not overwrite currently handled data.

However commit 28b62b145868 ("crypto: s5p-sss - Fix spinlock recursion
on LRW(AES)") moved some of the write to "busy" field out of a lock
protected critical section.  This might lead to potential race between
completing current request and scheduling a new one.  Effectively the
request completion might try to operate on new crypto request.

Fixes: 28b62b145868 ("crypto: s5p-sss - Fix spinlock recursion on LRW(AES)")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/crypto/s5p-sss.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -287,7 +287,6 @@ static void s5p_sg_done(struct s5p_aes_d
 static void s5p_aes_complete(struct s5p_aes_dev *dev, int err)
 {
 	dev->req->base.complete(&dev->req->base, err);
-	dev->busy = false;
 }
 
 static void s5p_unset_outdata(struct s5p_aes_dev *dev)
@@ -462,7 +461,7 @@ static irqreturn_t s5p_aes_interrupt(int
 		spin_unlock_irqrestore(&dev->lock, flags);
 
 		s5p_aes_complete(dev, 0);
-		dev->busy = true;
+		/* Device is still busy */
 		tasklet_schedule(&dev->tasklet);
 	} else {
 		/*
@@ -483,6 +482,7 @@ static irqreturn_t s5p_aes_interrupt(int
 
 error:
 	s5p_sg_done(dev);
+	dev->busy = false;
 	spin_unlock_irqrestore(&dev->lock, flags);
 	s5p_aes_complete(dev, err);
 
@@ -634,6 +634,7 @@ outdata_error:
 
 indata_error:
 	s5p_sg_done(dev);
+	dev->busy = false;
 	spin_unlock_irqrestore(&dev->lock, flags);
 	s5p_aes_complete(dev, err);
 }

  parent reply	other threads:[~2017-05-18 10:51 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 10:45 [PATCH 4.11 000/114] 4.11.2-stable review Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 001/114] xen: adjust early dom0 p2m handling to xen hypervisor behavior Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 002/114] target: Fix compare_and_write_callback handling for non GOOD status Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 003/114] target/fileio: Fix zero-length READ and WRITE handling Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 004/114] iscsi-target: Set session_fall_back_to_erl0 when forcing reinstatement Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 005/114] usb: xhci: bInterval quirk for TI TUSB73x0 Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 006/114] usb: host: xhci: print correct command ring address Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 007/114] USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 008/114] USB: Proper handling of Race Condition when two USB class drivers try to call init_usb_class simultaneously Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 010/114] staging: vt6656: use off stack for in buffer USB transfers Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 011/114] staging: vt6656: use off stack for out " Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 012/114] staging: gdm724x: gdm_mux: fix use-after-free on module unload Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 013/114] staging: wilc1000: Fix problem with wrong vif index Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 014/114] [media] staging: sir: fill in missing fields and fix probe Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 015/114] staging: comedi: jr3_pci: fix possible null pointer dereference Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 016/114] staging: comedi: jr3_pci: cope with jiffies wraparound Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 017/114] usb: misc: add missing continue in switch Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 018/114] usb: gadget: legacy gadgets are optional Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 019/114] usb: Make sure usb/phy/of gets built-in Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 020/114] usb: hub: Fix error loop seen after hub communication errors Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 021/114] usb: hub: Do not attempt to autosuspend disconnected devices Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 022/114] usb: misc: legousbtower: Fix buffers on stack Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 023/114] x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 024/114] selftests/x86/ldt_gdt_32: Work around a glibc sigaction() bug Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 025/114] x86, pmem: Fix cache flushing for iovec write < 8 bytes Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 026/114] um: Fix PTRACE_POKEUSER on x86_64 Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 027/114] perf/x86: Fix Broadwell-EP DRAM RAPL events Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 029/114] Revert "KVM: Support vCPU-based gfn->hva cache" Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 030/114] KVM: arm/arm64: fix races in kvm_psci_vcpu_on Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 031/114] arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 032/114] block: fix blk_integrity_register to use templates interval_exp if not 0 Greg Kroah-Hartman
2017-05-18 10:45 ` Greg Kroah-Hartman [this message]
2017-05-18 10:45 ` [PATCH 4.11 034/114] crypto: algif_aead - Require setkey before accept(2) Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 035/114] crypto: ccp - Use only the relevant interrupt bits Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 036/114] crypto: ccp - Disable interrupts early on unload Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 037/114] crypto: ccp - Change ISR handler method for a v3 CCP Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 038/114] crypto: ccp - Change ISR handler method for a v5 CCP Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 039/114] dm crypt: rewrite (wipe) key in crypto layer using random data Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 040/114] dm era: save spacemap metadata root after the pre-commit Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 041/114] dm rq: check blk_mq_register_dev() return value in dm_mq_init_request_queue() Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 042/114] dm thin: fix a memory leak when passing discard bio down Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 043/114] vfio/type1: Remove locked page accounting workqueue Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 044/114] iov_iter: dont revert iov buffer if csum error Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 045/114] IB/core: Fix sysfs registration error flow Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 046/114] IB/core: Fix kernel crash during fail to initialize device Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 047/114] IB/core: For multicast functions, verify that LIDs are multicast LIDs Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 048/114] IB/IPoIB: ibX: failed to create mcg debug file Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 049/114] IB/mlx4: Fix ib device initialization error flow Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 050/114] IB/mlx4: Reduce SRIOV multicast cleanup warning message to debug level Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 051/114] IB/hfi1: Prevent kernel QP post send hard lockups Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 052/114] perf auxtrace: Fix no_size logic in addr_filter__resolve_kernel_syms() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 053/114] perf annotate s390: Fix perf annotate error -95 (4.10 regression) Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 054/114] perf annotate s390: Implement jump types for perf annotate Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 055/114] jbd2: fix dbench4 performance regression for nobarrier mounts Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 056/114] ext4: evict inline data when writing to memory map Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 057/114] orangefs: fix bounds check for listxattr Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 058/114] orangefs: clean up oversize xattr validation Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 059/114] orangefs: do not set getattr_time on orangefs_lookup Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 060/114] orangefs: do not check possibly stale size on truncate Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 061/114] fs/xattr.c: zero out memory copied to userspace in getxattr Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 062/114] ceph: fix memory leak in __ceph_setxattr() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 063/114] fs: fix data invalidation in the cleancache during direct IO Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 064/114] fs/block_dev: always invalidate cleancache in invalidate_bdev() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 065/114] mm: vmscan: fix IO/refault regression in cache workingset transition Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 066/114] mm: prevent potential recursive reclaim due to clearing PF_MEMALLOC Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 067/114] Fix match_prepath() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 068/114] Do not return number of bytes written for ioctl CIFS_IOC_COPYCHUNK_FILE Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 069/114] Set unicode flag on cifs echo request to avoid Mac error Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 070/114] SMB3: Work around mount failure when using SMB3 dialect to Macs Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 072/114] cifs: fix leak in FSCTL_ENUM_SNAPS response handling Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 073/114] cifs: fix CIFS_ENUMERATE_SNAPSHOTS oops Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 074/114] CIFS: fix oplock break deadlocks Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 075/114] cifs: fix CIFS_IOC_GET_MNT_INFO oops Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 077/114] ovl: do not set overlay.opaque on non-dir create Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 078/114] padata: free correct variable Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 079/114] md/raid1: avoid reusing a resync bio after error handling Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 080/114] device-dax: fix cdev leak Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 081/114] device-dax: fix sysfs attribute deadlock Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 082/114] dax: prevent invalidation of mapped DAX entries Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 083/114] mm: fix data corruption due to stale mmap reads Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 084/114] ext4: return to starting transaction in ext4_dax_huge_fault() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 085/114] dax: fix PMD data corruption when fault races with write Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 086/114] f2fs: fix wrong max cost initialization Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 087/114] Revert "f2fs: put allocate_segment after refresh_sit_entry" Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 088/114] f2fs: fix fs corruption due to zero inode page Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 089/114] f2fs: fix multiple f2fs_add_link() having same name for inline dentry Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 090/114] f2fs: check entire encrypted bigname when finding a dentry Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 091/114] f2fs: Make flush bios explicitely sync Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 092/114] initramfs: Always do fput() and load modules after rootfs populate Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 094/114] fscrypt: fix context consistency check when key(s) unavailable Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 095/114] fscrypt: avoid collisions when presenting long encrypted filenames Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 096/114] serial: samsung: Use right device for DMA-mapping calls Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 097/114] serial: samsung: Add missing checks for dma_map_single failure Greg Kroah-Hartman
2017-05-18 12:18   ` Krzysztof Kozlowski
2017-05-18 12:24     ` Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 098/114] serial: omap: fix runtime-pm handling on unbind Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 099/114] serial: omap: suspend device on probe errors Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 100/114] tty: pty: Fix ldisc flush after userspace become aware of the data already Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 101/114] tty: pl011: use "qdf2400_e44" as the earlycon name for QDF2400 E44 Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 102/114] Bluetooth: Fix user channel for 32bit userspace on 64bit kernel Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 103/114] Bluetooth: hci_bcm: add missing tty-device sanity check Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 104/114] Bluetooth: hci_intel: " Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 105/114] cgroup: fix spurious warnings on cgroup_is_dead() from cgroup_sk_alloc() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 106/114] libata: reject passthrough WRITE SAME requests Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 107/114] ipmi: Fix kernel panic at ipmi_ssif_thread() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 108/114] libnvdimm, region: fix flush hint detection crash Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 109/114] libnvdimm, pmem: fix a NULL pointer BUG in nd_pmem_notify Greg Kroah-Hartman
2017-05-18 10:47 ` [PATCH 4.11 110/114] libnvdimm: fix nvdimm_bus_lock() vs device_lock() ordering Greg Kroah-Hartman
2017-05-18 10:47 ` [PATCH 4.11 111/114] libnvdimm, pfn: fix npfns vs section alignment Greg Kroah-Hartman
2017-05-18 10:47 ` [PATCH 4.11 112/114] pstore: Fix flags to enable dumps on powerpc Greg Kroah-Hartman
2017-05-18 10:47 ` [PATCH 4.11 113/114] pstore: Use dynamic spinlock initializer Greg Kroah-Hartman
2017-05-18 10:47 ` [PATCH 4.11 114/114] pstore: Shut down worker when unregistering Greg Kroah-Hartman
2017-05-18 19:46 ` [PATCH 4.11 000/114] 4.11.2-stable review Shuah Khan
2017-05-18 20:47   ` Greg Kroah-Hartman
2017-05-19  1:10 ` Guenter Roeck
2017-05-19  5:37   ` Greg Kroah-Hartman

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=20170518103609.860045933@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).