Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751522Ab2KIIsK (ORCPT ); Fri, 9 Nov 2012 03:48:10 -0500 Received: from mail-wg0-f44.google.com ([74.125.82.44]:43842 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750812Ab2KIIsI (ORCPT ); Fri, 9 Nov 2012 03:48:08 -0500 Message-ID: <509CC342.80700@redhat.com> Date: Fri, 09 Nov 2012 09:48:02 +0100 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: Eric Northup CC: "James E.J. Bottomley" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH] virtio_scsi: fix memory leak on full queue condition. References: <1352368550-6694-1-git-send-email-digitaleric@google.com> In-Reply-To: <1352368550-6694-1-git-send-email-digitaleric@google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1174 Lines: 34 Il 08/11/2012 10:55, Eric Northup ha scritto: > virtscsi_queuecommand was leaking memory when the virtio queue was full. > > Tested: Guest operates correctly even with very small queue sizes, validated > we're not leaking kmalloc-192 sized allocations anymore. > > Signed-off-by: Eric Northup > --- > drivers/scsi/virtio_scsi.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c > index 595af1a..dd8dc27 100644 > --- a/drivers/scsi/virtio_scsi.c > +++ b/drivers/scsi/virtio_scsi.c > @@ -469,6 +469,8 @@ static int virtscsi_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) > sizeof cmd->req.cmd, sizeof cmd->resp.cmd, > GFP_ATOMIC) >= 0) > ret = 0; > + else > + mempool_free(cmd, virtscsi_cmd_pool); > > out: > return ret; > Acked-by: Paolo Bonzini Paolo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/