Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752687AbdLMJ7Q (ORCPT ); Wed, 13 Dec 2017 04:59:16 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:38641 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752447AbdLMJ7J (ORCPT ); Wed, 13 Dec 2017 04:59:09 -0500 X-Google-Smtp-Source: ACJfBovoVGXInq0vqO5Kn+3MngejuPFawChSl8Gjhxj5479hMK2kcl8by1iXBII+i2Do91PJ5ZNGUQ== From: Jia-Ju Bai To: Dept-GELinuxNICDev@cavium.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 2/2] qla3xxx: Fix a possible sleep-in-atomic bug in ql_wait_for_drvr_lock Date: Wed, 13 Dec 2017 18:01:27 +0800 Message-Id: <1513159287-14777-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 912 Lines: 30 The driver may sleep under a spinlock. The function call path is: ql_adapter_up (acquire the spinlock) ql_wait_for_drvr_lock ssleep --> may sleep To fix it, ssleep is replaced with mdelay. This bug is found by my static analysis tool(DSAC) and checked by my code review. Signed-off-by: Jia-Ju Bai --- drivers/net/ethernet/qlogic/qla3xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c index 8ad3e24..7994d04 100644 --- a/drivers/net/ethernet/qlogic/qla3xxx.c +++ b/drivers/net/ethernet/qlogic/qla3xxx.c @@ -155,7 +155,7 @@ static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev) "driver lock acquired\n"); return 1; } - ssleep(1); + mdelay(1000); } while (++i < 10); netdev_err(qdev->ndev, "Timed out waiting for driver lock...\n"); -- 1.7.9.5