Skip to content

Commit 33ad61d

Browse files
keesdavem330
authored andcommitted
isdn/gigaset: Provide cardstate context for bas timer callbacks
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: 4cfea08 ("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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e27afb8 commit 33ad61d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/isdn/gigaset/bas-gigaset.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static int start_cbsend(struct cardstate *);
8989

9090
struct bas_cardstate {
9191
struct usb_device *udev; /* USB device pointer */
92+
struct cardstate *cs;
9293
struct usb_interface *interface; /* interface for this device */
9394
unsigned char minor; /* starting minor number */
9495

@@ -436,8 +437,7 @@ static void check_pending(struct bas_cardstate *ucs)
436437
static void cmd_in_timeout(struct timer_list *t)
437438
{
438439
struct bas_cardstate *ucs = from_timer(ucs, t, timer_cmd_in);
439-
struct urb *urb = ucs->urb_int_in;
440-
struct cardstate *cs = urb->context;
440+
struct cardstate *cs = ucs->cs;
441441
int rc;
442442

443443
if (!ucs->rcvbuf_size) {
@@ -643,8 +643,7 @@ static void int_in_work(struct work_struct *work)
643643
static void int_in_resubmit(struct timer_list *t)
644644
{
645645
struct bas_cardstate *ucs = from_timer(ucs, t, timer_int_in);
646-
struct urb *urb = ucs->urb_int_in;
647-
struct cardstate *cs = urb->context;
646+
struct cardstate *cs = ucs->cs;
648647
int rc;
649648

650649
if (ucs->retry_int_in++ >= BAS_RETRY) {
@@ -1446,8 +1445,7 @@ static void read_iso_tasklet(unsigned long data)
14461445
static void req_timeout(struct timer_list *t)
14471446
{
14481447
struct bas_cardstate *ucs = from_timer(ucs, t, timer_ctrl);
1449-
struct urb *urb = ucs->urb_int_in;
1450-
struct cardstate *cs = urb->context;
1448+
struct cardstate *cs = ucs->cs;
14511449
int pending;
14521450
unsigned long flags;
14531451

@@ -1843,8 +1841,7 @@ static void write_command_callback(struct urb *urb)
18431841
static void atrdy_timeout(struct timer_list *t)
18441842
{
18451843
struct bas_cardstate *ucs = from_timer(ucs, t, timer_atrdy);
1846-
struct urb *urb = ucs->urb_int_in;
1847-
struct cardstate *cs = urb->context;
1844+
struct cardstate *cs = ucs->cs;
18481845

18491846
dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n");
18501847

@@ -2217,6 +2214,7 @@ static int gigaset_initcshw(struct cardstate *cs)
22172214
}
22182215

22192216
spin_lock_init(&ucs->lock);
2217+
ucs->cs = cs;
22202218
timer_setup(&ucs->timer_ctrl, req_timeout, 0);
22212219
timer_setup(&ucs->timer_atrdy, atrdy_timeout, 0);
22222220
timer_setup(&ucs->timer_cmd_in, cmd_in_timeout, 0);

0 commit comments

Comments
 (0)