Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1594443pxb; Mon, 12 Apr 2021 01:46:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNarUVLiSA0PSQWLyt5hCDdCeAJaq+e95hpJcyDitB5Y7Y1IvY80+mvtf0ZkXFIDEtzrRP X-Received: by 2002:a17:90a:43a4:: with SMTP id r33mr27800114pjg.119.1618217189961; Mon, 12 Apr 2021 01:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618217189; cv=none; d=google.com; s=arc-20160816; b=lObwY5lhh9O4eoE1vk27SUaye0cf7dxFb9F9c/HRXXxFz/jV4Nl/q//Icad6p3xMQm NPEBoGV0AtEcY8avjm0h41gYbDH/x1UvJBY1tF/SYu+pu08A+EpVi1Uzrl616QMqZhQv gRMvl/uEIZ1J5L5AnLGsRduZr1Gh83m+89in3Um/nejJF1HM1Wwb8T2nTIKEvrhmGO+B BN17veK9wwRdTDodbyw+SoNo7uNago4e5h2bMP/Wu/NirTBt/7jkzbJ0bKt/wbSuPLQN WuIUFzO8byn1dL4dbnV7RIe7duRnwhSobLIF5BxeZmcPDCLUcxha/UBSmrqTaPkYiEjg fmow== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=2DQYkJMQ9ndpQtWxgUZkesZRlPyC0HF0elowsG9j9Q4=; b=PZqi0H71p1RLqA4A0HUYruAxyXjbPPtQI5IPz+znKy6gvp0Ekmnn1lQDXNVJmImN6y f88MmmcAq0mXCFSULdvR5T7ociKq40pXiGmVbFjhCbV1/knYgwvji/qW/DBBQcefA9sK ytREmo2wMDGpn59JHadBmvkv6SCtuneUJr4R8zTmh5KevVl8qFuym70MtVnuX6Kcl2k/ tUyCcjD0U40JpalsZ9CNRvWGBfpJqMmEQov7+KppwfSIS6fzkfHsujl22w2HPKknajkS pZD9zj4hypmKA8JlYe/vwhi1yh9Lz1I3dJCVuKBWOejAA9KwpTO0VMfEP1szpb9eplZR e5qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cOYc3sLO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si12999127pgv.54.2021.04.12.01.46.17; Mon, 12 Apr 2021 01:46:29 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cOYc3sLO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237780AbhDLIp0 (ORCPT + 99 others); Mon, 12 Apr 2021 04:45:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:36784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237684AbhDLIoj (ORCPT ); Mon, 12 Apr 2021 04:44:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A457A61244; Mon, 12 Apr 2021 08:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217061; bh=8XOWMIPBmbKHHSR25LAe+Vbq5bi2Pt9pxj3t3k7/gQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cOYc3sLO2yKTxIvIjdKrWqLmJnvMdu1X3ps8rUe5rGwW8PDbz7xLtPtu/jOx/yiB0 cocrEs8a2hmkrYbp52oBi2Z9bxbnkOREPQr24H3udMabMBze8bDxPqOVHZnCDR8mbw 8vuSkfIoaVYW/VgpgHlOWjYr2H2tov558rt+yVcI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+28a246747e0a465127f3@syzkaller.appspotmail.com, Pavel Skripkin , "David S. Miller" Subject: [PATCH 4.19 55/66] drivers: net: fix memory leak in atusb_probe Date: Mon, 12 Apr 2021 10:41:01 +0200 Message-Id: <20210412083959.905504178@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412083958.129944265@linuxfoundation.org> References: <20210412083958.129944265@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Skripkin commit 6b9fbe16955152626557ec6f439f3407b7769941 upstream. syzbot reported memory leak in atusb_probe()[1]. The problem was in atusb_alloc_urbs(). Since urb is anchored, we need to release the reference to correctly free the urb backtrace: [] kmalloc include/linux/slab.h:559 [inline] [] usb_alloc_urb+0x66/0xe0 drivers/usb/core/urb.c:74 [] atusb_alloc_urbs drivers/net/ieee802154/atusb.c:362 [inline][2] [] atusb_probe+0x158/0x820 drivers/net/ieee802154/atusb.c:1038 [1] Reported-by: syzbot+28a246747e0a465127f3@syzkaller.appspotmail.com Signed-off-by: Pavel Skripkin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ieee802154/atusb.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ieee802154/atusb.c +++ b/drivers/net/ieee802154/atusb.c @@ -368,6 +368,7 @@ static int atusb_alloc_urbs(struct atusb return -ENOMEM; } usb_anchor_urb(urb, &atusb->idle_urbs); + usb_free_urb(urb); n--; } return 0;