Chen Zhongjin
038359eecc
scsi: efct: Fix possible memleak in efct_device_init()
...
[ Upstream commit bb0cd225dd37df1f4a22e36dad59ff33178ecdfc ]
In efct_device_init(), when efct_scsi_reg_fc_transport() fails,
efct_scsi_tgt_driver_exit() is not called to release memory for
efct_scsi_tgt_driver_init() and causes memleak:
unreferenced object 0xffff8881020ce000 (size 2048):
comm "modprobe", pid 465, jiffies 4294928222 (age 55.872s)
backtrace:
[<0000000021a1ef1b>] kmalloc_trace+0x27/0x110
[<000000004c3ed51c>] target_register_template+0x4fd/0x7b0 [target_core_mod]
[<00000000f3393296>] efct_scsi_tgt_driver_init+0x18/0x50 [efct]
[<00000000115de533>] 0xffffffffc0d90011
[<00000000d608f646>] do_one_initcall+0xd0/0x4e0
[<0000000067828cf1>] do_init_module+0x1cc/0x6a0
...
Fixes: 4df84e8466 ("scsi: elx: efct: Driver initialization routines")
Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com >
Link: https://lore.kernel.org/r/20221111074046.57061-1-chenzhongjin@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2022-12-31 13:14:25 +01:00
Dan Carpenter
a013c71c63
scsi: elx: efct: Delete stray unlock statement
...
It's not holding the lock at this stage and the IRQ "flags" are not correct
so it would restore something bogus. Delete the unlock statement.
Link: https://lore.kernel.org/r/20211004103851.GE25015@kili
Fixes: 3e6414003b ("scsi: elx: efct: SCSI I/O handling routines")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-10-04 23:33:31 -04:00
James Smart
450907424d
scsi: elx: efct: Do not hold lock while calling fc_vport_terminate()
...
Smatch checker reported the following error:
drivers/base/power/sysfs.c:833 dpm_sysfs_remove()
warn: sleeping in atomic context
With a calling sequence of:
efct_lio_npiv_drop_nport() <- disables preempt
-> fc_vport_terminate()
-> device_del()
-> dpm_sysfs_remove()
Issue is efct_lio_npiv_drop_nport() is making the fc_vport_terminate() call
while holding a lock w/ ipl raised.
It is unnecessary to hold the lock over this call, shift where the lock is
taken.
Link: https://lore.kernel.org/r/20210907165225.10821-1-jsmart2021@gmail.com
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-09-13 22:15:46 -04:00
Linus Torvalds
b250e6d141
Merge tag 'kbuild-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
...
Pull Kbuild updates from Masahiro Yamada:
- Add -s option (strict mode) to merge_config.sh to make it fail when
any symbol is redefined.
- Show a warning if a different compiler is used for building external
modules.
- Infer --target from ARCH for CC=clang to let you cross-compile the
kernel without CROSS_COMPILE.
- Make the integrated assembler default (LLVM_IAS=1) for CC=clang.
- Add <linux/stdarg.h> to the kernel source instead of borrowing
<stdarg.h> from the compiler.
- Add Nick Desaulniers as a Kbuild reviewer.
- Drop stale cc-option tests.
- Fix the combination of CONFIG_TRIM_UNUSED_KSYMS and CONFIG_LTO_CLANG
to handle symbols in inline assembly.
- Show a warning if 'FORCE' is missing for if_changed rules.
- Various cleanups
* tag 'kbuild-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (39 commits)
kbuild: redo fake deps at include/ksym/*.h
kbuild: clean up objtool_args slightly
modpost: get the *.mod file path more simply
checkkconfigsymbols.py: Fix the '--ignore' option
kbuild: merge vmlinux_link() between ARCH=um and other architectures
kbuild: do not remove 'linux' link in scripts/link-vmlinux.sh
kbuild: merge vmlinux_link() between the ordinary link and Clang LTO
kbuild: remove stale *.symversions
kbuild: remove unused quiet_cmd_update_lto_symversions
gen_compile_commands: extract compiler command from a series of commands
x86: remove cc-option-yn test for -mtune=
arc: replace cc-option-yn uses with cc-option
s390: replace cc-option-yn uses with cc-option
ia64: move core-y in arch/ia64/Makefile to arch/ia64/Kbuild
sparc: move the install rule to arch/sparc/Makefile
security: remove unneeded subdir-$(CONFIG_...)
kbuild: sh: remove unused install script
kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y
kbuild: Switch to 'f' variants of integrated assembler flag
kbuild: Shuffle blank line to improve comment meaning
...
2021-09-03 15:33:47 -07:00
Alexey Dobriyan
39f75da7bc
isystem: trim/fixup stdarg.h and other headers
...
Delete/fixup few includes in anticipation of global -isystem compile
option removal.
Note: crypto/aegis128-neon-inner.c keeps <stddef.h> due to redefinition
of uintptr_t error (one definition comes from <stddef.h>, another from
<linux/types.h>).
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com >
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org >
2021-08-19 09:02:55 +09:00
Colin Ian King
e71dd41ea0
scsi: elx: efct: Remove redundant initialization of variable 'ret'
...
The variable 'ret' is being initialized with a value that is never read, it
is being updated later on. The assignment is redundant and can be removed.
Link: https://lore.kernel.org/r/20210804132451.113086-1-colin.king@canonical.com
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
Addresses-Coverity: ("Unused value")
2021-08-09 23:41:19 -04:00
James Smart
f7c95d7460
scsi: elx: efct: Fix vport list linkage in LIO backend
...
vport is linked onto the driver's vport list at allocation, but failure
path fails to remove it from the list.
Change location of linkage until after complete vport completion.
Link: https://lore.kernel.org/r/20210619155729.20049-1-jsmart2021@gmail.com
Fixes: 692e5d73a8 ("scsi: elx: efct: LIO backend interface routines")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <james.smart@broadcom.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-22 21:11:37 -04:00
James Smart
ae3272ec5e
scsi: elx: efct: Fix pointer error checking in debugfs init
...
debugfs_create_xxx routines, which return pointers, are being checked for
error by looking for NULL values. The routines may return pointer-munged
-Exxx codes, so they should be using IS_ERR() to adapt.
There are two cases:
- The first case is on initial directory creation, which actually doesn't
need to be checked. So remove the check.
- Creation of the sessions subdirectory. Modify this creation to create
under the initial directory created, and fix failure check.
Link: https://lore.kernel.org/r/20210618233004.83769-1-jsmart2021@gmail.com
Fixes: 4df84e8466 ("scsi: elx: efct: Driver initialization routines")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-18 23:01:04 -04:00
James Smart
ca7f33c6b4
scsi: elx: efct: Fix is_originator return code type
...
efct_hw_iotype_is_originator() is returning a negative (-EIO) status which
doesn't make sense for a u8 function type.
Reviewing the code, the function only needs to return true/false, thus a
bool status is most appropriate.
Change the function return type and patch up the one callee as the bool
inverses the if check.
Link: https://lore.kernel.org/r/20210618231524.83179-1-jsmart2021@gmail.com
Fixes: 4df84e8466 ("scsi: elx: efct: Driver initialization routines")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-18 23:01:04 -04:00
James Smart
d66a65b7f5
scsi: elx: efct: Fix link error for _bad_cmpxchg
...
cmpxchg is being used on a bool type, which is requiring architecture
support that isn't compatible with a bool.
Convert variable abort_in_progress from bool to int.
Link: https://lore.kernel.org/r/20210618174050.80302-1-jsmart2021@gmail.com
Fixes: ebc076b3ed ("scsi: elx: efct: Tie into kernel Kconfig and build process")
Reported-by: kernel test robot <lkp@intel.com >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-18 23:01:04 -04:00
Nathan Chancellor
0d7be7a8a0
scsi: elx: efct: Eliminate unnecessary boolean check in efct_hw_command_cancel()
...
clang warns:
drivers/scsi/elx/efct/efct_hw.c:1523:17: warning: address of array
'ctx->buf' will always evaluate to 'true' [-Wpointer-bool-conversion]
(!ctx->buf ? U32_MAX : *((u32 *)ctx->buf)));
~~~~~~^~~
buf is an array in the middle of a struct so deferencing it is not a
problem as long as ctx is not NULL. Eliminate the check, which fixes the
warning.
Link: https://github.com/ClangBuiltLinux/linux/issues/1398
Link: https://lore.kernel.org/r/20210617063123.21239-1-nathan@kernel.org
Fixes: 580c0255e4 ("scsi: elx: efct: RQ buffer, memory pool allocation and deallocation APIs")
Reviewed-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Nathan Chancellor <nathan@kernel.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-18 23:01:04 -04:00
Nathan Chancellor
a255036178
scsi: elx: efct: Do not use id uninitialized in efct_lio_setup_session()
...
clang warns:
drivers/scsi/elx/efct/efct_lio.c:1216:24: warning: variable 'id' is
uninitialized when used here [-Wuninitialized]
se_sess, node, id);
^~
Shuffle the debug print after id's initialization so that the actual value
is printed.
Link: https://github.com/ClangBuiltLinux/linux/issues/1397
Link: https://lore.kernel.org/r/20210617061721.2405511-1-nathan@kernel.org
Fixes: 692e5d73a8 ("scsi: elx: efct: LIO backend interface routines")
Reviewed-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Nathan Chancellor <nathan@kernel.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-18 23:01:04 -04:00
Wei Yongjun
41962aba2d
scsi: elx: efct: Fix error handling in efct_hw_init()
...
Fix to return negative error code -ENOMEM from the error handling case
instead of 0. Also fix typo in error message.
Link: https://lore.kernel.org/r/20210617024837.1023069-1-weiyongjun1@huawei.com
Fixes: 4df84e8466 ("scsi: elx: efct: Driver initialization routines")
Reported-by: Hulk Robot <hulkci@huawei.com >
Reviewed-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-18 23:01:03 -04:00
Colin Ian King
61bf3fdb5d
scsi: elx: efct: Remove redundant initialization of variable lun
...
The variable "lun" is being initialized with a value that is never read, it
is being updated later on. The assignment is redundant and can be removed.
Link: https://lore.kernel.org/r/20210616171621.16176-1-colin.king@canonical.com
Reviewed-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
Addresses-Coverity: ("Unused value")
2021-06-18 23:01:03 -04:00
Colin Ian King
5911429343
scsi: elx: efct: Fix spelling mistake "Unexected" -> "Unexpected"
...
There is a spelling mistake in a efc_log_info message. Fix it.
Link: https://lore.kernel.org/r/20210616142637.12706-1-colin.king@canonical.com
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-18 23:01:03 -04:00
James Smart
32ddbad5b6
scsi: elx: efct: Transport class host interface support
...
Integration with the scsi_fc_transport host interfaces.
Link: https://lore.kernel.org/r/20210601235512.20104-30-jsmart2021@gmail.com
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:32 -04:00
James Smart
ab332fcbcd
scsi: elx: efct: Transport and hardware teardown routines
...
Implement routines to detach transport and hardware objects.
Link: https://lore.kernel.org/r/20210601235512.20104-29-jsmart2021@gmail.com
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:32 -04:00
James Smart
6ae7147bfe
scsi: elx: efct: Link and host statistics
...
Add routines to retrieve link stats and host stats, add firmware update
helper routines.
Link: https://lore.kernel.org/r/20210601235512.20104-28-jsmart2021@gmail.com
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:32 -04:00
James Smart
dd53d333aa
scsi: elx: efct: Hardware I/O submission routines
...
Routines that write I/O to work queue, send SRRs and raw frames.
Link: https://lore.kernel.org/r/20210601235512.20104-27-jsmart2021@gmail.com
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:32 -04:00
James Smart
692e5d73a8
scsi: elx: efct: LIO backend interface routines
...
Add LIO backend template registration and template functions.
Link: https://lore.kernel.org/r/20210601235512.20104-26-jsmart2021@gmail.com
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:32 -04:00
James Smart
3e6414003b
scsi: elx: efct: SCSI I/O handling routines
...
Routines for SCSI transport IO alloc, build and send I/O.
Link: https://lore.kernel.org/r/20210601235512.20104-25-jsmart2021@gmail.com
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:32 -04:00
James Smart
f45ae6aac0
scsi: elx: efct: Unsolicited FC frame processing routines
...
Add routines to handle unsolicited FC frames.
Link: https://lore.kernel.org/r/20210601235512.20104-24-jsmart2021@gmail.com
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:32 -04:00
James Smart
e2cf422ba8
scsi: elx: efct: Hardware queues processing
...
Add driver definitions for:
- Routines for EQ, CQ, WQ and RQ processing.
- Routines for I/O object pool allocation and deallocation.
Link: https://lore.kernel.org/r/20210601235512.20104-23-jsmart2021@gmail.com
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:31 -04:00
James Smart
63de51327a
scsi: elx: efct: Hardware I/O and SGL initialization
...
Add driver definitions for:
- Routines to create I/O interfaces (wqs, etc), SGL initialization, and
configure hardware features.
Link: https://lore.kernel.org/r/20210601235512.20104-22-jsmart2021@gmail.com
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:31 -04:00
James Smart
580c0255e4
scsi: elx: efct: RQ buffer, memory pool allocation and deallocation APIs
...
Add driver definitions for:
- RQ data buffer allocation and deallocate.
- Memory pool allocation and deallocation APIs.
- Mailbox command submission and completion routines.
Link: https://lore.kernel.org/r/20210601235512.20104-21-jsmart2021@gmail.com
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:31 -04:00
James Smart
e10fc23359
scsi: elx: efct: Hardware queue creation and deletion
...
Add routines for queue creation, deletion, and configuration.
Link: https://lore.kernel.org/r/20210601235512.20104-20-jsmart2021@gmail.com
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:31 -04:00
James Smart
4df84e8466
scsi: elx: efct: Driver initialization routines
...
Add driver definitions for:
- Emulex FC Target driver init, attach and hardware setup routines.
Link: https://lore.kernel.org/r/20210601235512.20104-19-jsmart2021@gmail.com
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:31 -04:00
James Smart
75a10a7a91
scsi: elx: efct: Data structures and defines for hw operations
...
Start the population of the efct target mode driver. The driver is
contained in the drivers/scsi/elx/efct subdirectory.
Create the efct directory and start population of the driver by adding
SLI-4 configuration parameters, data structures for configuring SLI-4
queues, converting from OS to SLI-4 IO requests, and handling async events.
Link: https://lore.kernel.org/r/20210601235512.20104-18-jsmart2021@gmail.com
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Daniel Wagner <dwagner@suse.de >
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2021-06-15 23:39:31 -04:00