From owner-freebsd-i386@FreeBSD.ORG Wed May 20 10:20:02 2009 Return-Path: Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 335411065678 for ; Wed, 20 May 2009 10:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0DF818FC1C for ; Wed, 20 May 2009 10:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n4KAK1S5092525 for ; Wed, 20 May 2009 10:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n4KAK15K092524; Wed, 20 May 2009 10:20:01 GMT (envelope-from gnats) Resent-Date: Wed, 20 May 2009 10:20:01 GMT Resent-Message-Id: <200905201020.n4KAK15K092524@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alexandr Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3509106566C for ; Wed, 20 May 2009 10:11:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 869988FC20 for ; Wed, 20 May 2009 10:11:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n4KABFPr080782 for ; Wed, 20 May 2009 10:11:15 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n4KABFXT080781; Wed, 20 May 2009 10:11:15 GMT (envelope-from nobody) Message-Id: <200905201011.n4KABFXT080781@www.freebsd.org> Date: Wed, 20 May 2009 10:11:15 GMT From: Alexandr To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: i386/134745: mmcsd.ko produce kernel panic X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2009 10:20:02 -0000 >Number: 134745 >Category: i386 >Synopsis: mmcsd.ko produce kernel panic >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-i386 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed May 20 10:20:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Alexandr >Release: FreeBSD 8-CURRENT >Organization: .masterhost >Environment: FreeBSD tim 8.0-CURRENT FreeBSD 8.0-CURRENT #5: Wed May 20 00:38:30 MSD 2009 root@tim:/usr/obj/usr/src/sys/GENERIC i386 >Description: Computer: Lenovo Thinkpad T61 Built-in card reader: sdhci0@pci0:21:0:2: class=0x080500 card=0x20c817aa chip=0x08221180 rev=0x21 hdr=0x00 vendor = 'Ricoh Company, Ltd.' device = 'R5C832, R5C843 SDA Standard Compliant SD Host Controller' class = base peripheral subclass = SD host controller mmc.ko, mmcsd.ko, sdhci.ko loaded as mobules into kernel Problem: Kernel panic after insert SD-card to card reader slot: Fatal trap 12: page fault while in kernel mode cpuid = 0; apic id = 00 fault virtual address = 0xffffffe8 fault code = supervisor read, page not present instruction pointer = 0x20:0xc0e42f7e stack pointer = 0x28:0xc1820be4 frame pointer = 0x28:0x0 <...> Stopped at mmcsd_attach+0xce: movl 0xffffffe8(%ebp),%eax >How-To-Repeat: Insert SD-card to hardware card controller >Fix: Patch attached with submission follows: diff -u mmc.old/mmc.c mmc/mmc.c --- mmc.old/mmc.c 2009-05-20 00:22:58.000000000 +0400 +++ mmc/mmc.c 2009-05-20 12:39:05.000000000 +0400 @@ -1448,7 +1448,7 @@ *(int *)result = ivar->csd.dsr_imp; break; case MMC_IVAR_MEDIA_SIZE: - *(off_t *)result = ivar->sec_count; + *(int *)result = ivar->sec_count; break; case MMC_IVAR_RCA: *(int *)result = ivar->rca; diff -u mmc.old/mmcsd.c mmc/mmcsd.c --- mmc.old/mmcsd.c 2009-05-20 00:22:58.000000000 +0400 +++ mmc/mmcsd.c 2009-05-20 12:44:21.000000000 +0400 @@ -137,7 +137,7 @@ d->d_drv1 = sc; d->d_maxsize = 4*1024*1024; /* Maximum defined SD card AU size. */ d->d_sectorsize = mmc_get_sector_size(dev); - d->d_mediasize = mmc_get_media_size(dev) * d->d_sectorsize; + d->d_mediasize = (off_t)mmc_get_media_size(dev) * d->d_sectorsize; d->d_stripeoffset = 0; d->d_stripesize = mmc_get_erase_sector(dev) * d->d_sectorsize; d->d_unit = device_get_unit(dev); Only in mmc: mmcsd.c~ diff -u mmc.old/mmcvar.h mmc/mmcvar.h --- mmc.old/mmcvar.h 2009-05-20 00:22:58.000000000 +0400 +++ mmc/mmcvar.h 2009-05-20 12:39:05.000000000 +0400 @@ -79,7 +79,7 @@ __BUS_ACCESSOR(mmc, var, MMC, ivar, type) MMC_ACCESSOR(dsr_imp, DSR_IMP, int) -MMC_ACCESSOR(media_size, MEDIA_SIZE, off_t) +MMC_ACCESSOR(media_size, MEDIA_SIZE, int) MMC_ACCESSOR(rca, RCA, int) MMC_ACCESSOR(sector_size, SECTOR_SIZE, int) MMC_ACCESSOR(tran_speed, TRAN_SPEED, int) >Release-Note: >Audit-Trail: >Unformatted: