From patchwork Wed Jul 29 21:36:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 6896361 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 23C72C05AC for ; Wed, 29 Jul 2015 21:36:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5BF6E20625 for ; Wed, 29 Jul 2015 21:36:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 68C5E20624 for ; Wed, 29 Jul 2015 21:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754254AbbG2Vg3 (ORCPT ); Wed, 29 Jul 2015 17:36:29 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:18499 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753948AbbG2Vg2 (ORCPT ); Wed, 29 Jul 2015 17:36:28 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t6TLaNbf027441 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 29 Jul 2015 21:36:24 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t6TLaNgM027199 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 29 Jul 2015 21:36:23 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t6TLaNtg005025; Wed, 29 Jul 2015 21:36:23 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 29 Jul 2015 14:36:22 -0700 Date: Thu, 30 Jul 2015 00:36:05 +0300 From: Dan Carpenter To: "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] [SCSI] atp870u: 64 bit bug in probe() Message-ID: <20150729213605.GD21784@mwanda> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130904095002.GC13892@elgon.mountain> User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 64 bit CPUs there is a memory corruption bug on probe(). It should be a u32 pointer instead of an unsigned long pointer or we write past the end of the setupdata[] array. Signed-off-by: Dan Carpenter Reviewed-by: Hannes Reinecke --- Someone reported in 2003 that probe has a NULL deref so maybe it's related to this memory corruption? https://bugzilla.kernel.org/show_bug.cgi?id=1118 If only we had applied this patch when I originally sent it two years ago, then it would only be 10 years too late instead of 12! :P -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 05301bc..62acabd 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -2791,11 +2791,11 @@ next_fblk_885: p->global_map[m]= 0; for (k=0; k < 4; k++) { outw(n++,base_io + 0x3c); - ((unsigned long *)&setupdata[m][0])[k]=inl(base_io + 0x38); + ((u32 *)&setupdata[m][0])[k]=inl(base_io + 0x38); } for (k=0; k < 4; k++) { outw(n++,base_io + 0x3c); - ((unsigned long *)&p->sp[m][0])[k]=inl(base_io + 0x38); + ((u32 *)&p->sp[m][0])[k]=inl(base_io + 0x38); } n += 8; }