From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755247AbcH2T2w (ORCPT ); Mon, 29 Aug 2016 15:28:52 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:45508 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752237AbcH2T2u (ORCPT ); Mon, 29 Aug 2016 15:28:50 -0400 Date: Mon, 29 Aug 2016 12:28:46 -0700 From: Guenter Roeck To: Dave Jones , linux-kernel@vger.kernel.org, Jean Delvare , linux-hwmon@vger.kernel.org Subject: Re: it87: NULL terminate attribute list. Message-ID: <20160829192846.GB7316@roeck-us.net> References: <20160829161131.zelpth64i6z4tdl2@codemonkey.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160829161131.zelpth64i6z4tdl2@codemonkey.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dave, On Mon, Aug 29, 2016 at 12:11:31PM -0400, Dave Jones wrote: > Without the termination, we walk off the end of the list, which is usually > harmless, but KASAN spews this.. > Fix already provided by Jean and queued. I'll send it to Linus tonight or tomorrow. Thanks, Guenter > BUG: KASAN: global-out-of-bounds in internal_create_group+0x75b/0x970 at addr ffffffffae2d59c8 > Read of size 8 by task swapper/0/1 > Address belongs to variable it87_attributes_in+0x168/0x1a0 > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.8.0-rc4-firewall+ #1 > ffffffffae2d59c8 ffff8801d352f4f0 ffffffffac90ee56 ffff8801d352f588 > ffffffffae2d59c8 ffff8801d352f578 ffffffffac442ccd 0000000000001000 > ffffffffae2d93c0 ffffffffadab6d20 0000000000000297 ffffffffac59b19c > Call Trace: > [] dump_stack+0x68/0x92 > [] kasan_report_error+0x4dd/0x500 > [] ? __kernfs_create_file+0x1dc/0x280 > [] __asan_report_load8_noabort+0x44/0x50 > [] ? internal_create_group+0x75b/0x970 > [] internal_create_group+0x75b/0x970 > [] sysfs_create_groups+0x91/0x120 > [] device_add+0xe56/0x13e0 > [] ? device_private_init+0x1a0/0x1a0 > [] ? __init_waitqueue_head+0x41/0xa0 > [] ? pm_runtime_init+0x35f/0x450 > [] device_register+0x1a/0x20 > [] hwmon_device_register_with_groups.part.4+0x1cf/0x2b0 > [] hwmon_device_register_with_groups+0x84/0xa0 > [] devm_hwmon_device_register_with_groups+0x6c/0xd0 > [] it87_probe+0x154d/0x2aa0 > [] ? debug_smp_processor_id+0x17/0x20 > [] ? get_lock_stats+0x1e/0xa0 > [] ? show_vid_reg+0xd0/0xd0 > [] ? devices_kset_move_last+0x79/0x90 > [] ? acpi_dev_pm_attach+0x45/0x179 > [] platform_drv_probe+0x83/0x170 > [] ? devices_kset_move_last+0x79/0x90 > [] driver_probe_device+0x1f2/0x730 > [] __device_attach_driver+0x183/0x240 > [] ? __driver_attach+0x1a0/0x1a0 > [] bus_for_each_drv+0x11f/0x1c0 > [] ? subsys_find_device_by_id+0x330/0x330 > [] ? _raw_spin_unlock_irqrestore+0x43/0x70 > [] __device_attach+0x1cc/0x2a0 > [] ? device_bind_driver+0xc0/0xc0 > [] ? kobject_uevent_env+0x22c/0xb40 > [] device_initial_probe+0x13/0x20 > [] bus_probe_device+0x1c4/0x270 > [] device_add+0x8b7/0x13e0 > [] ? device_private_init+0x1a0/0x1a0 > [] ? preempt_count_sub+0x10b/0x1e0 > [] ? _raw_write_unlock+0x31/0x50 > [] platform_device_add+0x27c/0x5f0 > [] sm_it87_init+0xabe/0xba9 > [] ? coretemp_init+0x465/0x465 > [] ? ktime_get+0xee/0x2a0 > [] ? coretemp_init+0x465/0x465 > [] ? coretemp_init+0x465/0x465 > [] do_one_initcall+0xf5/0x1e5 > [] ? start_kernel+0x594/0x594 > [] ? parse_args+0x42e/0x850 > [] ? __usermodehelper_set_disable_depth+0x42/0x50 > [] kernel_init_freeable+0x422/0x4b3 > [] kernel_init+0x14/0x120 > [] ret_from_fork+0x1f/0x40 > [] ? rest_init+0x160/0x160 > Memory state around the buggy address: > ffffffffae2d5880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > ffffffffae2d5900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > >ffffffffae2d5980: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa > ^ > ffffffffae2d5a00: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 > ffffffffae2d5a80: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa > ================================================================== > > Signed-off-by; Dave Jones > > diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c > index d0203a115eff..89685845abaa 100644 > --- a/drivers/hwmon/it87.c > +++ b/drivers/hwmon/it87.c > @@ -2015,6 +2015,7 @@ static struct attribute *it87_attributes_in[] = { > &sensor_dev_attr_in10_input.dev_attr.attr, /* 41 */ > &sensor_dev_attr_in11_input.dev_attr.attr, /* 41 */ > &sensor_dev_attr_in12_input.dev_attr.attr, /* 41 */ > + NULL, > }; > > static const struct attribute_group it87_group_in = {