From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9231DC432C2 for ; Wed, 25 Sep 2019 20:20:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A70B21D7A for ; Wed, 25 Sep 2019 20:20:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393058AbfIYUUD (ORCPT ); Wed, 25 Sep 2019 16:20:03 -0400 Received: from www62.your-server.de ([213.133.104.62]:60428 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727743AbfIYUUC (ORCPT ); Wed, 25 Sep 2019 16:20:02 -0400 Received: from [178.197.248.15] (helo=localhost) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1iDDlX-0001YE-IB; Wed, 25 Sep 2019 22:19:59 +0200 Date: Wed, 25 Sep 2019 22:19:59 +0200 From: Daniel Borkmann To: =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= Cc: Jonathan Lemon , netdev@vger.kernel.org, Alexei Starovoitov , kernel-team@fb.com, bpf , "Karlsson, Magnus" , syzkaller-bugs@googlegroups.com, syzbot+491c1b7565ba9069ecae@syzkaller.appspotmail.com Subject: Re: [PATCH net] bpf/xskmap: Return ERR_PTR for failure case instead of NULL. Message-ID: <20190925201959.GB9500@pc-63.home> References: <20190924162521.1630419-1-jonathan.lemon@gmail.com> <5f85df65-0f2e-3533-9734-147b0734e254@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5f85df65-0f2e-3533-9734-147b0734e254@intel.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.101.4/25583/Wed Sep 25 10:27:51 2019) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Tue, Sep 24, 2019 at 09:30:44PM +0200, Björn Töpel wrote: > On 2019-09-24 18:25, Jonathan Lemon wrote: > > When kzalloc() failed, NULL was returned to the caller, which > > tested the pointer with IS_ERR(), which didn't match, so the > > pointer was used later, resulting in a NULL dereference. > > > > Return ERR_PTR(-ENOMEM) instead of NULL. > > > > Reported-by: syzbot+491c1b7565ba9069ecae@syzkaller.appspotmail.com > > Fixes: 0402acd683c6 ("xsk: remove AF_XDP socket from map when the socket is released") > > Signed-off-by: Jonathan Lemon > > Thanks Jonathan! You beat me to it! :-P > > Acked-by: Björn Töpel Applied, thanks!