Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1833092

Summary: hdparm crashes with free(): invalid pointer
Product: Red Hat Enterprise Linux 8 Reporter: Rob Leese <rleese>
Component: hdparmAssignee: Tomáš Bžatek <tbzatek>
Status: CLOSED ERRATA QA Contact: Robin Hack <rhack>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.2CC: asanders, jpittman, qe-baseos-daemons, rhack, rhandlin, tbzatek
Target Milestone: rcKeywords: TestCaseNotNeeded, Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hdparm-9.54-3.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 14:56:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rob Leese 2020-05-07 19:06:51 UTC
Created attachment 1686310 [details]
app crash core

Description of problem:

Running hdparm on some of the system's drives works as expected:
=======
$ sudo hdparm -i /dev/sda                                                         
/dev/sda:

 Model=SK hynix SC210 2.5 7MM 512GB, FwRev=20001L00, SerialNo=1I52N024210102857
 Config={ }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16
 (maybe): CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1000215216
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
 AdvancedPM=yes: disabled (255) WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-2,3,4,5,6,7

 * signifies the current active mode

$ echo $?
0
=======

Running it on other drives triggers an abort and exit failure due to
freeing an invalid pointer:
=======
$ sudo hdparm -i /dev/sdb

/dev/sdb:

 Model=WDC WD5003AZEX-00K1GA0, FwRev=80.00A80, SerialNo=WD-WCC1S2239733
 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=976773168
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode

free(): invalid pointer
Abort
$ echo $?
262
Version-Release number of selected component (if applicable):


How reproducible:

Happens only on some drives

Comment 1 John Pittman 2020-05-07 19:22:48 UTC
hdparm-9.54-2.el8 is package level

Comment 3 Tomáš Bžatek 2020-06-01 15:46:16 UTC
This is a fallout from memory leak fixes: bug 1606961.

hdparm-9.54-resourceleak-fixes.patch adds free() calls on strip() in-place modified pointers. While upstream is leaking those three strings it's not a big deal since the hdparm process is short-lived.

Comment 4 Tomáš Bžatek 2020-06-01 16:01:58 UTC
Reproducible on my local SSD:

# ./hdparm -i /dev/sda

/dev/sda:

 Model=TOSHIBA THNSNH128GBST, FwRev=HTRAN101, SerialNo=53HS111PTE4Y
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=250069680
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5 
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-3,4,5,6,7

 * signifies the current active mode

free(): invalid pointer
Aborted

Comment 18 errata-xmlrpc 2021-05-18 14:56:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (hdparm bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1625