From: QiaoChong Date: Sat, 9 Feb 2019 20:59:07 +0000 (+0000) Subject: parport_pc: fix find_superio io compare code, should use equal test. X-Git-Tag: Ubuntu-4.15.0-61.68~2740 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=6fb67869f529e5fb613bc7751f21a8c7a1509d45;p=mirror_ubuntu-bionic-kernel.git parport_pc: fix find_superio io compare code, should use equal test. BugLink: https://bugs.launchpad.net/bugs/1837952 commit 21698fd57984cd28207d841dbdaa026d6061bceb upstream. In the original code before 181bf1e815a2 the loop was continuing until it finds the first matching superios[i].io and p->base. But after 181bf1e815a2 the logic changed and the loop now returns the pointer to the first mismatched array element which is then used in get_superio_dma() and get_superio_irq() and thus returning the wrong value. Fix the condition so that it now returns the correct pointer. Fixes: 181bf1e815a2 ("parport_pc: clean up the modified while loops using for") Cc: Alan Cox Cc: stable@vger.kernel.org Signed-off-by: QiaoChong [rewrite the commit message] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Signed-off-by: Kamal Mostafa Signed-off-by: Khalid Elmously --- diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 380916bff9e0..dee5b9e35ffd 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -1377,7 +1377,7 @@ static struct superio_struct *find_superio(struct parport *p) { int i; for (i = 0; i < NR_SUPERIOS; i++) - if (superios[i].io != p->base) + if (superios[i].io == p->base) return &superios[i]; return NULL; }