diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e681f3e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/3w-xxxx-4.18.0-240.el8.tar.xz diff --git a/.kmod-3w-xxxx.metadata b/.kmod-3w-xxxx.metadata new file mode 100644 index 0000000..0abf0bb --- /dev/null +++ b/.kmod-3w-xxxx.metadata @@ -0,0 +1 @@ +4f9bf7e4f2b7a1f4f154f53ff74982d67a3d342a SOURCES/3w-xxxx-4.18.0-240.el8.tar.xz diff --git a/SOURCES/0001-scsi-3ware-fix-return-0-on-the-error-path-of-probe.patch b/SOURCES/0001-scsi-3ware-fix-return-0-on-the-error-path-of-probe.patch new file mode 100644 index 0000000..6ecb09f --- /dev/null +++ b/SOURCES/0001-scsi-3ware-fix-return-0-on-the-error-path-of-probe.patch @@ -0,0 +1,47 @@ +From 4dc98c1995482262e70e83ef029135247fafe0f2 Mon Sep 17 00:00:00 2001 +From: Anton Vasilyev +Date: Fri, 27 Jul 2018 16:51:57 +0300 +Subject: [Backport 4dc98c199548] scsi: 3ware: fix return 0 on the error path + of probe + +tw_probe() returns 0 in case of fail of tw_initialize_device_extension(), +pci_resource_start() or tw_reset_sequence() and releases resources. +twl_probe() returns 0 in case of fail of twl_initialize_device_extension(), +pci_iomap() and twl_reset_sequence(). twa_probe() returns 0 in case of +fail of tw_initialize_device_extension(), ioremap() and +twa_reset_sequence(). + +The patch adds retval initialization for these cases. + +Found by Linux Driver Verification project (linuxtesting.org). + +Signed-off-by: Anton Vasilyev +Acked-by: Adam Radford +Signed-off-by: Martin K. Petersen +--- + src/3w-xxxx.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/3w-xxxx.c b/src/3w-xxxx.c +index a40d353bd8b3981986ee1e4fea3ed6771b078f7e..471366945bd4fc8b3d92ede8247f8a4d5706d508 100644 +--- a/src/3w-xxxx.c ++++ b/src/3w-xxxx.c +@@ -2280,6 +2280,7 @@ static int tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) + + if (tw_initialize_device_extension(tw_dev)) { + printk(KERN_WARNING "3w-xxxx: Failed to initialize device extension."); ++ retval = -ENOMEM; + goto out_free_device_extension; + } + +@@ -2294,6 +2295,7 @@ static int tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) + tw_dev->base_addr = pci_resource_start(pdev, 0); + if (!tw_dev->base_addr) { + printk(KERN_WARNING "3w-xxxx: Failed to get io address."); ++ retval = -ENOMEM; + goto out_release_mem_region; + } + +-- +2.31.1 + diff --git a/SPECS/kmod-3w-xxxx.spec b/SPECS/kmod-3w-xxxx.spec new file mode 100644 index 0000000..3686de1 --- /dev/null +++ b/SPECS/kmod-3w-xxxx.spec @@ -0,0 +1,134 @@ +%global pkg 3w-xxxx + +%global driver_version 4.18.0-240.el8 + +%global kernel_version 4.18.0-348.el8 + +%global _use_internal_dependency_generator 0 +%global __find_requires /usr/lib/rpm/redhat/find-requires +%global __find_provides /usr/lib/rpm/redhat/find-provides + +%global debug_package %{nil} + +%global __spec_install_post \ + %{?__debug_package:%{__debug_install_post}} \ + %{__arch_install_post} \ + %{__os_install_post} \ + %{__mod_compress_install_post} + +%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\; + + +Name: kmod-%{pkg} +Version: 4.18.0.240 +Release: 1%{?dist} +Summary: 3ware 5/6/7/8xxx ATA RAID Controller (%{pkg}) driver + +License: GPLv2 +URL: https://www.kernel.org/ + +Source0: %{pkg}-%{driver_version}.tar.xz +Patch1: 0001-scsi-3ware-fix-return-0-on-the-error-path-of-probe.patch + +ExclusiveArch: x86_64 aarch64 + +BuildRequires: elfutils-libelf-devel +BuildRequires: gcc +BuildRequires: kernel-rpm-macros +BuildRequires: kmod +BuildRequires: make +BuildRequires: redhat-rpm-config +BuildRequires: xz + +BuildRequires: kernel-abi-stablelists = %{kernel_version} +BuildRequires: kernel-devel = %{kernel_version} +BuildRequires: kernel-devel-uname-r = %{kernel_version}.%{_arch} + +Requires: kernel >= %{kernel_version} +Requires: kernel-uname-r >= %{kernel_version}.%{_arch} +Requires: kernel-modules >= %{kernel_version} +Requires: kernel-modules-uname-r >= %{kernel_version}.%{_arch} + +Provides: installonlypkg(kernel-module) +Provides: kernel-modules >= %{kernel_version}.%{_arch} + +Requires(post): %{_sbindir}/depmod +Requires(postun): %{_sbindir}/depmod + +Requires(post): %{_sbindir}/weak-modules +Requires(postun): %{_sbindir}/weak-modules + + +%description +This driver supports 3ware's 5/6/7/8xxx series ATA RAID controller cards. + + +%prep +%autosetup -p1 -n %{pkg}-%{driver_version} + + +%build +pushd src +%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules +popd + + +%install +%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi src/%{pkg}.ko +%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/ +echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf + +# Make .ko objects temporarily executable for automatic stripping +find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+ + + +%clean +%{__rm} -rf %{buildroot} + + +%post +mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods +printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add + + +%preun +mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods +rpm -ql kmod-%{pkg}-%{?epoch:%{epoch}:}%{version}-%{release}.%{_arch} | grep '/lib/modules/%{kernel_version}.%{_arch}/.*\.ko\.xz$' >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove + + +%postun +if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ] +then + modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) ) + rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove + rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods + printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules +fi + + +%pretrans -p +posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add") +posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove") + + +%posttrans +if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ] +then + modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) ) + rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add + rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods + printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules +fi + + +%files +%defattr(644,root,root,755) +/lib/modules/%{kernel_version}.%{_arch} +%license COPYING +%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf + + +%changelog +* Sat Jan 15 2022 Kmods SIG - 4.18.0.240-1 +- Use EL kernel source and versioning +- kABI tracking kmod package (kernel >= 4.18.0-348.el8)