summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_logging.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2019-10-07 21:22:12 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2019-10-07 21:22:12 +0200
commit736005dacae2ec9abbb2f57026a3b7917c1d09b4 (patch)
tree69dd22444c4e8f16a548d6327c75680d4f0af9e1 /drivers/scsi/scsi_logging.c
parent4af3204c43bb3e52a3340935193a6fdd9aeb0d31 (diff)
parentc61ebb668f2ce3c22d1cfe6df28bd3198eabbdd7 (diff)
Merge 4.4.196 into android-4.4-p
Changes in 4.4.196 video: ssd1307fb: Start page range at page_offset gpu: drm: radeon: Fix a possible null-pointer dereference in radeon_connector_set_property() ipmi_si: Only schedule continuously in the thread in maintenance mode clk: qoriq: Fix -Wunused-const-variable clk: sirf: Don't reference clk_init_data after registration powerpc/rtas: use device model APIs and serialization during LPM powerpc/futex: Fix warning: 'oldval' may be used uninitialized in this function powerpc/pseries/mobility: use cond_resched when updating device tree pinctrl: tegra: Fix write barrier placement in pmx_writel vfio_pci: Restore original state on release powerpc/64s/exception: machine check use correct cfar for late handler powerpc/pseries: correctly track irq state in default idle scsi: core: Reduce memory required for SCSI logging mfd: intel-lpss: Remove D3cold delay ARM: 8898/1: mm: Don't treat faults reported from cache maintenance as writes HID: apple: Fix stuck function keys when using FN security: smack: Fix possible null-pointer dereferences in smack_socket_sock_rcv_skb() fat: work around race with userspace's read via blockdev while mounting hypfs: Fix error number left in struct pointer member ocfs2: wait for recovering done after direct unlock request kmemleak: increase DEBUG_KMEMLEAK_EARLY_LOG_SIZE default to 16K ANDROID: binder: remove waitqueue when thread exits. ANDROID: binder: synchronize_rcu() when using POLLFREE. hso: fix NULL-deref on tty open ipv6: drop incoming packets having a v4mapped source address net: ipv4: avoid mixed n_redirects and rate_tokens usage net: qlogic: Fix memory leak in ql_alloc_large_buffers nfc: fix memory leak in llcp_sock_bind() sch_dsmark: fix potential NULL deref in dsmark_init() xen-netfront: do not use ~0U as error return value for xennet_fill_frags() net/rds: Fix error handling in rds_ib_add_one() sch_cbq: validate TCA_CBQ_WRROPT to avoid crash Smack: Don't ignore other bprm->unsafe flags if LSM_UNSAFE_PTRACE is set smack: use GFP_NOFS while holding inode_smack::smk_lock NFC: fix attrs checks in netlink interface Linux 4.4.196 Change-Id: I7e03bb3ca1865988df014b8e38336b76430842a9 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/scsi/scsi_logging.c')
-rw-r--r--drivers/scsi/scsi_logging.c48
1 files changed, 3 insertions, 45 deletions
diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c
index bd70339c1242..03d9855a6afd 100644
--- a/drivers/scsi/scsi_logging.c
+++ b/drivers/scsi/scsi_logging.c
@@ -16,57 +16,15 @@
#include <scsi/scsi_eh.h>
#include <scsi/scsi_dbg.h>
-#define SCSI_LOG_SPOOLSIZE 4096
-
-#if (SCSI_LOG_SPOOLSIZE / SCSI_LOG_BUFSIZE) > BITS_PER_LONG
-#warning SCSI logging bitmask too large
-#endif
-
-struct scsi_log_buf {
- char buffer[SCSI_LOG_SPOOLSIZE];
- unsigned long map;
-};
-
-static DEFINE_PER_CPU(struct scsi_log_buf, scsi_format_log);
-
static char *scsi_log_reserve_buffer(size_t *len)
{
- struct scsi_log_buf *buf;
- unsigned long map_bits = sizeof(buf->buffer) / SCSI_LOG_BUFSIZE;
- unsigned long idx = 0;
-
- preempt_disable();
- buf = this_cpu_ptr(&scsi_format_log);
- idx = find_first_zero_bit(&buf->map, map_bits);
- if (likely(idx < map_bits)) {
- while (test_and_set_bit(idx, &buf->map)) {
- idx = find_next_zero_bit(&buf->map, map_bits, idx);
- if (idx >= map_bits)
- break;
- }
- }
- if (WARN_ON(idx >= map_bits)) {
- preempt_enable();
- return NULL;
- }
- *len = SCSI_LOG_BUFSIZE;
- return buf->buffer + idx * SCSI_LOG_BUFSIZE;
+ *len = 128;
+ return kmalloc(*len, GFP_ATOMIC);
}
static void scsi_log_release_buffer(char *bufptr)
{
- struct scsi_log_buf *buf;
- unsigned long idx;
- int ret;
-
- buf = this_cpu_ptr(&scsi_format_log);
- if (bufptr >= buf->buffer &&
- bufptr < buf->buffer + SCSI_LOG_SPOOLSIZE) {
- idx = (bufptr - buf->buffer) / SCSI_LOG_BUFSIZE;
- ret = test_and_clear_bit(idx, &buf->map);
- WARN_ON(!ret);
- }
- preempt_enable();
+ kfree(bufptr);
}
static inline const char *scmd_name(const struct scsi_cmnd *scmd)