Received: by 10.223.164.202 with SMTP id h10csp1567065wrb; Wed, 8 Nov 2017 06:19:01 -0800 (PST) X-Google-Smtp-Source: ABhQp+Sow7SEAhOG0ouLhYj8N8PIfJpzTBEc3JkmXtg+4cjeLPxp2sDY2GzNlH5KKxjSpw4ala6y X-Received: by 10.159.233.137 with SMTP id bh9mr609686plb.201.1510150741083; Wed, 08 Nov 2017 06:19:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510150741; cv=none; d=google.com; s=arc-20160816; b=kNp1M23PBZr0V0cyOub0SYb8v9po6rb3kBS/JVqmE1/0kDztILfjwt5uAoJPqPtDRU c2UXIdu40EoqJSh/h8im9x70HKIdnTdFJhZNytV1kCCrdxKxl6o8ZqWkWeW+lmlxQuX1 66jS+ZXZtJZhJSytcuMUk92NTVKaVlwQlGxBEV0swsu8hvfWOG/HukEd0enkrB+yAEOC hB5e4VsDtJXoTPoagkoT6liKE5iH1cQO7/xFnKPmLdAQeVqcVuu5T9D/ViaKxiIKki5i CapG/lCzkNu+JC9rNVtbASw4/r5zYXGT9pOH6d0m8EfPzZXQRKP0q5mYPYQEk1Mz9tMF gnFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=yxZmWvfsIojiyJ08th2+DrsqdzzuouawlmY5WF6FQuE=; b=lh+hSrHcBnTpo3i6QMoBjYl6iRCncBq9lHqzz2bapIwhLqL4eFtvmMLhtv9fdjVMvH VOyLGhyECmKX04yTiY1Mhzzu2gSOaifeZKyQj7+eOelY/oyh8EHLvd0BN1kX6yaYbZoN LN2iWqsyJ+VTPDG31OVLD0ZDlyYI4PJ7YhZSrwrU//e0rlLHfegJBBjwuhWmKbjGtDAY 6SHAv+JGBYoWY00BDxF9iqGN92YFphrJ6ujjoDmMF0Lq08DBeCw8IRnHD1xHd85EHl+n KlisA/AYWJ2dCkKPGp0hlGfmu2+7BvDMZife/B11Y2yDtewRkPIdcig86RFyPUfUKfmk D0YA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4si3693195plt.411.2017.11.08.06.18.49; Wed, 08 Nov 2017 06:19:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752701AbdKHOSC (ORCPT + 82 others); Wed, 8 Nov 2017 09:18:02 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48112 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752637AbdKHOR6 (ORCPT ); Wed, 8 Nov 2017 09:17:58 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA8EEP1F097008 for ; Wed, 8 Nov 2017 09:17:58 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2e41t7petw-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 08 Nov 2017 09:17:57 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 8 Nov 2017 14:17:55 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 8 Nov 2017 14:17:53 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vA8EHqSl5373978; Wed, 8 Nov 2017 14:17:52 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7949C5203F; Wed, 8 Nov 2017 13:11:43 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 1CA1F52043; Wed, 8 Nov 2017 13:11:43 +0000 (GMT) From: Steffen Maier To: "James E . J . Bottomley" , "Martin K . Petersen" , Kees Cook Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Schwidefsky , Heiko Carstens , Steffen Maier , Benjamin Block Subject: [PATCH 1/3] zfcp: convert timers to use timer_setup() Date: Wed, 8 Nov 2017 15:17:07 +0100 X-Mailer: git-send-email 2.13.5 In-Reply-To: <20171108141709.79074-1-maier@linux.vnet.ibm.com> References: <20171108141709.79074-1-maier@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17110814-0016-0000-0000-000004FEF6EC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110814-0017-0000-0000-0000283A9B62 Message-Id: <20171108141709.79074-2-maier@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-08_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711080191 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Steffen Maier Cc: Benjamin Block Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: linux-s390@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: Martin Schwidefsky [maier@linux.vnet.ibm.com: depends on v4.14-rc3 686fef928bba ("timer: Prepare to change timer callback argument type"), rebased onto v4.14-rc7 ab31fd0ce65e ("scsi: zfcp: fix erp_action use-before-initialize in REC action trace")] Signed-off-by: Steffen Maier Reviewed-by: Jens Remus --- drivers/s390/scsi/zfcp_erp.c | 16 ++++++++++------ drivers/s390/scsi/zfcp_ext.h | 2 +- drivers/s390/scsi/zfcp_fsf.c | 13 ++++++------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index cbb8156bf5e0..822a852d578e 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c @@ -56,6 +56,8 @@ enum zfcp_erp_act_result { ZFCP_ERP_NOMEM = 5, }; +static void zfcp_erp_memwait_handler(struct timer_list *t); + static void zfcp_erp_adapter_block(struct zfcp_adapter *adapter, int mask) { zfcp_erp_clear_adapter_status(adapter, @@ -237,6 +239,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, erp_action->fsf_req_id = 0; erp_action->action = need; erp_action->status = act_status; + timer_setup(&erp_action->timer, zfcp_erp_memwait_handler, 0); return erp_action; } @@ -564,21 +567,22 @@ void zfcp_erp_notify(struct zfcp_erp_action *erp_action, unsigned long set_mask) * zfcp_erp_timeout_handler - Trigger ERP action from timed out ERP request * @data: ERP action (from timer data) */ -void zfcp_erp_timeout_handler(unsigned long data) +void zfcp_erp_timeout_handler(struct timer_list *t) { - struct zfcp_erp_action *act = (struct zfcp_erp_action *) data; + struct zfcp_fsf_req *fsf_req = from_timer(fsf_req, t, timer); + struct zfcp_erp_action *act = fsf_req->erp_action; zfcp_erp_notify(act, ZFCP_STATUS_ERP_TIMEDOUT); } -static void zfcp_erp_memwait_handler(unsigned long data) +static void zfcp_erp_memwait_handler(struct timer_list *t) { - zfcp_erp_notify((struct zfcp_erp_action *)data, 0); + struct zfcp_erp_action *act = from_timer(act, t, timer); + + zfcp_erp_notify(act, 0); } static void zfcp_erp_strategy_memwait(struct zfcp_erp_action *erp_action) { - setup_timer(&erp_action->timer, zfcp_erp_memwait_handler, - (unsigned long) erp_action); erp_action->timer.expires = jiffies + HZ; add_timer(&erp_action->timer); } diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index 8ca2ab7deaa9..978a0d596f68 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h @@ -69,7 +69,7 @@ extern int zfcp_erp_thread_setup(struct zfcp_adapter *); extern void zfcp_erp_thread_kill(struct zfcp_adapter *); extern void zfcp_erp_wait(struct zfcp_adapter *); extern void zfcp_erp_notify(struct zfcp_erp_action *, unsigned long); -extern void zfcp_erp_timeout_handler(unsigned long); +extern void zfcp_erp_timeout_handler(struct timer_list *); /* zfcp_fc.c */ extern struct kmem_cache *zfcp_fc_req_cache; diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 00fb98f7b2cd..6f437df1995f 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c @@ -21,9 +21,10 @@ struct kmem_cache *zfcp_fsf_qtcb_cache; -static void zfcp_fsf_request_timeout_handler(unsigned long data) +static void zfcp_fsf_request_timeout_handler(struct timer_list *t) { - struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; + struct zfcp_fsf_req *fsf_req = from_timer(fsf_req, t, timer); + struct zfcp_adapter *adapter = fsf_req->adapter; zfcp_qdio_siosl(adapter); zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, "fsrth_1"); @@ -32,8 +33,7 @@ static void zfcp_fsf_request_timeout_handler(unsigned long data) static void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout) { - fsf_req->timer.function = zfcp_fsf_request_timeout_handler; - fsf_req->timer.data = (unsigned long) fsf_req->adapter; + fsf_req->timer.function = (TIMER_FUNC_TYPE)zfcp_fsf_request_timeout_handler; fsf_req->timer.expires = jiffies + timeout; add_timer(&fsf_req->timer); } @@ -41,8 +41,7 @@ static void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, static void zfcp_fsf_start_erp_timer(struct zfcp_fsf_req *fsf_req) { BUG_ON(!fsf_req->erp_action); - fsf_req->timer.function = zfcp_erp_timeout_handler; - fsf_req->timer.data = (unsigned long) fsf_req->erp_action; + fsf_req->timer.function = (TIMER_FUNC_TYPE)zfcp_erp_timeout_handler; fsf_req->timer.expires = jiffies + 30 * HZ; add_timer(&fsf_req->timer); } @@ -692,7 +691,7 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio, adapter->req_no++; INIT_LIST_HEAD(&req->list); - init_timer(&req->timer); + timer_setup(&req->timer, NULL, 0); init_completion(&req->completion); req->adapter = adapter; -- 2.13.5 From 1583576634390285404@xxx Thu Nov 09 08:32:44 +0000 2017 X-GM-THRID: 1583499752106388791 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread