lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1504222183-61202-28-git-send-email-keescook@chromium.org>
Date:   Thu, 31 Aug 2017 16:29:39 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     Kees Cook <keescook@...omium.org>, Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Raviteja Garimella <raviteja.garimella@...adcom.com>,
        Michal Nazarewicz <mina86@...a86.com>,
        "Gustavo A. R. Silva" <garsilva@...eddedor.com>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 27/31] usb/gadget/snps_udc_core: Move timer initialization earlier

With timer initialization made earlier at the start, there is no reason
to make del_timer_sync() calls conditionally, there by removing the
assignments and tests of the .data field.

Cc: Felipe Balbi <balbi@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Raviteja Garimella <raviteja.garimella@...adcom.com>
Cc: Michal Nazarewicz <mina86@...a86.com>
Cc: "Gustavo A. R. Silva" <garsilva@...eddedor.com>
Cc: linux-usb@...r.kernel.org
Signed-off-by: Kees Cook <keescook@...omium.org>
---
 drivers/usb/gadget/udc/snps_udc_core.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/gadget/udc/snps_udc_core.c b/drivers/usb/gadget/udc/snps_udc_core.c
index 5460e5ba1c3c..1607e901e16b 100644
--- a/drivers/usb/gadget/udc/snps_udc_core.c
+++ b/drivers/usb/gadget/udc/snps_udc_core.c
@@ -3067,14 +3067,12 @@ void udc_remove(struct udc *dev)
 	stop_timer++;
 	if (timer_pending(&udc_timer))
 		wait_for_completion(&on_exit);
-	if (udc_timer.data)
-		del_timer_sync(&udc_timer);
+	del_timer_sync(&udc_timer);
 	/* remove pollstall timer */
 	stop_pollstall_timer++;
 	if (timer_pending(&udc_pollstall_timer))
 		wait_for_completion(&on_pollstall_exit);
-	if (udc_pollstall_timer.data)
-		del_timer_sync(&udc_pollstall_timer);
+	del_timer_sync(&udc_pollstall_timer);
 	udc = NULL;
 }
 EXPORT_SYMBOL_GPL(udc_remove);
@@ -3164,9 +3162,9 @@ int udc_probe(struct udc *dev)
 	u32		reg;
 	int		retval;
 
-	/* mark timer as not initialized */
-	udc_timer.data = 0;
-	udc_pollstall_timer.data = 0;
+	/* timer init */
+	setup_timer(&udc_timer, udc_timer_function, 0);
+	setup_timer(&udc_pollstall_timer, udc_pollstall_timer_function, 0);
 
 	/* device struct setup */
 	dev->gadget.ops = &udc_ops;
@@ -3206,10 +3204,6 @@ int udc_probe(struct udc *dev)
 	if (retval)
 		goto finished;
 
-	/* timer init */
-	setup_timer(&udc_timer, udc_timer_function, 1);
-	setup_timer(&udc_pollstall_timer, udc_pollstall_timer_function, 1);
-
 	/* set SD */
 	reg = readl(&dev->regs->ctl);
 	reg |= AMD_BIT(UDC_DEVCTL_SD);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ