Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp4919lfv; Tue, 12 Apr 2022 14:58:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfknWxkHKhqP22iojkSqyMUTgAJCNdw3YqjmmoSb5aa9b13fMg2malz0XcDrujvGIhc0Vr X-Received: by 2002:a05:6a02:204:b0:399:1c4:3f45 with SMTP id bh4-20020a056a02020400b0039901c43f45mr31625581pgb.246.1649800726617; Tue, 12 Apr 2022 14:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649800726; cv=none; d=google.com; s=arc-20160816; b=PUYy6l1NZVMX86iTPVfB6ijqf0L6sxTyubMqhqGw7wKIVVl6Z5VVw5iMORQehv0yoM A7pJVEm3iG1Kbr24DrzSAWkm2WF7HID6VBwgUcfQQmmFuku7CjJRcUfoUdLT0SklBz2C of5NvCPg430sE0Ktb+qP65RloPYqUArSjSnCjCNYum0V0wZwDQZw2nFhy5Aw5KcHrTLH bWHth7JlhEq+Dhp9r9ypzxuZQDaMHUZcJqwR4p0GLKutZhgdTuzhRyjb7njOKxOwj4IX qtZy3ml/PHsNIbQS78yMnYWks1h76CWwiIc+xDrHNANQjGLoVZScr6+DytBvh5yFvMcj b66A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cPfG2H4mLBr47cKqUjnT59BLkTDD6UWYrmsvL4zHnIo=; b=m8LBrd0fAdONSBZ4ogWKSRuzDnaDXfdMRJtHmdwUDliYZR0v/BNXf1zRcmHIMvEwC6 GPu1siy0n/yOAH4b3SFgtCNBCSel9sG/Y2Gtl2g3+87Xq8QNMIUTCbcW97Ee3kZuLkBK 1Dd5DWBeEx0cVweLYUPqDGdMX5IwOGYQTmrNfWw8GZhtBkzDQ5Pyhpt+ywk9tZKK8CKH qKowCEFqAlaLqVOhi1cooyKvaunar7/fx+pwNcNMWZiPKXNfh1UKZ8d0kiutyeys1Zii LJnPpyeArmihNKDG9Xw74evJssBjqjXR4yhSsRy3Cwx8KScE8IXIMd74zDxLhi9KRQTw exsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Uy/bxAAu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id nn4-20020a17090b38c400b001c6fd746c71si17771398pjb.119.2022.04.12.14.58.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 14:58:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Uy/bxAAu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F1CF7143454; Tue, 12 Apr 2022 13:51:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347553AbiDKO6E (ORCPT + 99 others); Mon, 11 Apr 2022 10:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347584AbiDKO5o (ORCPT ); Mon, 11 Apr 2022 10:57:44 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76AF6165AF; Mon, 11 Apr 2022 07:55:30 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id g18so6485785ejc.10; Mon, 11 Apr 2022 07:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cPfG2H4mLBr47cKqUjnT59BLkTDD6UWYrmsvL4zHnIo=; b=Uy/bxAAuqZ9K+qdIhOn4QdDjCdOvTzCsHVj/zq6n0YUDbneYUdT+7RlMaHSomvuQBW jnPhQ5/JaFf4xtfN5tM4IyAoqhfaLouNXd7dXmpnztTU72lhDYzFr8hDDjv8Pb+DpZlb FSu3lcBq+HgrMUa98apFMFNJ5PZO5z/GTYiBrofm/5UWcfRyPey30K1PAwzH988nLf/9 5JLsBUgJuuz2UH2fYpob+Sun8G6kQ+vLRfdUxMt5GsLmO0I0C2Rnvnz+QfSa6JPUkDOo geSMpMAgN7mkvqTBVmKBo7WsyMsML6XOICzNloiJUGd6T3JtzpA2777VMAGBITmPiDr8 9yTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cPfG2H4mLBr47cKqUjnT59BLkTDD6UWYrmsvL4zHnIo=; b=RaMJFWDIa+6StXUjguJFvN8X+PQepFeZRjXgayrN9f4LCCoLejjY+9uZ4R1iB45MfB 8KcS8yovWlasTtWcYL/tZidksoGDn3UUJShAw3qEqt1l+G2IJyoQGwskinfBUk+ezHYh ummOPnxW0xUM6rFFboufPYhb0bEJG7dvpU8EVIR52LvrYTqeZSMMUC7MH1aJs5uHCI9o 2Kkqzu3yW4NMJwIPELAo1pdUKYx6X4hNufoEj4O+uZObBchbuWvR6tcrZq3/sp9lgN49 i/Qn3GkEg+VjmIBnYSwYgnt+2dDmqutciKBOvDLsk7iWD4Phcm9f3+5Yofkvij5+gIu7 P/yg== X-Gm-Message-State: AOAM530Yn3vWBh7SjDph0z2XB73RSMWruSnR7eCJ/mlqvbZdAUlG+Y/G 7acPfd3QjoMg4VVCo91UMUFP3sKlMwsW85D6CMw= X-Received: by 2002:a17:907:628e:b0:6d9:c6fa:6168 with SMTP id nd14-20020a170907628e00b006d9c6fa6168mr30299560ejc.132.1649688928772; Mon, 11 Apr 2022 07:55:28 -0700 (PDT) MIME-Version: 1.0 References: <20220409120901.267526-1-dzm91@hust.edu.cn> In-Reply-To: <20220409120901.267526-1-dzm91@hust.edu.cn> From: Andy Shevchenko Date: Mon, 11 Apr 2022 17:51:15 +0300 Message-ID: Subject: Re: [PATCH] driver: usb: nullify dangling pointer in cdc_ncm_free To: Dongliang Mu Cc: Oliver Neukum , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Dongliang Mu , syzbot+eabbf2aaa999cc507108@syzkaller.appspotmail.com, USB , netdev , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 10, 2022 at 5:14 AM Dongliang Mu wrote: > > From: Dongliang Mu > > cdc_ncm_bind calls cdc_ncm_bind_common and sets dev->data[0] > with ctx. However, in the unbind function - cdc_ncm_unbind, > it calls cdc_ncm_free and frees ctx, leaving dev->data[0] as > a dangling pointer. The following ioctl operation will trigger > the UAF in the function cdc_ncm_set_dgram_size. First of all, please use the standard form of referring to the func() as in this sentence. > Fix this by setting dev->data[0] as zero. > > ================================================================== > BUG: KASAN: use-after-free in cdc_ncm_set_dgram_size+0xc91/0xde0 > Read of size 8 at addr ffff8880755210b0 by task dhcpcd/3174 > Please, avoid SO noisy commit messages. Find the core part of the traceback(s) which should be rarely more than 5-10 lines. ... The code seems fine. -- With Best Regards, Andy Shevchenko