From: Kees Cook <keescook@chromium.org>
To: Paul Bolle <pebolle@tiscali.nl>
Cc: Karsten Keil <isdn@linux-pingi.de>,
"David S. Miller" <davem@davemloft.net>,
Johan Hovold <johan@kernel.org>,
linux-kernel@vger.kernel.org,
gigaset307x-common@lists.sourceforge.net, netdev@vger.kernel.org
Subject: [PATCH] isdn/gigaset: Provide cardstate context for bas timer callbacks
Date: Fri, 20 Oct 2017 13:47:08 -0700 [thread overview]
Message-ID: <20171020204708.GA58150@beast> (raw)
While the work callback uses the urb to find cardstate from bas_cardstate,
this may not be valid for timer callbacks. Instead, introduce a direct
pointer back to the cardstate from bas_cardstate for use in timer
callbacks.
Reported-by: Paul Bolle <pebolle@tiscali.nl>
Fixes: 4cfea08e6251 ("isdn/gigaset: Convert timers to use timer_setup()")
Cc: Paul Bolle <pebolle@tiscali.nl>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Johan Hovold <johan@kernel.org>
Cc: gigaset307x-common@lists.sourceforge.net
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
drivers/isdn/gigaset/bas-gigaset.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index c990c6bbffc2..20d0a080a2b0 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -89,6 +89,7 @@ static int start_cbsend(struct cardstate *);
struct bas_cardstate {
struct usb_device *udev; /* USB device pointer */
+ struct cardstate *cs;
struct usb_interface *interface; /* interface for this device */
unsigned char minor; /* starting minor number */
@@ -436,8 +437,7 @@ static void check_pending(struct bas_cardstate *ucs)
static void cmd_in_timeout(struct timer_list *t)
{
struct bas_cardstate *ucs = from_timer(ucs, t, timer_cmd_in);
- struct urb *urb = ucs->urb_int_in;
- struct cardstate *cs = urb->context;
+ struct cardstate *cs = ucs->cs;
int rc;
if (!ucs->rcvbuf_size) {
@@ -643,8 +643,7 @@ static void int_in_work(struct work_struct *work)
static void int_in_resubmit(struct timer_list *t)
{
struct bas_cardstate *ucs = from_timer(ucs, t, timer_int_in);
- struct urb *urb = ucs->urb_int_in;
- struct cardstate *cs = urb->context;
+ struct cardstate *cs = ucs->cs;
int rc;
if (ucs->retry_int_in++ >= BAS_RETRY) {
@@ -1446,8 +1445,7 @@ static void read_iso_tasklet(unsigned long data)
static void req_timeout(struct timer_list *t)
{
struct bas_cardstate *ucs = from_timer(ucs, t, timer_ctrl);
- struct urb *urb = ucs->urb_int_in;
- struct cardstate *cs = urb->context;
+ struct cardstate *cs = ucs->cs;
int pending;
unsigned long flags;
@@ -1843,8 +1841,7 @@ static void write_command_callback(struct urb *urb)
static void atrdy_timeout(struct timer_list *t)
{
struct bas_cardstate *ucs = from_timer(ucs, t, timer_atrdy);
- struct urb *urb = ucs->urb_int_in;
- struct cardstate *cs = urb->context;
+ struct cardstate *cs = ucs->cs;
dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n");
@@ -2217,6 +2214,7 @@ static int gigaset_initcshw(struct cardstate *cs)
}
spin_lock_init(&ucs->lock);
+ ucs->cs = cs;
timer_setup(&ucs->timer_ctrl, req_timeout, 0);
timer_setup(&ucs->timer_atrdy, atrdy_timeout, 0);
timer_setup(&ucs->timer_cmd_in, cmd_in_timeout, 0);
--
2.7.4
--
Kees Cook
Pixel Security
next reply other threads:[~2017-10-20 20:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-20 20:47 Kees Cook [this message]
2017-10-23 2:12 ` [PATCH] isdn/gigaset: Provide cardstate context for bas timer callbacks David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171020204708.GA58150@beast \
--to=keescook@chromium.org \
--cc=davem@davemloft.net \
--cc=gigaset307x-common@lists.sourceforge.net \
--cc=isdn@linux-pingi.de \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pebolle@tiscali.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).