diff mbox series

[ovs-dev,v2] rhel: Fix ovs-kmod-manage.sh that may create invalid soft links

Message ID 1574107586-29029-1-git-send-email-pkusunyifeng@gmail.com
State Accepted
Commit 1aaf467bd4514f0e23d4227075c7fecb42876c9c
Headers show
Series [ovs-dev,v2] rhel: Fix ovs-kmod-manage.sh that may create invalid soft links | expand

Commit Message

Yifeng Sun Nov. 18, 2019, 8:06 p.m. UTC
Current code iterates every kernel under '/lib/modules' for a matched
version. As a result, this script may create invalid soft links if the
matched kernel doesn't have openvswitch-kmod RPM installed.

This patch fixes it.

VMWare-BZ: #2257534

Fixes: c3570519 ("rhel: add 4.4 kernel in kmod build with mulitple versions, fedora")
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
---
v1->v2: Added fix tag, thanks YiHung.

 rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Yi-Hung Wei Nov. 18, 2019, 8:19 p.m. UTC | #1
On Mon, Nov 18, 2019 at 12:06 PM Yifeng Sun <pkusunyifeng@gmail.com> wrote:
>
> Current code iterates every kernel under '/lib/modules' for a matched
> version. As a result, this script may create invalid soft links if the
> matched kernel doesn't have openvswitch-kmod RPM installed.
>
> This patch fixes it.
>
> VMWare-BZ: #2257534
>
> Fixes: c3570519 ("rhel: add 4.4 kernel in kmod build with mulitple versions, fedora")
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>

LGTM,

Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
William Tu Nov. 18, 2019, 8:32 p.m. UTC | #2
On Mon, Nov 18, 2019 at 12:19:26PM -0800, Yi-Hung Wei wrote:
> On Mon, Nov 18, 2019 at 12:06 PM Yifeng Sun <pkusunyifeng@gmail.com> wrote:
> >
> > Current code iterates every kernel under '/lib/modules' for a matched
> > version. As a result, this script may create invalid soft links if the
> > matched kernel doesn't have openvswitch-kmod RPM installed.
> >
> > This patch fixes it.
> >
> > VMWare-BZ: #2257534
> >
> > Fixes: c3570519 ("rhel: add 4.4 kernel in kmod build with mulitple versions, fedora")
> > Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> 
> LGTM,
> 
> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>

Thanks, I applied to master.
William
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
William Tu Nov. 18, 2019, 9:24 p.m. UTC | #3
On Mon, Nov 18, 2019 at 12:32:30PM -0800, William Tu wrote:
> On Mon, Nov 18, 2019 at 12:19:26PM -0800, Yi-Hung Wei wrote:
> > On Mon, Nov 18, 2019 at 12:06 PM Yifeng Sun <pkusunyifeng@gmail.com> wrote:
> > >
> > > Current code iterates every kernel under '/lib/modules' for a matched
> > > version. As a result, this script may create invalid soft links if the
> > > matched kernel doesn't have openvswitch-kmod RPM installed.
> > >
> > > This patch fixes it.
> > >
> > > VMWare-BZ: #2257534
> > >
> > > Fixes: c3570519 ("rhel: add 4.4 kernel in kmod build with mulitple versions, fedora")
> > > Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> > 
> > LGTM,
> > 
> > Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
> 
> Thanks, I applied to master.
> William

Also backport to branch-2.12
William
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

diff --git a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
index a643b55ff0f8..a252b391ecba 100644
--- a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
+++ b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
@@ -157,7 +157,7 @@  fi
 #$kmod_high_ver"
 
 found_match=false
-for kname in `ls -d /lib/modules/*`
+for kname in $kversion;
 do
     IFS='.\|-' read -r -a pkg_ver_nums <<<"${kname}"
     pkg_ver=${pkg_ver_nums[$ver_offset]}
@@ -184,14 +184,14 @@  if [ "$found_match" = "false" ]; then
     exit 1
 fi
 
-if [ "$requested_kernel" != "/lib/modules/$current_kernel" ]; then
+if [ "$requested_kernel" != "$current_kernel" ]; then
     if [ ! -d /lib/modules/$current_kernel/weak-updates/openvswitch ]; then
         mkdir -p /lib/modules/$current_kernel/weak-updates
         mkdir -p /lib/modules/$current_kernel/weak-updates/openvswitch
     fi
     for m in openvswitch vport-gre vport-stt vport-geneve \
         vport-lisp vport-vxlan; do
-        ln -f -s $requested_kernel/extra/openvswitch/$m.ko \
+        ln -f -s /lib/modules/$requested_kernel/extra/openvswitch/$m.ko \
             /lib/modules/$current_kernel/weak-updates/openvswitch/$m.ko
     done
 else