* [PATCH] scsi: mpt3sas: Do not use GFP_KERNEL in atomic context
@ 2021-02-20 9:39 Christophe JAILLET
2021-03-19 3:45 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2021-02-20 9:39 UTC (permalink / raw)
To: sathya.prakash, sreekanth.reddy, suganath-prabu.subramani, jejb,
martin.petersen, linux-scsi
Cc: MPT-FusionLinux.pdl, linux-kernel, kernel-janitors, Christophe JAILLET
'mpt3sas_get_port_by_id()' can be called when a spinlock is hold. So use
GFP_ATOMIC instead of GFP_KERNEL when allocating memory.
Issue spotted by call_kern.cocci:
./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 7125 inside lock on line 7123 but uses GFP_KERNEL
./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 6842 inside lock on line 6839 but uses GFP_KERNEL
./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 6854 inside lock on line 6851 but uses GFP_KERNEL
./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 7706 inside lock on line 7702 but uses GFP_KERNEL
./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 10260 inside lock on line 10256 but uses GFP_KERNEL
Fixes: 324c122fc0a4 ("scsi: mpt3sas: Add module parameter multipath_on_hba")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index ffca03064797..6aa6de729187 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -413,7 +413,7 @@ mpt3sas_get_port_by_id(struct MPT3SAS_ADAPTER *ioc,
* And add this object to port_table_list.
*/
if (!ioc->multipath_on_hba) {
- port = kzalloc(sizeof(struct hba_port), GFP_KERNEL);
+ port = kzalloc(sizeof(struct hba_port), GFP_ATOMIC);
if (!port)
return NULL;
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: mpt3sas: Do not use GFP_KERNEL in atomic context
2021-02-20 9:39 [PATCH] scsi: mpt3sas: Do not use GFP_KERNEL in atomic context Christophe JAILLET
@ 2021-03-19 3:45 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2021-03-19 3:45 UTC (permalink / raw)
To: linux-scsi, jejb, sathya.prakash, Christophe JAILLET,
suganath-prabu.subramani, sreekanth.reddy
Cc: Martin K . Petersen, linux-kernel, kernel-janitors, MPT-FusionLinux.pdl
On Sat, 20 Feb 2021 10:39:51 +0100, Christophe JAILLET wrote:
> 'mpt3sas_get_port_by_id()' can be called when a spinlock is hold. So use
> GFP_ATOMIC instead of GFP_KERNEL when allocating memory.
>
> Issue spotted by call_kern.cocci:
> ./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 7125 inside lock on line 7123 but uses GFP_KERNEL
> ./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 6842 inside lock on line 6839 but uses GFP_KERNEL
> ./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 6854 inside lock on line 6851 but uses GFP_KERNEL
> ./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 7706 inside lock on line 7702 but uses GFP_KERNEL
> ./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 10260 inside lock on line 10256 but uses GFP_KERNEL
Applied to 5.12/scsi-fixes, thanks!
[1/1] scsi: mpt3sas: Do not use GFP_KERNEL in atomic context
https://git.kernel.org/mkp/scsi/c/a50bd6461690
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-19 3:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-20 9:39 [PATCH] scsi: mpt3sas: Do not use GFP_KERNEL in atomic context Christophe JAILLET
2021-03-19 3:45 ` Martin K. Petersen
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).