Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2209737pxb; Mon, 11 Jan 2021 04:04:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXJE3SO4t9WGXtXYBBBZsmH5Bj6EpxRe0Aw4P0pJ9Wm5Tx7WMDgxmJUPV3rpsW0XOQ4uZE X-Received: by 2002:a05:6402:17c6:: with SMTP id s6mr13662509edy.142.1610366666286; Mon, 11 Jan 2021 04:04:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610366666; cv=none; d=google.com; s=arc-20160816; b=fw13w37/p55CxtTWvcyHRFUNuzLD02eBGIQQXRogeyLug9Vclj8x1jExAfEgGSsYJR 4AD+qQgFsBUBDboQWq8H4R70KqnRJT/wl6NIbgFMDjyxQsGk6P8HBtgD9fLrQw0kIE5b ht4S6P3YkLu3Brb626GJ0hR2SgqCAHZhF5905CDOQyWs3WA7aUa/EevmjkIb5t6dMpd5 dWzGaQBshpVYsovxYqUwH59HRvC+Hfn8ouZUtCNmMz3gIr4s+3O572dHP/jdx0iZQ/MF vaY/gtF15fPp5GxI7ysabeP6TIfLkekRBXzOUd1agrIGQjsMlJE0DYuzuVE96WS0GCKm hwEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=9ieYypq7X2GmzVciYvi74C27yn430kLbSoztNMkJ1TI=; b=aifDHS7xYBGzqz4lmuoqD2zv5FG7mrX3KZvIiy9FbtXHqKThr3jamV5frGjW5AlQIr g6CPfk9r+YWwZe6iLOZmq6C/dFT5ANBFCNPxy+JqjkLzUkO5NbsmBuSo5cRi/UGAtwQZ CI8UNF7NvQAmVa1y0pXG+Cjy2OsSJ4b52eSIBZwVRAPuy8BoOU7VMrCQniu8lFakpUip rXcRSuHKYO1kj8lVosKmzYbnctqwuRycZXgezYHHHRpC1GWmBtf+c6pd+oXBaiClcL51 FW7I3h0Q6BaewtAtv6YvMhMsaBqT/FGNUM1Nx6WOnrzAxq7JjRyZdL/qUbflTp3ZZyxn Stqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si6685935edr.549.2021.01.11.04.03.55; Mon, 11 Jan 2021 04:04:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729902AbhAKMBP (ORCPT + 99 others); Mon, 11 Jan 2021 07:01:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:49112 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726807AbhAKMBP (ORCPT ); Mon, 11 Jan 2021 07:01:15 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 54F1FABC4; Mon, 11 Jan 2021 12:00:33 +0000 (UTC) Message-ID: <7d6dc09fedc84f9fce942d85c34d5cd41931bbf6.camel@suse.de> Subject: Re: [PATCH v2] can: mcba_usb: Fix memory leak when cancelling urb From: Oliver Neukum To: Bui Quang Minh , linux-usb@vger.kernel.org Cc: a.darwish@linutronix.de, bigeasy@linutronix.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, stern@rowland.harvard.edu, syzkaller-bugs@googlegroups.com, tglx@linutronix.de Date: Mon, 11 Jan 2021 13:00:31 +0100 In-Reply-To: <20210111104927.2561-1-minhquangbui99@gmail.com> References: <20210111104927.2561-1-minhquangbui99@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Montag, den 11.01.2021, 10:49 +0000 schrieb Bui Quang Minh: > In mcba_usb_read_bulk_callback(), when we don't resubmit or fails to > resubmit the urb, we need to deallocate the transfer buffer that is > allocated in mcba_usb_start(). > > Reported-by: syzbot+57281c762a3922e14dfe@syzkaller.appspotmail.com > Signed-off-by: Bui Quang Minh > --- > v1: add memory leak fix when not resubmitting urb > v2: add memory leak fix when failing to resubmit urb > > drivers/net/can/usb/mcba_usb.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c > index df54eb7d4b36..30236e640116 100644 > --- a/drivers/net/can/usb/mcba_usb.c > +++ b/drivers/net/can/usb/mcba_usb.c > @@ -584,6 +584,8 @@ static void mcba_usb_read_bulk_callback(struct urb *urb) > case -EPIPE: > case -EPROTO: > case -ESHUTDOWN: > + usb_free_coherent(urb->dev, urb->transfer_buffer_length, > + urb->transfer_buffer, urb->transfer_dma); > return; > Can you call usb_free_coherent() in what can be hard IRQ context? Regards Oliver