From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Mike Snitzer <snitzer@redhat.com>, Jens Axboe <axboe@fb.com>,
Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 3.16.y-ckt 034/118] bio integrity: do not assume bio_integrity_pool exists if bioset exists
Date: Wed, 12 Aug 2015 09:55:36 +0100 [thread overview]
Message-ID: <1439369820-27005-35-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1439369820-27005-1-git-send-email-luis.henriques@canonical.com>
3.16.7-ckt16 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <snitzer@redhat.com>
commit bb8bd38b9a1685334b73e8c62e128cbedb875867 upstream.
bio_integrity_alloc() and bio_integrity_free() assume that if a bio was
allocated from a bioset that that bioset also had its bio_integrity_pool
allocated using bioset_integrity_create(). This is a very bad
assumption given that bioset_create() and bioset_integrity_create() are
completely disjoint. Not all callers of bioset_create() have been
trained to also call bioset_integrity_create() -- and they may not care
to be.
Fix this by falling back to kmalloc'ing 'struct bio_integrity_payload'
rather than force all bioset consumers to (wastefully) preallocate a
bio_integrity_pool that they very likely won't actually need (given the
niche nature of the current block integrity support).
Otherwise, a NULL pointer "Kernel BUG" with a trace like the following
will be observed (as seen on s390x using zfcp storage) because dm-io
doesn't use bioset_integrity_create() when creating its bioset:
[ 791.643338] Call Trace:
[ 791.643339] ([<00000003df98b848>] 0x3df98b848)
[ 791.643341] [<00000000002c5de8>] bio_integrity_alloc+0x48/0xf8
[ 791.643348] [<00000000002c6486>] bio_integrity_prep+0xae/0x2f0
[ 791.643349] [<0000000000371e38>] blk_queue_bio+0x1c8/0x3d8
[ 791.643355] [<000000000036f8d0>] generic_make_request+0xc0/0x100
[ 791.643357] [<000000000036f9b2>] submit_bio+0xa2/0x198
[ 791.643406] [<000003ff801f9774>] dispatch_io+0x15c/0x3b0 [dm_mod]
[ 791.643419] [<000003ff801f9b3e>] dm_io+0x176/0x2f0 [dm_mod]
[ 791.643423] [<000003ff8074b28a>] do_reads+0x13a/0x1a8 [dm_mirror]
[ 791.643425] [<000003ff8074b43a>] do_mirror+0x142/0x298 [dm_mirror]
[ 791.643428] [<0000000000154fca>] process_one_work+0x18a/0x3f8
[ 791.643432] [<000000000015598a>] worker_thread+0x132/0x3b0
[ 791.643435] [<000000000015d49a>] kthread+0xd2/0xd8
[ 791.643438] [<00000000005bc0ca>] kernel_thread_starter+0x6/0xc
[ 791.643446] [<00000000005bc0c4>] kernel_thread_starter+0x0/0xc
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
block/bio-integrity.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 9e241063a616..f56d85b6c5e3 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -51,7 +51,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
unsigned long idx = BIO_POOL_NONE;
unsigned inline_vecs;
- if (!bs) {
+ if (!bs || !bs->bio_integrity_pool) {
bip = kmalloc(sizeof(struct bio_integrity_payload) +
sizeof(struct bio_vec) * nr_vecs, gfp_mask);
inline_vecs = nr_vecs;
@@ -100,7 +100,7 @@ void bio_integrity_free(struct bio *bio)
if (bip->bip_owns_buf)
kfree(bip->bip_buf);
- if (bs) {
+ if (bs && bs->bio_integrity_pool) {
if (bip->bip_slab != BIO_POOL_NONE)
bvec_free(bs->bvec_integrity_pool, bip->bip_vec,
bip->bip_slab);
next prev parent reply other threads:[~2015-08-12 9:33 UTC|newest]
Thread overview: 119+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 8:55 [3.16.y-ckt stable] Linux 3.16.7-ckt16 stable review Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 001/118] netfilter: nfnetlink_cthelper: Remove 'const' and '&' to avoid warnings Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 002/118] Bluetooth: ath3k: Add a new ID 0cf3:e006 to ath3k list Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 003/118] Btrfs: use kmem_cache_free when freeing entry in inode cache Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 004/118] Btrfs: fix race between caching kthread and returning inode to " Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 005/118] Btrfs: fix fsync data loss after append write Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 006/118] ext4: fix reservation release on invalidatepage for delalloc fs Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 007/118] ext4: be more strict when migrating to non-extent based file Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 008/118] ext4: correctly migrate a file with a hole at the beginning Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 009/118] ext4: replace open coded nofail allocation in ext4_free_blocks() Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 010/118] drm/radeon: Handle irqs only based on irq ring, not irq status regs Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 011/118] drm/radeon: unpin cursor BOs on suspend and pin them again on resume (v2) Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 012/118] hpfs: kstrdup() out of memory handling Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 013/118] hpfs: hpfs_error: Remove static buffer, use vsprintf extension %pV instead Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 014/118] 9p: don't leave a half-initialized inode sitting around Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 015/118] MIPS: kernel: traps: Fix broken indentation Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 016/118] thermal: step_wise: fix: Prevent from binary overflow when trend is dropping Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 017/118] spi: pl022: Specify 'num-cs' property as required in devicetree binding Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 018/118] iio: twl4030-madc: Pass the IRQF_ONESHOT flag Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 019/118] iio: inv-mpu: Specify the expected format/precision for write channels Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 020/118] iio: DAC: ad5624r_spi: fix bit shift of output data value Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 021/118] iio: adc: at91_adc: allow to use full range of startup time Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 022/118] ALSA: usb-audio: Add MIDI support for Steinberg MI2/MI4 Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 023/118] iio: tmp006: Check channel info on write Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 024/118] dm btree remove: fix bug in redistribute3 Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 025/118] kbuild: Allow arch Makefiles to override {cpp,ld,c}flags Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 026/118] ARC: Override toplevel default -O2 with -O3 Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 027/118] crypto: omap-des - Fix unmapping of dma channels Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 028/118] USB: option: add 2020:4000 ID Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 029/118] USB: cp210x: add ID for Aruba Networks controllers Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 030/118] dm btree: silence lockdep lock inversion in dm_btree_del() Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 031/118] usb: musb: host: rely on port_mode to call musb_start() Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 032/118] usb: f_mass_storage: limit number of reported LUNs Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 033/118] drm: add a check for x/y in drm_mode_setcrtc Luis Henriques
2015-08-12 8:55 ` Luis Henriques [this message]
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 035/118] ARM: dts: mx23: fix iio-hwmon support Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 036/118] tracing: Have branch tracer use recursive field of task struct Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 037/118] drivers: net: cpsw: fix crash while accessing second slave ethernet interface Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 038/118] USB: serial: Destroy serial_minors IDR on module exit Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 039/118] Btrfs: fix memory leak in the extent_same ioctl Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 040/118] Btrfs: fix list transaction->pending_ordered corruption Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 041/118] can: rcar_can: fix IRQ check Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 042/118] ARC: make sure instruction_pointer() returns unsigned value Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 043/118] Btrfs: fix file corruption after cloning inline extents Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 044/118] st: null pointer dereference panic caused by use after kref_put by st_open Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 045/118] drm/radeon: add a dpm quirk for Sapphire Radeon R9 270X 2GB GDDR5 Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 046/118] drm/radeon: Don't flush the GART TLB if rdev->gart.ptr == NULL Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 047/118] genirq: Prevent resend to interrupts marked IRQ_NESTED_THREAD Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 048/118] x86/asm/entry/64: Fold the 'test_in_nmi' macro into its only user Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 049/118] x86/asm/entry/64: Remove a redundant jump Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 050/118] x86/nmi: Enable nested do_nmi() handling for 64-bit kernels Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 051/118] x86/nmi/64: Remove asm code that saves CR2 Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 052/118] x86/nmi/64: Switch stacks on userspace NMI entry Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 053/118] x86/nmi/64: Improve nested NMI comments Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 054/118] x86/nmi/64: Reorder nested NMI checks Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 055/118] x86/nmi/64: Use DF to avoid userspace RSP confusing nested NMI detection Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 056/118] ARM: 8404/1: dma-mapping: fix off-by-one error in bitmap size check Luis Henriques
2015-08-12 8:55 ` [PATCH 3.16.y-ckt 057/118] ipv6: Make MLD packets to only be processed locally Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 058/118] bridge: mdb: start delete timer for temp static entries Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 059/118] net: graceful exit from netif_alloc_netdev_queues() Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 060/118] ip_tunnel: fix ipv4 pmtu check to honor inner ip header df Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 061/118] bridge: mdb: zero out the local br_ip variable before use Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 062/118] net: do not process device backlog during unregistration Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 063/118] net: dsa: Test array index before use Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 064/118] net: dsa: Fix off-by-one in switch address parsing Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 065/118] can: rcar_can: print signed IRQ # Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 066/118] perf symbols: Store if there is a filter in place Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 067/118] perf hists browser: Take the --comm, --dsos, etc filters into account Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 068/118] rds: rds_ib_device.refcount overflow Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 069/118] KEYS: ensure we free the assoc array edit if edit is valid Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 070/118] mm: avoid setting up anonymous pages into file mapping Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 071/118] evm: labeling pseudo filesystems exception Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 072/118] USB: usbfs: allow URBs to be reaped after disconnection Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 073/118] sg_start_req(): make sure that there's not too many elements in iovec Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 074/118] HID: cp2112: fix to force single data-report reply Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 075/118] ata: pmp: add quirk for Marvell 4140 SATA PMP Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 076/118] libata: add ATA_HORKAGE_BROKEN_FPDMA_AA quirk for HP 250GB SATA disk VB0250EAVER Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 077/118] libata: add ATA_HORKAGE_NOTRIM Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 078/118] libata: force disable trim for SuperSSpeed S238 Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 079/118] libata: increase the timeout when setting transfer mode Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 080/118] can: mcp251x: fix resume when device is down Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 081/118] libata: Do not blacklist M510DC Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 082/118] mac80211: clear subdir_stations when removing debugfs Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 083/118] iio: adc: vf610: fix the adc register read fail issue Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 084/118] net: mvneta: fix refilling for Rx DMA buffers Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 085/118] ALSA: hda - Add new GPU codec ID 0x10de007d to snd-hda Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 086/118] xdrm/i915: Use two 32bit reads for select 64bit REG_READ ioctls Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 087/118] usb: dwc3: gadget: return error if command sent to DEPCMD register fails Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 088/118] usb: dwc3: Reset the transfer resource index on SET_INTERFACE Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 089/118] usb: xhci: Bugfix for NULL pointer deference in xhci_endpoint_init() function Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 090/118] xhci: Calculate old endpoints correctly on device reset Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 091/118] xhci: report U3 when link is in resume state Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 092/118] xhci: prevent bus_suspend if SS port resuming in phase 1 Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 093/118] xhci: do not report PLC when link is in internal resume state Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 094/118] usb: core: lpm: set lpm_capable for root hub device Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 095/118] USB: OHCI: Fix race between ED unlink and URB submission Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 096/118] usb-storage: ignore ZTE MF 823 card reader in mode 0x1225 Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 097/118] blkcg: fix gendisk reference leak in blkg_conf_prep() Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 098/118] tile: use free_bootmem_late() for initrd Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 099/118] Input: usbtouchscreen - avoid unresponsive TSC-30 touch screen Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 100/118] block: Do a full clone when splitting discard bios Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 101/118] md/raid1: fix test for 'was read error from last working device' Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 102/118] mmc: omap_hsmmc: Fix DTO and DCRC handling Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 103/118] mtd: nand: Fix NAND_USE_BOUNCE_BUFFER flag conflict Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 104/118] net/xen-netback: off by one in BUG_ON() condition Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 105/118] bridge: mdb: fix double add notification Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 106/118] isdn/gigaset: reset tty->receive_room when attaching ser_gigaset Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 107/118] usb: gadget: mv_udc_core: fix phy_regs I/O memory leak Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 108/118] bonding: fix destruction of bond with devices different from arphrd_ether Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 109/118] bonding: correctly handle bonding type change on enslave failure Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 110/118] inet: frags: fix defragmented packet's IP header for af_packet Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 111/118] mmc: block: Add missing mmc_blk_put() in power_ro_lock_show() Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 112/118] mmc: sdhci-esdhc: Make 8BIT bus work Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 113/118] mmc: sdhci-pxav3: fix platform_data is not initialized Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 114/118] freeing unlinked file indefinitely delayed Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 115/118] s390/sclp: clear upper register halves in _sclp_print_early Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 116/118] s390/process: fix sfpc inline assembly Luis Henriques
2015-08-12 8:56 ` [PATCH 3.16.y-ckt 117/118] mmc: sdhci: Fix FSL ESDHC reset handling quirk Luis Henriques
2015-08-12 8:57 ` [PATCH 3.16.y-ckt 118/118] md: fix a build warning Luis Henriques
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=1439369820-27005-35-git-send-email-luis.henriques@canonical.com \
--to=luis.henriques@canonical.com \
--cc=axboe@fb.com \
--cc=kernel-team@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@redhat.com \
--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
all inboxes | Powered by JetHome®