diff --git a/scripts/kernel-functions b/scripts/kernel-functions index 95b93044f..59f675f68 100644 --- a/scripts/kernel-functions +++ b/scripts/kernel-functions @@ -321,7 +321,7 @@ index d6d65537b0d9..6aad8308a0ac 100644 EOF fi case "$1" in - 3.[0-9].*|3.1[01345].*|3.17.*|3.19.*|4.[023567].*) + 2.6.3[6-9]*|3.[0-9].*|3.1[01345].*|3.17.*|3.19.*|4.[023567].*) patch -p1 <<'EOF' From c6a385539175ebc603da53aafb7753d39089f32e Mon Sep 17 00:00:00 2001 From: Borislav Petkov @@ -383,6 +383,30 @@ index 0ed6ce300543..c324b43712f0 100644 KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds +EOF + ;; + 2.6.3[1-5]*) + patch -p1 <<'EOF' +diff --git a/Makefile b/Makefile +index 141da26fda4b..343ec388ae2e 100644 +--- a/Makefile ++++ b/Makefile +@@ -349,12 +349,13 @@ LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include -Iinclude \ + + KBUILD_CPPFLAGS := -D__KERNEL__ + +-KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ ++KBUILD_CFLAGS := $(call cc-option,-fno-PIE) \ ++ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ + -fno-strict-aliasing -fno-common \ + -Werror-implicit-function-declaration \ + -Wno-format-security \ + -fno-delete-null-pointer-checks +-KBUILD_AFLAGS := -D__ASSEMBLY__ ++KBUILD_AFLAGS := -D__ASSEMBLY__ $(call cc-option,-fno-PIE) + + # Read KERNELRELEASE from include/config/kernel.release (if it exists) + KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) EOF ;; esac diff --git a/scst/include/scst.h b/scst/include/scst.h index 0bc6d71de..a3f608932 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -2627,7 +2627,6 @@ struct scst_mgmt_cmd { unsigned int needs_unblocking:1; unsigned int lun_set:1; /* set, if lun field is valid */ unsigned int cmd_sn_set:1; /* set, if cmd_sn field is valid */ - unsigned int scst_get_called:1; /* set, if scst_get() was called */ /* Set if dev handler's task_mgmt_fn_received was called */ unsigned int task_mgmt_fn_received_called:1; unsigned int mcmd_dropped:1; /* set if mcmd was dropped */ diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 0220c4c42..877b4e893 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -7338,11 +7338,10 @@ static void scst_destroy_cmd(struct scst_cmd *cmd) scst_sess_put(cmd->sess); - /* - * At this point tgt_dev can be dead, but the pointer remains non-NULL - */ - if (likely(cmd->tgt_dev != NULL)) + if (likely(cmd->cpu_cmd_counter)) { scst_put(cmd->cpu_cmd_counter); + cmd->cpu_cmd_counter = NULL; + } EXTRACHECKS_BUG_ON(cmd->pre_alloced && cmd->internal); @@ -7582,8 +7581,10 @@ void scst_free_mgmt_cmd(struct scst_mgmt_cmd *mcmd) scst_sess_put(mcmd->sess); - if ((mcmd->mcmd_tgt_dev != NULL) || mcmd->scst_get_called) + if (mcmd->cpu_cmd_counter) { scst_put(mcmd->cpu_cmd_counter); + mcmd->cpu_cmd_counter = NULL; + } mempool_free(mcmd, scst_mgmt_mempool); diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 741d82a98..e883a09e5 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -5023,9 +5023,11 @@ static int scst_translate_lun(struct scst_cmd *cmd) scst_event_queue_lun_not_found(cmd); } scst_put(cmd->cpu_cmd_counter); + cmd->cpu_cmd_counter = NULL; } } else { scst_put(cmd->cpu_cmd_counter); + cmd->cpu_cmd_counter = NULL; TRACE_MGMT_DBG("%s", "FLAG SUSPENDED set, skipping"); res = 1; } @@ -5831,6 +5833,7 @@ static int scst_get_mgmt(struct scst_mgmt_cmd *mcmd) if (unlikely(test_bit(SCST_FLAG_SUSPENDED, &scst_flags) && !test_bit(SCST_FLAG_SUSPENDING, &scst_flags))) { scst_put(mcmd->cpu_cmd_counter); + mcmd->cpu_cmd_counter = NULL; TRACE_MGMT_DBG("%s", "FLAG SUSPENDED set, skipping"); res = 1; goto out; @@ -5870,6 +5873,7 @@ static int scst_mgmt_translate_lun(struct scst_mgmt_cmd *mcmd) res = 0; } else { scst_put(mcmd->cpu_cmd_counter); + mcmd->cpu_cmd_counter = NULL; res = -1; } @@ -6718,7 +6722,6 @@ static int scst_mgmt_cmd_init(struct scst_mgmt_cmd *mcmd) rc = scst_get_mgmt(mcmd); if (rc == 0) { mcmd->state = SCST_MCMD_STATE_EXEC; - mcmd->scst_get_called = 1; } else { EXTRACHECKS_BUG_ON(rc < 0); res = rc;