From patchwork Sat Mar 28 03:23:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle McMartin X-Patchwork-Id: 25257 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.176.167]) by ozlabs.org (Postfix) with ESMTP id B8D13DDEFE for ; Sat, 28 Mar 2009 14:23:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754224AbZC1DXf (ORCPT ); Fri, 27 Mar 2009 23:23:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753882AbZC1DXf (ORCPT ); Fri, 27 Mar 2009 23:23:35 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:33242 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752985AbZC1DXe (ORCPT ); Fri, 27 Mar 2009 23:23:34 -0400 Received: from kyle by bombadil.infradead.org with local (Exim 4.69 #1 (Red Hat Linux)) id 1LnP8u-0002a7-KQ; Sat, 28 Mar 2009 03:23:32 +0000 Date: Fri, 27 Mar 2009 23:23:32 -0400 From: Kyle McMartin To: netdev@vger.kernel.org Cc: Dan Carpenter , grundler@parisc-linux.org Subject: Re: Null dereference in uli526x_rx_packet() Message-ID: <20090328032332.GA22353@bombadil.infradead.org> References: <20090328024754.GA16554@bombadil.infradead.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090328024754.GA16554@bombadil.infradead.org> 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 On Fri, Mar 27, 2009 at 10:47:54PM -0400, Kyle McMartin wrote: > > I don't know if the right fix is to return like this patch does or to set > > skb = rxptr->rx_skb_ptr again. > > > > Ick... that's a good catch. I'll have to think about this. > I think this is alright, it at least keeps the original intent of the code. I don't pretend to have figured it out yet though. I'll stare more at this Monday... I guess the real question is does anyone still have one of these cards. I don't think I do, just the proper tulips. :/ Acked-by: Grant Grundler --- 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/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 030e02e..9264a58 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c @@ -840,13 +840,15 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info if ( !(rdes0 & 0x8000) || ((db->cr6_data & CR6_PM) && (rxlen>6)) ) { + struct sk_buff *new_skb = NULL; + skb = rxptr->rx_skb_ptr; /* Good packet, send to upper layer */ /* Shorst packet used new SKB */ - if ( (rxlen < RX_COPY_SIZE) && - ( (skb = dev_alloc_skb(rxlen + 2) ) - != NULL) ) { + if ((rxlen < RX_COPY_SIZE) && + ((new_skb = dev_alloc_skb(rxlen + 2) != NULL))) { + skb = new_skb; /* size less than COPY_SIZE, allocate a rxlen SKB */ skb_reserve(skb, 2); /* 16byte align */ memcpy(skb_put(skb, rxlen),