Skip to content

Commit f7a1d00

Browse files
committed
Merge tag 'ata-5.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata
Pull ATA fixes from Damien Le Moal: "Several small fixes for rc2: - Remove unused field in struct ata_port (Hannes) - Fix a potential (very unlikely) NULL pointer dereference in ata_host_alloc_pinfo() (Sergey) - Fix a device reference leak in the pata_octeon_cf driver (Miaoqian) - Fixes for handling access to the concurrent positioning ranges log page used with multi-actuator HDDs (Tyler) - Fix the values shown by the pio_mode and dma_mode sysfs device attributes (Sergey) - Update the MAINTAINERS file to add libata sysfs ABI documentation file (Sergey)" * tag 'ata-5.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata: MAINTAINERS: add ATA sysfs file documentation to libata entry ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files libata: fix translation of concurrent positioning ranges libata: fix reading concurrent positioning ranges log ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe ata: libata-core: fix NULL pointer deref in ata_host_alloc_pinfo() ata: libata: drop 'sas_last_tag'
2 parents 8f7ac50 + 481f701 commit f7a1d00

File tree

7 files changed

+27
-18
lines changed

7 files changed

+27
-18
lines changed

Documentation/ABI/testing/sysfs-ata

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,14 @@ Description:
107107
described in ATA8 7.16 and 7.17. Only valid if
108108
the device is not a PM.
109109

110-
pio_mode: (RO) Transfer modes supported by the device when
111-
in PIO mode. Mostly used by PATA device.
110+
pio_mode: (RO) PIO transfer mode used by the device.
111+
Mostly used by PATA devices.
112112

113-
xfer_mode: (RO) Current transfer mode
113+
xfer_mode: (RO) Current transfer mode. Mostly used by
114+
PATA devices.
114115

115-
dma_mode: (RO) Transfer modes supported by the device when
116-
in DMA mode. Mostly used by PATA device.
116+
dma_mode: (RO) DMA transfer mode used by the device.
117+
Mostly used by PATA devices.
117118

118119
class: (RO) Device class. Can be "ata" for disk,
119120
"atapi" for packet device, "pmp" for PM, or

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11264,6 +11264,7 @@ M: Damien Le Moal <[email protected]>
1126411264
1126511265
S: Maintained
1126611266
T: git git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata.git
11267+
F: Documentation/ABI/testing/sysfs-ata
1126711268
F: Documentation/devicetree/bindings/ata/
1126811269
F: drivers/ata/
1126911270
F: include/linux/ata.h

drivers/ata/libata-core.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,16 +2010,16 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
20102010
return err_mask;
20112011
}
20122012

2013-
static bool ata_log_supported(struct ata_device *dev, u8 log)
2013+
static int ata_log_supported(struct ata_device *dev, u8 log)
20142014
{
20152015
struct ata_port *ap = dev->link->ap;
20162016

20172017
if (dev->horkage & ATA_HORKAGE_NO_LOG_DIR)
2018-
return false;
2018+
return 0;
20192019

20202020
if (ata_read_log_page(dev, ATA_LOG_DIRECTORY, 0, ap->sector_buf, 1))
2021-
return false;
2022-
return get_unaligned_le16(&ap->sector_buf[log * 2]) ? true : false;
2021+
return 0;
2022+
return get_unaligned_le16(&ap->sector_buf[log * 2]);
20232023
}
20242024

20252025
static bool ata_identify_page_supported(struct ata_device *dev, u8 page)
@@ -2455,15 +2455,20 @@ static void ata_dev_config_cpr(struct ata_device *dev)
24552455
struct ata_cpr_log *cpr_log = NULL;
24562456
u8 *desc, *buf = NULL;
24572457

2458-
if (ata_id_major_version(dev->id) < 11 ||
2459-
!ata_log_supported(dev, ATA_LOG_CONCURRENT_POSITIONING_RANGES))
2458+
if (ata_id_major_version(dev->id) < 11)
2459+
goto out;
2460+
2461+
buf_len = ata_log_supported(dev, ATA_LOG_CONCURRENT_POSITIONING_RANGES);
2462+
if (buf_len == 0)
24602463
goto out;
24612464

24622465
/*
24632466
* Read the concurrent positioning ranges log (0x47). We can have at
2464-
* most 255 32B range descriptors plus a 64B header.
2467+
* most 255 32B range descriptors plus a 64B header. This log varies in
2468+
* size, so use the size reported in the GPL directory. Reading beyond
2469+
* the supported length will result in an error.
24652470
*/
2466-
buf_len = (64 + 255 * 32 + 511) & ~511;
2471+
buf_len <<= 9;
24672472
buf = kzalloc(buf_len, GFP_KERNEL);
24682473
if (!buf)
24692474
goto out;
@@ -5462,15 +5467,15 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev,
54625467
const struct ata_port_info * const * ppi,
54635468
int n_ports)
54645469
{
5465-
const struct ata_port_info *pi;
5470+
const struct ata_port_info *pi = &ata_dummy_port_info;
54665471
struct ata_host *host;
54675472
int i, j;
54685473

54695474
host = ata_host_alloc(dev, n_ports);
54705475
if (!host)
54715476
return NULL;
54725477

5473-
for (i = 0, j = 0, pi = NULL; i < host->n_ports; i++) {
5478+
for (i = 0, j = 0; i < host->n_ports; i++) {
54745479
struct ata_port *ap = host->ports[i];
54755480

54765481
if (ppi[j])

drivers/ata/libata-scsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2125,7 +2125,7 @@ static unsigned int ata_scsiop_inq_b9(struct ata_scsi_args *args, u8 *rbuf)
21252125

21262126
/* SCSI Concurrent Positioning Ranges VPD page: SBC-5 rev 1 or later */
21272127
rbuf[1] = 0xb9;
2128-
put_unaligned_be16(64 + (int)cpr_log->nr_cpr * 32 - 4, &rbuf[3]);
2128+
put_unaligned_be16(64 + (int)cpr_log->nr_cpr * 32 - 4, &rbuf[2]);
21292129

21302130
for (i = 0; i < cpr_log->nr_cpr; i++, desc += 32) {
21312131
desc[0] = cpr_log->cpr[i].num;

drivers/ata/libata-transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static struct {
196196
{ XFER_PIO_0, "XFER_PIO_0" },
197197
{ XFER_PIO_SLOW, "XFER_PIO_SLOW" }
198198
};
199-
ata_bitfield_name_match(xfer,ata_xfer_names)
199+
ata_bitfield_name_search(xfer, ata_xfer_names)
200200

201201
/*
202202
* ATA Port attributes

drivers/ata/pata_octeon_cf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,12 +856,14 @@ static int octeon_cf_probe(struct platform_device *pdev)
856856
int i;
857857
res_dma = platform_get_resource(dma_dev, IORESOURCE_MEM, 0);
858858
if (!res_dma) {
859+
put_device(&dma_dev->dev);
859860
of_node_put(dma_node);
860861
return -EINVAL;
861862
}
862863
cf_port->dma_base = (u64)devm_ioremap(&pdev->dev, res_dma->start,
863864
resource_size(res_dma));
864865
if (!cf_port->dma_base) {
866+
put_device(&dma_dev->dev);
865867
of_node_put(dma_node);
866868
return -EINVAL;
867869
}
@@ -871,6 +873,7 @@ static int octeon_cf_probe(struct platform_device *pdev)
871873
irq = i;
872874
irq_handler = octeon_cf_interrupt;
873875
}
876+
put_device(&dma_dev->dev);
874877
}
875878
of_node_put(dma_node);
876879
}

include/linux/libata.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,6 @@ struct ata_port {
822822
struct ata_queued_cmd qcmd[ATA_MAX_QUEUE + 1];
823823
u64 qc_active;
824824
int nr_active_links; /* #links with active qcs */
825-
unsigned int sas_last_tag; /* track next tag hw expects */
826825

827826
struct ata_link link; /* host default link */
828827
struct ata_link *slave_link; /* see ata_slave_link_init() */

0 commit comments

Comments
 (0)