Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp860712ybm; Wed, 22 May 2019 12:50:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzZfsv3gmksO+A/OzpmeV8YahncVrcoFITo+/d9W7CcQjv3Ok+qt+KY8DBdmeACgmQnX/c X-Received: by 2002:a63:2c50:: with SMTP id s77mr4879162pgs.175.1558554610602; Wed, 22 May 2019 12:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558554610; cv=none; d=google.com; s=arc-20160816; b=BKwioTvtevbaQd4orlYMGYRR2oY7KqIRWOd7KcgyToLTpexxyABIOCYdk+kOSS5+xW xbpI7S616pPPvw1eC4miXMLi3cWuFWOslj15KmvFbC7TQOM81EsTlyu5S/Oi37mLSJnF qnngBjCOikDIJhu3IadO9aqrXSQg8XKDOlARwepNTmhU+Zs43h4on5+hUad1PLPki41H n9CROcIpIHm7J8XiY8jHV8cQsy+eyN/A5ZrzhA5Pf0XJa1yISxoLjaSjRSZQy3SgjD6G +dq6DmFKuGR5JdH/3R9T7A6+RRHik+tvTYuHhz1I9aVG+MfJM94d7xAA1Yoewuvcp553 uIJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vd+/4uDJStvAKiQaCLjcw2smiHR+BqrdulLPjaj1hLU=; b=wtqdxtEPbgpX8660oGRFHybiq/zMPOceq2RMVx1K47ZyP0kTcGyMDXRkUHrRidOLKv LAFLCAFVqjDbc2Tk4JYsaNU1RcnO95irJCTRUzBq8CIJrjfGYBbtEhiJyK/QUs4NILEt d8pi8F0+JfY8oEX2iFl69udUMVR7K29GGEsV8so7NR/fa5+dfjnDfRqsX8eSfq1Q7/YT WUOqELIGj/BA7E2lWU2J5bkfCnnmK9nprXN/v8lcFgLUHKU8Rr86MXCwhFJqqA5VHqZp rJKwfcTnInpvUn/YHgMAXJ3DHN/bQEEDAXjZ7KKay+S183pTvEYXzA1+rT8AYqNHDCnS pYWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a194si30001575pfd.58.2019.05.22.12.49.55; Wed, 22 May 2019 12:50:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387913AbfEVTry (ORCPT + 99 others); Wed, 22 May 2019 15:47:54 -0400 Received: from nautica.notk.org ([91.121.71.147]:40778 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732565AbfEVTru (ORCPT ); Wed, 22 May 2019 15:47:50 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id EC896C009; Wed, 22 May 2019 21:47:48 +0200 (CEST) Date: Wed, 22 May 2019 21:47:33 +0200 From: Dominique Martinet To: Bharath Vedartham Cc: ericvh@gmail.com, lucho@ionkov.net, linux-kernel@vger.kernel.org, v9fs-developer@lists.sourceforge.net Subject: Re: [PATCH v2] 9p/cache.c: Fix memory leak in v9fs_cache_session_get_cookie Message-ID: <20190522194733.GA4766@nautica> References: <20190522194519.GA5313@bharath12345-Inspiron-5559> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190522194519.GA5313@bharath12345-Inspiron-5559> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Bharath Vedartham wrote on Thu, May 23, 2019: > v9fs_cache_session_get_cookie assigns a random cachetag to v9ses->cachetag, > if the cachetag is not assigned previously. > > v9fs_random_cachetag allocates memory to v9ses->cachetag with kmalloc and uses > scnprintf to fill it up with a cachetag. > > But if scnprintf fails, v9ses->cachetag is not freed in the current > code causing a memory leak. > > Fix this by freeing v9ses->cachetag it v9fs_random_cachetag fails. > > This was reported by syzbot, the link to the report is below: > https://syzkaller.appspot.com/bug?id=f012bdf297a7a4c860c38a88b44fbee43fd9bbf3 > > Reported-by: syzbot+3a030a73b6c1e9833815@syzkaller.appspotmail.com > Signed-off-by: Bharath Vedartham Thanks! I'm on limited internet right now but will run tests and queue this up tomorrow -- Dominique