Compare commits
11 Commits
cb9f2c9d20
...
7315e0c5fa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7315e0c5fa | ||
|
|
97f1f71440 | ||
|
|
d8d728df27 | ||
|
|
e6eac7c4d7 | ||
|
|
c4fe7ec414 | ||
|
|
5080b949db | ||
|
|
4bba0fe3f2 | ||
|
|
d59bcf5328 | ||
|
|
d0a51f2f87 | ||
|
|
fb51eb91f2 | ||
|
|
4bde3b3dba |
@ -1,47 +0,0 @@
|
||||
Index: hdparm-9.43/sgio.c
|
||||
===================================================================
|
||||
--- hdparm-9.43.orig/sgio.c
|
||||
+++ hdparm-9.43/sgio.c
|
||||
@@ -17,6 +17,10 @@
|
||||
|
||||
#include <linux/hdreg.h>
|
||||
|
||||
+#ifndef DEMAND_SENSE_DATA
|
||||
+ #define DEMAND_SENSE_DATA 0
|
||||
+#endif
|
||||
+
|
||||
extern int verbose;
|
||||
extern int prefer_ata12;
|
||||
|
||||
@@ -193,7 +197,7 @@ int sg16 (int fd, int rw, int dma, struc
|
||||
unsigned char cdb[SG_ATA_16_LEN];
|
||||
unsigned char sb[32], *desc;
|
||||
struct scsi_sg_io_hdr io_hdr;
|
||||
- int prefer12 = prefer_ata12, demanded_sense = 0;
|
||||
+ int prefer12 = prefer_ata12;
|
||||
|
||||
if (tf->command == ATA_OP_PIDENTIFY)
|
||||
prefer12 = 0;
|
||||
@@ -302,14 +306,16 @@ int sg16 (int fd, int rw, int dma, struc
|
||||
|
||||
desc = sb + 8;
|
||||
if (io_hdr.driver_status != SG_DRIVER_SENSE) {
|
||||
- if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
|
||||
- static int second_try = 0;
|
||||
- if (!second_try++)
|
||||
+ static int second_try = 0;
|
||||
+ if (!second_try++) {
|
||||
+ if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
|
||||
fprintf(stderr, "SG_IO: questionable sense data, results may be incorrect\n");
|
||||
- } else if (demanded_sense) {
|
||||
- static int second_try = 0;
|
||||
- if (!second_try++)
|
||||
+ }
|
||||
+#if DEMAND_SENSE_DATA
|
||||
+ else {
|
||||
fprintf(stderr, "SG_IO: missing sense data, results may be incorrect\n");
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
} else if (sb[0] != 0x72 || sb[7] < 14 || desc[0] != 0x09 || desc[1] < 0x0c) {
|
||||
dump_bytes("SG_IO: bad/missing sense data, sb[]", sb, sizeof(sb));
|
||||
@ -1,12 +0,0 @@
|
||||
Index: hdparm-9.43/fallocate.c
|
||||
===================================================================
|
||||
--- hdparm-9.43.orig/fallocate.c
|
||||
+++ hdparm-9.43/fallocate.c
|
||||
@@ -41,6 +41,7 @@ int do_fallocate_syscall (const char *pa
|
||||
exit(0);
|
||||
}
|
||||
err = errno;
|
||||
+ close(fd);
|
||||
unlink(path);
|
||||
}
|
||||
perror(path);
|
||||
16
0001-hdparm-fallocate-close-fd.patch
Normal file
16
0001-hdparm-fallocate-close-fd.patch
Normal file
@ -0,0 +1,16 @@
|
||||
diff --git a/fallocate.c b/fallocate.c
|
||||
index 4e60459..d73c0f9 100644
|
||||
--- a/fallocate.c
|
||||
+++ b/fallocate.c
|
||||
@@ -39,9 +39,11 @@ int do_fallocate_syscall (const char *path, __u64 bytecount)
|
||||
err = syscall(SYS_fallocate, fd, mode, offset, len);
|
||||
if (err >= 0) {
|
||||
fsync(fd);
|
||||
+ close(fd);
|
||||
exit(0);
|
||||
}
|
||||
err = errno;
|
||||
+ close(fd);
|
||||
unlink(path);
|
||||
}
|
||||
perror(path);
|
||||
51
0002-hdparam-Remove-security_password-printing.patch
Normal file
51
0002-hdparam-Remove-security_password-printing.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From deaa52e44c5464a8360e540d7b35895bc51e5143 Mon Sep 17 00:00:00 2001
|
||||
From: Wenchao Hao <haowenchao@huawei.com>
|
||||
Date: Mon, 30 Nov 2020 17:29:55 +0800
|
||||
Subject: [PATCH] hdparam: Remove security_password printing
|
||||
|
||||
In consideration of security, passwd should not printed
|
||||
in log, so this commit remove security_password printing
|
||||
in code.
|
||||
|
||||
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
|
||||
Signed-off-by: volcanodragon <linfeilong@huawei.com>
|
||||
---
|
||||
hdparm.c | 15 ++-------------
|
||||
1 file changed, 2 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/hdparm.c b/hdparm.c
|
||||
index 8045c87..3282d93 100644
|
||||
--- a/hdparm.c
|
||||
+++ b/hdparm.c
|
||||
@@ -989,8 +989,8 @@ do_set_security (int fd)
|
||||
exit(EINVAL);
|
||||
}
|
||||
if (!quiet) {
|
||||
- printf(" Issuing %s command, password=\"%s\", user=%s",
|
||||
- description, security_password, (data[0] & 1) ? "master" : "user");
|
||||
+ printf(" Issuing %s command, user=%s",
|
||||
+ description, (data[0] & 1) ? "master" : "user");
|
||||
if (security_command == ATA_OP_SECURITY_SET_PASS)
|
||||
printf(", mode=%s", data[1] ? "max" : "high");
|
||||
printf("\n");
|
||||
@@ -3004,17 +3004,6 @@ static void get_security_password (int handle_NULL)
|
||||
} else if (!handle_NULL || strcmp(argp, "NULL")) {
|
||||
strcpy(security_password, argp);
|
||||
}
|
||||
- printf("security_password:");
|
||||
- if (!binary_passwd) {
|
||||
- printf(" \"%s\"\n", security_password);
|
||||
- } else {
|
||||
- unsigned int i;
|
||||
- for (i = 0; i < maxlen; ++i) {
|
||||
- unsigned char c = security_password[i];
|
||||
- printf(" %02x", c);
|
||||
- }
|
||||
- putchar('\n');
|
||||
- }
|
||||
while (*argp)
|
||||
++argp;
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
Index: hdparm-9.43/geom.c
|
||||
===================================================================
|
||||
--- hdparm-9.43.orig/geom.c
|
||||
+++ hdparm-9.43/geom.c
|
||||
@@ -201,7 +201,7 @@ int get_dev_geometry (int fd, __u32 *cyl
|
||||
__u64 hs = (*heads) * (*sects);
|
||||
__u64 cyl = (*cyls);
|
||||
__u64 chs = cyl * hs;
|
||||
- if (chs < (*nsectors))
|
||||
+ if (chs < (*nsectors) && hs)
|
||||
*cyls = (*nsectors) / hs;
|
||||
}
|
||||
}
|
||||
33
0003-hdparm-fix-fd-leak-in-sysfs_write_attr.patch
Normal file
33
0003-hdparm-fix-fd-leak-in-sysfs_write_attr.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From ac3b725928b6b6c4a1188670a67ed5432744de26 Mon Sep 17 00:00:00 2001
|
||||
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
|
||||
Date: Tue, 1 Mar 2022 15:47:02 +0800
|
||||
Subject: [PATCH] hdparm: fix fd leak in sysfs_write_attr()
|
||||
|
||||
In sysfs_write_attr(), if "fmt[0] != %", will return without
|
||||
close fp.
|
||||
|
||||
Fix issue: https://gitee.com/src-openeuler/hdparm/issues/I4S2C0
|
||||
|
||||
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
|
||||
---
|
||||
sysfs.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sysfs.c b/sysfs.c
|
||||
index 60b8146..722b2a9 100644
|
||||
--- a/sysfs.c
|
||||
+++ b/sysfs.c
|
||||
@@ -60,8 +60,9 @@ static int sysfs_write_attr (char *path, const char *attr, const char *fmt, void
|
||||
}
|
||||
if (count < 0)
|
||||
err = errno;
|
||||
- fclose(fp);
|
||||
}
|
||||
+ if (!fp)
|
||||
+ fclose(fp);
|
||||
if (err && verbose) perror(path);
|
||||
*pathtail = '\0';
|
||||
return err;
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
Binary file not shown.
BIN
hdparm-9.58.tar.gz
Normal file
BIN
hdparm-9.58.tar.gz
Normal file
Binary file not shown.
33
hdparm.spec
33
hdparm.spec
@ -1,13 +1,13 @@
|
||||
Name: hdparm
|
||||
Version: 9.56
|
||||
Version: 9.58
|
||||
Release: 3
|
||||
Summary: A system utility for setting or showing hard drive parameters
|
||||
License: BSD
|
||||
URL: https://sourceforge.net/projects/%{name}/
|
||||
Source: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
||||
Patch0000: 0000-hdparm-9.43-ditch_dead_code.patch
|
||||
Patch0001: 0001-hdparm-9.43-close_fd.patch
|
||||
Patch0002: 0002-hdparm-9.43-get_geom.patch
|
||||
Source0: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
||||
Patch1: 0001-hdparm-fallocate-close-fd.patch
|
||||
Patch2: 0002-hdparam-Remove-security_password-printing.patch
|
||||
Patch3: 0003-hdparm-fix-fd-leak-in-sysfs_write_attr.patch
|
||||
|
||||
BuildRequires: gcc git
|
||||
|
||||
@ -44,11 +44,32 @@ install -c -m 644 hdparm.8 $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||
%{_mandir}/man8/hdparm.8*
|
||||
|
||||
%changelog
|
||||
* Tue Mar 01 2022 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 9.58-3
|
||||
- rename patches and fix one fd leak in sysfs_write_attr()
|
||||
|
||||
* Sat Jan 22 2022 linfeilong<linfeilong@huawei.com> - 9.58-2
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:delete password print for security
|
||||
|
||||
* Tue Apr 14 2020 linfeilong<linfeilong@huawei.com> - 9.58-1
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:Update package to 9.58
|
||||
|
||||
* Tue Jan 7 2020 openEuler Buildteam <buildteam@openeuler.org> - 9.56-4
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:Update package
|
||||
|
||||
* Fri Aug 30 2019 louhongxiang <louhongxiang@huawei.com> - 9.56-3
|
||||
- Type:enhancemnet
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESCi:openEuler Debranding
|
||||
- DESC:openEuler Debranding
|
||||
|
||||
* Wed Aug 21 2019 wubo <wubo40@huawei.com> - 9.56-2
|
||||
- Package init and change patch name
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user