Commit 03a9cfc
committed
ata: libata-scsi: Fix ata_msense_control_spgt2()
ata_msense_control_spgt2() can be called even for devices that do not
support CDL when the user requests the ALL_SUB_MPAGES mode sense page,
but for such device, this will cause a NULL pointer dereference as
dev->cdl is NULL. Similarly, we should not return any data if
ata_msense_control_spgt2() is called when the user requested the
CDL_T2A_SUB_MPAGE or CDL_T2B_SUB_MPAGE pages for a device that does not
support CDL.
Avoid this potential NULL pointer dereference by checking if the device
support CDL on entry to ata_msense_control_spgt2() and return 0 if it
does not support CDL.
Reported-by: [email protected]
Tested-by: [email protected]
Fixes: 602bcf2 ("ata: libata: Improve CDL resource management")
Signed-off-by: Damien Le Moal <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>1 parent e5dd410 commit 03a9cfc
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2245 | 2245 | | |
2246 | 2246 | | |
2247 | 2247 | | |
2248 | | - | |
| 2248 | + | |
2249 | 2249 | | |
2250 | 2250 | | |
2251 | 2251 | | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
2252 | 2257 | | |
2253 | 2258 | | |
2254 | 2259 | | |
| |||
0 commit comments