ata fixes for 6.12-rc1

- Fix a NULL pointer dereference introduced by the recent cleanups of
    the command duration limits feature handling (from me)
 
  - Fix incorrect generation of the mode sense data for the
    ALL_SUB_MPAGES page (from me)
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQSRPv8tYSvhwAzJdzjdoc3SxdoYdgUCZvajtgAKCRDdoc3SxdoY
 dsmNAPsF4O+6lri5SVPasNa0d96AOKdqdHI3bsqMo2tEWZNIswEA78F15giSxZOe
 uEJyleGRhZ5PZIh0aY8MLrfAxJejFgI=
 =HF/z
 -----END PGP SIGNATURE-----

Merge tag 'ata-6.12-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux

Pull ata fixes from Damien Le Moal:

 - Fix a NULL pointer dereference introduced by the recent cleanups of
   the command duration limits feature handling (me)

 - Fix incorrect generation of the mode sense data for the
   ALL_SUB_MPAGES page (me)

* tag 'ata-6.12-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux:
  ata: libata-scsi: Fix ata_msense_control() CDL page reporting
  ata: libata-scsi: Fix ata_msense_control_spgt2()
This commit is contained in:
Linus Torvalds 2024-09-27 09:05:18 -07:00
commit b6c49fca9f

View File

@ -2256,10 +2256,15 @@ static inline u16 ata_xlat_cdl_limit(u8 *buf)
static unsigned int ata_msense_control_spgt2(struct ata_device *dev, u8 *buf,
u8 spg)
{
u8 *b, *cdl = dev->cdl->desc_log_buf, *desc;
u8 *b, *cdl, *desc;
u32 policy;
int i;
if (!(dev->flags & ATA_DFLAG_CDL) || !dev->cdl)
return 0;
cdl = dev->cdl->desc_log_buf;
/*
* Fill the subpage. The first four bytes of the T2A/T2B mode pages
* are a header. The PAGE LENGTH field is the size of the page
@ -2356,7 +2361,7 @@ static unsigned int ata_msense_control(struct ata_device *dev, u8 *buf,
case ALL_SUB_MPAGES:
n = ata_msense_control_spg0(dev, buf, changeable);
n += ata_msense_control_spgt2(dev, buf + n, CDL_T2A_SUB_MPAGE);
n += ata_msense_control_spgt2(dev, buf + n, CDL_T2A_SUB_MPAGE);
n += ata_msense_control_spgt2(dev, buf + n, CDL_T2B_SUB_MPAGE);
n += ata_msense_control_ata_feature(dev, buf + n);
return n;
default: