From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752392Ab3LYTPo (ORCPT ); Wed, 25 Dec 2013 14:15:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28802 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752268Ab3LYTPn (ORCPT ); Wed, 25 Dec 2013 14:15:43 -0500 Date: Wed, 25 Dec 2013 21:19:32 +0200 From: "Michael S. Tsirkin" To: Michael Dalton Cc: netdev@vger.kernel.org, David Miller , Rusty Russell , Eric Dumazet , Jason Wang , lf-virt , linux-kernel@vger.kernel.org Subject: Re: [PATCH stable 1/2] virtio_net: fix error handling for mergeable buffers Message-ID: <20131225191932.GB22071@redhat.com> References: <1387983339-1172-1-git-send-email-mst@redhat.com> <1387983339-1172-2-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 25, 2013 at 10:33:37AM -0800, Michael Dalton wrote: > Hi Michael, quick question below: > > On Wed, Dec 25, 2013 at 6:56 AM, Michael S. Tsirkin wrote: > > if (i >= MAX_SKB_FRAGS) { > > pr_debug("%s: packet too long\n", skb->dev->name); > > skb->dev->stats.rx_length_errors++; > > - return -EINVAL; > > + return NULL; > > } > > Should this error handling path free the SKB before returning NULL? > It seems like if we just return NULL we may leak memory. > > Best, > > Mike It's a device error, but I agree, if we touch this code anyway there's no reason not to handle this consistently and do goto toward end of file. It's not a backport anymore though - this code is gone upstream, so I'll make it a separate patch I think. -- MST