Received: by 10.223.164.202 with SMTP id h10csp1760302wrb; Wed, 8 Nov 2017 09:14:10 -0800 (PST) X-Google-Smtp-Source: ABhQp+TNT0p280fAzXuq0Hh0BbGYNmn+UADVj8ojcLNhhrCWCp/1RLYXPijgvwbPnqdSwZrMnMn0 X-Received: by 10.99.66.130 with SMTP id p124mr1130368pga.0.1510161250215; Wed, 08 Nov 2017 09:14:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510161250; cv=none; d=google.com; s=arc-20160816; b=nwBYfQjulUJy4lMOeaGbty0O1gDFa4FfT1ihjhv9jHsLIYDJhwkL3iWwF4/0YkqepK 357HZ4mHTdKgDfYhkmOxroBV0dmjyFcGuwWVQp0/VnB0SV6LaWkXQ9RZhVNeZEHhp95g LjxO90L4llIBvYvTqnnBuT7HHwoBNm4hlsSXDan9g2EoMRYEWi+zFDPtvNcwyrRW7I3t fr8iyegK9cUofZgSpSs484E3Usd8fJQEH1gTssbUpuPn5TdTAJrWW9A17TNDl4ED9boi DgGCnt3SaBIzQ0AxtlUlNvFcXMSTdcB0YSf0bvcTyOiqUgBwsL7EiFcR8T8iR3cq9BUn vwSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject:arc-authentication-results; bh=PUUB4b1m7L5ioMYAm85yAHtE1KHK9XKtyaglJkH8pgg=; b=xNW7UenPHidu6UybVbF9GGIgNf7WtI451oDXLstKcDPEDaxLow22M1fC36rgVblDpM eQmiUbETEZ/jnM09A4bNYYsrQeJoakbsmn60oi+G4wOZ5pMVuyyVrvurTPnzALHVdlcY ESbGCbjwQzlhEaTc17v/dhncxGxSniJZ8jqu7438L641xejpRZHhFODTHKrVFOCp6TH3 0xWDTsrVxsw3fSWDUuzMCdFZ4Ci5shOn+ZVpm7p2uUNeX8qnVhNYB40KWKLVwrUjoeES gwWhb0YUHuuzaoSalQcJKxohBwRUtkBb+HVP98s7u90CFHSq1B2VJss6tdoWpUl1MaWD 13qg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si4106350pgr.120.2017.11.08.09.13.58; Wed, 08 Nov 2017 09:14:10 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751975AbdKHRLX (ORCPT + 84 others); Wed, 8 Nov 2017 12:11:23 -0500 Received: from g9t1613g.houston.hpe.com ([15.241.32.99]:24628 "EHLO g9t1613g.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751168AbdKHRLV (ORCPT ); Wed, 8 Nov 2017 12:11:21 -0500 Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by g9t1613g.houston.hpe.com (Postfix) with ESMTPS id C0D3260133 for ; Wed, 8 Nov 2017 17:11:20 +0000 (UTC) Received: from G9W8456.americas.hpqcorp.net (g9w8456.houston.hp.com [16.216.161.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id 3029D61; Wed, 8 Nov 2017 17:11:20 +0000 (UTC) Received: from G2W6310.americas.hpqcorp.net (2002:10c5:4034::10c5:4034) by G9W8456.americas.hpqcorp.net (2002:10d8:a15f::10d8:a15f) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 8 Nov 2017 17:11:20 +0000 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (15.241.52.10) by G2W6310.americas.hpqcorp.net (16.197.64.52) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Wed, 8 Nov 2017 17:11:20 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=abanman@hpe.com; Received: from Andrews-MacBook-Pro.local (192.48.192.5) by AT5PR8401MB0355.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:741d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Wed, 8 Nov 2017 17:11:17 +0000 Subject: Re: [PATCH] drivers/char/ipmi_si: prevent null deref during module exit From: Andrew Banman To: Corey Minyard CC: Dimitri Sivanich , "Anderson, Russ" , Mike Travis , , References: <988aec06-2127-3120-47a4-5d0131f59a61@hpe.com> Message-ID: Date: Wed, 8 Nov 2017 11:11:10 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <988aec06-2127-3120-47a4-5d0131f59a61@hpe.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [192.48.192.5] X-ClientProxiedBy: CO2PR05CA0079.namprd05.prod.outlook.com (2603:10b6:102:2::47) To AT5PR8401MB0355.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:741d::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44fcbaf4-a0f9-4094-9b5b-08d526cbba43 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603199);SRVR:AT5PR8401MB0355; X-Microsoft-Exchange-Diagnostics: 1;AT5PR8401MB0355;3:g9WOjl++aYojHr6Prk7V/DOxy6tmhASWjoKxt33uQols/hlqaGRVVuX/p/5+ZZm/HttkVwVqJepNG9Iam6PHyqv8nNS+7UFDxeu9fZKHDX+geQy5BPDpmeihUST2J/bSAEjK71UVLe+yWU/yQhKRPJ68ylzaUipmfELfbm48bmO5E2NZ0ip/TtQ/CkpGtzGcse+MvNliTrqogIWFFTkm+ah26UayZGWnDRsur9eOYZHEMw+m4lAK0OxM4pCjgXuk;25:C87ljkV/2MohAgVTpFUTZYMRvn2GPIpVNQ95zGc7pF1jH6L9SBHZyEw68a8+8oIpkpeDOdKNOCSqoB+uT6H3vAm4iH7HskrOU4W0NVASHuBdCnB5H6mYFqwfjx9skxjkbMAoiE2xqgsJYI7V50ONeCZb6PXTBrDdfSVMG0GRnWiKHSXT/sTvteureISCebY74PKv0gq3bW5jv9NSivuJrUIGmnoi2xCCNHn+7NT0oH7lUJwFOD8REdPWTIDuhMFhmtUL0hLt1xIFNI5EPiTqz+b7nGN7HMIRLKXK/qcKBbCoLzf9Q/7e5Qe+3h/syX6TaFyzwwbN3fIgUJXRa+K29Q==;31:c8WjXnZ8kgREIaysC8oYoDOMIQ6VJbgTAx4AxVwDBBSXZkov1eOGf+hYs1NytwlhjUqrD/3CrUJqtqi2DGLPUVuZFaVWUdbUNaxN2j99V1JimoKxgyBMcuaMrjKzvmhMZlkU7Hvc4yzqAmEMZhMULB2uuRfTp+pfVmmljWmYUIYHmhjNg/ZNV4O0oXslKVi6YKINjjN1+oPdZHEV7EdPwdxWo/6awGCbEd5hLMQmirA= X-MS-TrafficTypeDiagnostic: AT5PR8401MB0355: X-Microsoft-Exchange-Diagnostics: 1;AT5PR8401MB0355;20:qkPbatVKQG1SZqWU7nzTHGORow3Ei6RlLFMvhcERt0u677zexMj4SRvtdvEYrhMxhK9F/14Qls4mJYNtzAedev64+r8mydNdQSmH/0WQiiYt67bmUgKZKTzO/7FDnAPFCu9adIQJJR7jK45PVzyRgoE0Ae5pneAWB5xxuYK77mSF/jcHV6R9iqE+6qFr1FAYvTBxBbyDFnIGMQKWQYLy+isIZQWIeTvWPqF4M6xZ2Bae2CufT1L4sVf/D7UYCT3aFjDnCMErTyT+E4qhB77LCw64Vx05l6wxf3J9UxmgbxinVfUayK+G48WUVHh7fXsl/tUuyeO3YLkfmt9y4Nu7GBw3fO8gdKnlUT2Uok+7pUdi/yOua4THIkhxYJpXKc4bx4WvL+LG+BE5Os7A3ixu0875vgOYqSZzPkeYEjeqNdfc3Z847UW/XsPn7xQ5cq35lhtOyNORExxZ5EuHB6O1KQ5ghEyP1jNJfm1T6Zrf7FtgD1D7jBwko4MbmQsEsHVp;4:fTMrSzUqj5x2gOLk/GDebE3HxbWweL6htuRjBtZSqCWQ/z8720kzOJE8zjMflzjWkhCwMx6AX5fGHRy3EbkeySEEkDE4r6xDG8PrnBzsYIvmXa7hBMiHCDU7KaWqeKVFI7s7MoUSnx2kmnZV0e0df/JEGFl9CZJGeoC9zd3+V9BXsA3U65hIeqJbjcjJXS8xEbDYYEqIuHnGxev107aB5QHHYKkF282E48J0lA2tC/9ep0Qm+QDyZ1kMYv3Y9fnozOSdzOI5YY0YlnLTO878Zqjdd+fEbMSsZY8g68WlcfZVpdsswffLuUB2cjNPwEdG X-Exchange-Antispam-Report-Test: UriScan:(227479698468861); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(3231021)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123558100)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:AT5PR8401MB0355;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:AT5PR8401MB0355; X-Forefront-PRVS: 0485417665 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(376002)(346002)(39860400002)(24454002)(199003)(189002)(54356999)(50986999)(305945005)(6506006)(76176999)(7736002)(6486002)(33646002)(97736004)(36756003)(53546010)(65956001)(4326008)(31686004)(106356001)(551934003)(105586002)(101416001)(83506002)(189998001)(25786009)(65806001)(50466002)(229853002)(66066001)(3846002)(8676002)(81156014)(478600001)(81166006)(67846002)(53936002)(6246003)(6116002)(47776003)(23676003)(31696002)(6512007)(2870700001)(86362001)(575784001)(16526018)(8936002)(5660300001)(2950100002)(316002)(65826007)(6916009)(54906003)(2906002)(64126003)(68736007)(58126008)(6666003);DIR:OUT;SFP:1102;SCL:1;SRVR:AT5PR8401MB0355;H:Andrews-MacBook-Pro.local;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBVDVQUjg0MDFNQjAzNTU7MjM6MWR0ZlVudTN0eG5xWk9TaENRS3BMZjZn?= =?utf-8?B?eDA1RmtCNk1mT0IvY01CR3EwT005RVBkb2pmMzN5Z0JxNzRtKzlVZHdQaEo4?= =?utf-8?B?U1ZRbE5hUEIwMXpZNWZTOU9MV1ovdjhqaXJpRE1OanVrNzE3aVN3L1ZpbXNG?= =?utf-8?B?eC9jR0lkU1JlVHNOZ0J0eEl5NnRST2MyL0VJYTJKREg3cWkrSyt1c3FjbjUw?= =?utf-8?B?K2FLbWRuVGs2b2thRzlDdExTbXRFNzlBakFSWXJXOHhkOFMvTXZVTUpKVVJp?= =?utf-8?B?YzhXOCswUnRCMmtWSlhmSDBHMmNkVUNkdEFROXFIYTFpbllMZlFZTWZ1NVJh?=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z2clpdjXgfmO8UBGX3lLM4z3pkA/3dPFR2Y/DQvElw48XH2BGtMGiSiKHLhb1J//LQClIW2i65A1ghtb+jmzCpVhN5vkbVxTuRgCNC4zw+mxJmquRCG0P6rbJtxvasR/vxFPmAF1e/kxK+Ph0+HwXQKynjGwtzNG65gN4=;5:QPqVhLTxUeGcdLgrEMKyqXnxZ8D8n0M2EQQXUZkhHRRxc9438LQWSDz0NrRu8Dg+XrZ5NPVnr2k9Av/uWOFLBviUNRoIV+b8lCjGSzdyCNXd8MuyqyaSN778qPi24NQmwJirfsSy/+lbo8Kdprs6P1Z7gxyykUb9k3g3rz5qnTA=;24:fB9zbXfdFs0zNbuMAY47CN0B7+3YH8DmM9G1ZRhKyYjWLLJ0AT2aJeLIDMMivG6surDKuIPTWxUUCM71I2y2k5q6XmhOwwurZIPc/6TCc+M=;7:MTeJ+6RBwKUAVnqzq9Df+mUgMs7/z5FEx4r47n60A0AZ2BJIBstT1Rxdk8AvpQh2HK2K+zEVi8wJ87XyhoDMPKD/CqYckNB19scQ3ycgFrlXQVr5kej6dde5Cipgv7kHFU9Zbx9QWXWyyYNznw5cbjBreRhhsc0hf3gmFMAacTGt8RGBjR3mT2wUvJDVhFowzWGkoXMhABBM6SoujdxvvkX9IhjTZnD5IzCc/RI90AsgTxGPGdhQWK3dPvNvdUVj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2017 17:11:17.3471 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44fcbaf4-a0f9-4094-9b5b-08d526cbba43 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: AT5PR8401MB0355 X-OriginatorOrg: hpe.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/8/17 11:06 AM, Andrew Banman wrote: > If there are uninitialized SMIs in the smi_infos list, i.e. with no > handlers set, then disable_si_irq() in cleanup_smi_one() will hit a null > pointer dereference when the former attempts to start the check enables > transaction. Thus, we panic during module exit. I think this points to a broader problem of holding uninitialized smi_info structs in smi_infos list. There are many places where handlers and other struct members are assumed. Maybe a better design would be to remove SMIs from the list if we have no intention of initializing them? Andrew > > Avoid panicking when there are uninitialized SMIs by checking for a handler > pointer before starting the check enables transaction. > > Signed-off-by: Andrew Banman > --- >  drivers/char/ipmi/ipmi_si_intf.c | 2 +- >  1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c > index cb5719e..6c0b1b3 100644 > --- a/drivers/char/ipmi/ipmi_si_intf.c > +++ b/drivers/char/ipmi/ipmi_si_intf.c > @@ -442,7 +442,7 @@ static void start_check_enables(struct smi_info *smi_info, > bool start_timer) > >      if (start_timer) >          start_new_msg(smi_info, msg, 2); > -    else > +    else if (smi_info->handlers) >          smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2); >      smi_info->si_state = SI_CHECKING_ENABLES; >  } From 1583518482341618947@xxx Wed Nov 08 17:08:26 +0000 2017 X-GM-THRID: 1583518482341618947 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread