From patchwork Fri Sep 10 11:52:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 64381 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A95B4B7122 for ; Fri, 10 Sep 2010 21:53:00 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753292Ab0IJLwz (ORCPT ); Fri, 10 Sep 2010 07:52:55 -0400 Received: from mail-qw0-f46.google.com ([209.85.216.46]:50565 "EHLO mail-qw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753133Ab0IJLwy (ORCPT ); Fri, 10 Sep 2010 07:52:54 -0400 Received: by qwh6 with SMTP id 6so1367003qwh.19 for ; Fri, 10 Sep 2010 04:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=25jpVFSeBleL8p9kISPmpwW4nC29NjITY/YriHJuD6w=; b=QZWNzcz/b61BM22bemsAl3WVXr80FgJX+BdpmVDyxr6WdQOvatiDnrJwKfIDdMhNBE z4lnjKwMSLBXfr+Dewh+6OuXpYYAU3hmX1JG9Lnw/YV86+bGKFcrlDwALIS7/Wz1LXee qucuN01H0NomBGnepQuZx9+Dm5osSQvWQfAXc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=WVVLfIwTbzQYhid4Z8PiBS9NhRNBwP2lCcVhZ6U2yXQdYYYuiXKSpWPIhaBWUNbTUn j/7UvNir/0cA4hUkDvMrhah6EWVkiXI+4CmVsZTSUM3/3RK15cNzrmpNyAy+eSWEbRck fLP/vNRZINm9KvaGNdfmmf7J7+klh3WEG4iPE= Received: by 10.224.67.195 with SMTP id s3mr288962qai.179.1284119573295; Fri, 10 Sep 2010 04:52:53 -0700 (PDT) Received: from bicker ([41.205.146.22]) by mx.google.com with ESMTPS id t18sm2584489qco.20.2010.09.10.04.52.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 10 Sep 2010 04:52:51 -0700 (PDT) Date: Fri, 10 Sep 2010 13:52:34 +0200 From: Dan Carpenter To: Greg Rose Cc: "David S. Miller" , Jeff Kirsher , netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] ixgbevf: potential NULL dereference on allocation failure Message-ID: <20100910115234.GB5959@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If "rx_ring" is NULL then it will oops when we try: memcpy(rx_ring, adapter->rx_ring, adapter->num_rx_queues * sizeof(struct ixgbevf_ring)); Signed-off-by: Dan Carpenter --- To be honest, I'm not sure why the check for need_tx_update is there. This change has only been compile tested. -- To unsubscribe from this list: send the line "unsubscribe netdev" 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/net/ixgbevf/ethtool.c b/drivers/net/ixgbevf/ethtool.c index 4680b06..7f194aa 100644 --- a/drivers/net/ixgbevf/ethtool.c +++ b/drivers/net/ixgbevf/ethtool.c @@ -385,7 +385,7 @@ static int ixgbevf_set_ringparam(struct net_device *netdev, if (new_rx_count != adapter->rx_ring_count) { rx_ring = kcalloc(adapter->num_rx_queues, sizeof(struct ixgbevf_ring), GFP_KERNEL); - if ((!rx_ring) && (need_tx_update)) { + if (!rx_ring) { err = -ENOMEM; goto err_rx_setup; }