Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4876395imm; Mon, 11 Jun 2018 21:44:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIvKMsDynLd+PPpBlFuvqg7B3ZjEzMqQMQA9fECsBuoVw/xSX9UL3fPEHn+Rm3qkVrZUxr+ X-Received: by 2002:a17:902:bc4a:: with SMTP id t10-v6mr2218796plz.133.1528778681434; Mon, 11 Jun 2018 21:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528778681; cv=none; d=google.com; s=arc-20160816; b=sEdNUmb1uis06nBnT7Q+V+cRsu0ykK33H4iUXLlgPXQNMnjRtEuJ81RD8m3eSHjC3M W0JpAdleo6ghux33xFRd+3xl7og3/0O2pb1zHYpqdppKyFrKdh4uf35/tldSnnlrw6Nh XXRt08g1MwIZhWlk4x9gyO79eW6Od1/+YbmJRR+oCbc5nXHerPUc7BxgaZywnt3w4CCO VDAAIF+fWVEPZxD3XEOEvB1CYhxfIWTj6dqCHxM76wIjjM0EWFmYig9Gowh3vsZzdBVz paYW3cvgfWZi3ANanPavRVHTEJ30ubpqPYjdJgrFulIHFUxtWw0kfsnqgagBvaHEVP5N jqiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature:arc-authentication-results; bh=bvFo6VM9yuamEu0fsHOGtDid0BSJt7eSHoHqr0Ibmso=; b=XkeWw5Qm6jB3MnYp7Ts63F/HXyZyhWKr7Es3356+nRgJ0eNEfB5v4uNULP2oRT1l1f 8gqubYnocKuKq3QUYyWIZQaCH2+TvubZwJA4Px0BeeuTX+HRyMCLsfIrJQWDl8Hoiqdz WyJXg28htvzeBoq2dCXjSJOqvxEMsQBf5c1N8mMzq+VBX9pHwqsf41Am80/R1w1kGB7x utRp4ruxZPhyRzQ3Pxus3GKmzvwFjg42WNmrd3BnbShT/ccioI6ZphpK6Qt8l5L8g9p5 dO01VLdQ1u6MB6Gr/WsjUTBWBnysSxaF68V+xwkE10J50VMWUHQ2stFJOL8oXNAIjjm6 AAbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fMWfGvg1; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4-v6si21539018plp.120.2018.06.11.21.44.27; Mon, 11 Jun 2018 21:44:41 -0700 (PDT) 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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fMWfGvg1; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932720AbeFLEoC (ORCPT + 99 others); Tue, 12 Jun 2018 00:44:02 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:44884 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753943AbeFLEoB (ORCPT ); Tue, 12 Jun 2018 00:44:01 -0400 Received: by mail-pf0-f193.google.com with SMTP id h12-v6so11414640pfk.11; Mon, 11 Jun 2018 21:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=bvFo6VM9yuamEu0fsHOGtDid0BSJt7eSHoHqr0Ibmso=; b=fMWfGvg1rTvpe2lLPvpUVJ7PtSYKc7xEIMKASXqSMZQgf8G0+C86H81/wAvPshWFd6 ASTeEe2JDMfzMSWMPt7S+dQOkxfVcF0W9QjXQx7M3XnD8jB7hAWI1WS7E2fjcjQWjzhH 8xlbelRMBtF7x7hIsiVIuMnNTVmFZ2mpr40HGlXyIaFofIp3OAkMxfkl9g+34VV01gpP ULiwgF6H+VaNKIRWai4/5mFv0vJRnFDd0XS/xhj1e2RUOsNbXYwXSG2lwn0WkfGNReiu IxKcwQYq/2GHBNF70IOwPGjEJsGLw1bVmothIxquVecqvybVidnDtQs7EowIKOnRDiRP N+nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bvFo6VM9yuamEu0fsHOGtDid0BSJt7eSHoHqr0Ibmso=; b=akdCa0Oxu4KJE8yPbSS3HJEP0ZTObTYrkhzIhpDjJw8AiDEHYm6ql3+NIyB8eHSGwW 5olnQw73s65/nDyNHH8g800k6bD2wzxjiKdC6YEHfJT8jKqYKqlGRyXOpTtsIRPAq1Ek vFaZThRLQRKyy0iVkwLDPFvsowp1qCJqiwzRQu0GVoSgsoKomUueq4DMQ857VYETBRD5 Exl2vw6WSlXDNnU0ZxzQZPYx30Y1Wfyv5XOct+HnS2UkpwPIZkDZ1P+bMw4L9PfNWkeC BfO+P7m5Cgtnq+IWJ2EZaZLkvlaDU7ksoLe5GqG7CQjfhHVqK5HKb5k8yGE3s2snc6w3 zduw== X-Gm-Message-State: APt69E3GGA2w6x6PXvYwR1gTC0U1UsiJyiOA3knvMDJRk92wsiwzJ4y3 h6a/CNFMF7xzfs1MLdX4u1o= X-Received: by 2002:a63:b215:: with SMTP id x21-v6mr1755694pge.393.1528778640893; Mon, 11 Jun 2018 21:44:00 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id k129-v6sm75770753pga.94.2018.06.11.21.43.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 21:44:00 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , Karsten Keil , Kees Cook , Annie Cherkaev , Al Viro , Jiten Thakkar , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] isdn/i4l: add error handling for try_module_get Date: Tue, 12 Jun 2018 12:43:53 +0800 Message-Id: <1528778635-41763-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When try_module_get fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling try_module_get. Signed-off-by: Zhouyang Jia --- drivers/isdn/i4l/isdn_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index 7c6f3f5..7e52851 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c @@ -71,7 +71,8 @@ static int isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding); static inline void isdn_lock_driver(isdn_driver_t *drv) { - try_module_get(drv->interface->owner); + if (!try_module_get(drv->interface->owner)) + printk(KERN_WARNING "isdn_lock_driver: cannot get module\n"); drv->locks++; } -- 2.7.4