Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2676818pxj; Mon, 17 May 2021 07:18:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDs/8Amg+3JlPhY9+aXWWzBOr03jrMmltc2/cKmwfTvrKgD4s3jzE3WW1WuaI8YDMe1RVk X-Received: by 2002:a17:906:9bf3:: with SMTP id de51mr149013ejc.394.1621261109516; Mon, 17 May 2021 07:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621261109; cv=none; d=google.com; s=arc-20160816; b=rpFY6iPlKjnogNg7Ecehcg+9ReUBFn/KYfDzerSUQhb2/cs2RAuVaa3dmhW6PdtXou FZOAIBtAuxlf6kQmJ+PjkDAkeZD5N5MIxVfNBqTrjoJhkE+YMnhFcp7QhKNsePdwGSl5 7PMv6lTTEdfMH0CGjStVHn1BHV0s7AVLKGkoE5fX1sKYGzaWrnpcQhTUvMBDCAKzeZHw xI3jUV3h5d5Nvaf0ktVMMq5XLBGxskzv1ScnLnD1ghBNNvUyJz6mfSlr/VpUwP109Kfq v3ATvxqE/Bjsuh1NWxa5ZiWaCmxP60Q/ltOHmndzuBMLOnzKgtiNFDvI1zgcq4KyyIEP omKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=T299hw2nrjetWllzvpwXf6H+9SfZqQxyFY9qbEw8OLc=; b=xujm39bhdOU93lorviqhkuThk7Q6TPe6JfdyyRHpJm0lUmoRoNZ0R+xeqT/wuVadMq uf1FETaK8Z9iUtnfqsLz3ajB+hfS2p0JYgrwNTa33RmJuiZHvjH/BEdDq6sJmOISSytk 6/8R7p3KeaZFaUN2+C58yJuQrVh/BcyRLJgzZmSU7HOayqnx7iVN+7eksiP3ubg2IzGf cLxcg5TgUanFALeLtZGwBWCQ+BpMCxyk2zF7Ej1GbwRronuzHib7qJyzJrw+AYss7b7G woe4hwNUgjFSBURey7oVILs5TyclYysDlH04OcipRec5bqXGqUwOSxYoso9iD4L4xApU MPWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hv4ocnTu; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si774848ejc.165.2021.05.17.07.18.06; Mon, 17 May 2021 07:18: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=@gmail.com header.s=20161025 header.b=hv4ocnTu; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235999AbhEQN2w (ORCPT + 99 others); Mon, 17 May 2021 09:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235885AbhEQN2t (ORCPT ); Mon, 17 May 2021 09:28:49 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33690C061573 for ; Mon, 17 May 2021 06:27:32 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id g24so3669122pji.4 for ; Mon, 17 May 2021 06:27:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=T299hw2nrjetWllzvpwXf6H+9SfZqQxyFY9qbEw8OLc=; b=hv4ocnTuuIi59K2Wus0fnCTAWIitgTfuwTZXxeM0ySr5nfPSbcT6zbh5esq/SGRAcp gH/jqPYgyNZQlYzzoH60815biA/GWrYneI+vIKZEzb4lnYUP2Rej7ipdVb/Ks/WtMOon TjW8GdHgQUCJhtZBWU/OXjJqHcz6fUaHqTWYdnQ41hQq91NeMI+zTFt6/SRIo9tqKRz9 JIOvtSc0tGNEimGGUprDxhtgowPiQsVMr6bdxDxr2AM6IIQZw8m68b1JhddpDdYK/t08 8fiixau7juQxF6FOSfboTkahD1h2oPNaijU3N1NEN5cnMM3uJv3TGxGZaalvF3spKUeL SHsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=T299hw2nrjetWllzvpwXf6H+9SfZqQxyFY9qbEw8OLc=; b=CWepDcAtCyH9YvAfL8TFuwjNy1964HKF0vvsf11ag8tojrmiC1KyenfXicE4TWaeJD LcCpr7azHpsT/bYmyA+uWRz+8C4ZdO0hsYnWu5wLvZ6Xqxlr7tS+q9gZFjazgtzfcMov TKgELTjT3vgrYBvGsimfPfoKFz9a1O/NOmnStQA/jj5VStpcDsN5KmwN9z2uIW7FXQZj 7KhWyy72/74EhUY4e9WTEtbL0n5NQbfB0BcEJpYSb+aBs1iT+MnaV9dbFLqQQ54rbv29 edeBe/JtcndprIJJkGSmoQyoivgNlZpyVTVyoHt27JHVsZf0dHcdGMhe9hXtz1p+5hd0 ry8Q== X-Gm-Message-State: AOAM533p2y80tLyCbYdxgFxear52teUtX+AxYgrDN4wulp3e3mnE4qW4 JE/RbgYIiO+DYWfvunI5+ws= X-Received: by 2002:a17:90b:1e43:: with SMTP id pi3mr68345190pjb.51.1621258051832; Mon, 17 May 2021 06:27:31 -0700 (PDT) Received: from hyeyoo ([121.135.181.35]) by smtp.gmail.com with ESMTPSA id h19sm10504525pgm.40.2021.05.17.06.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 06:27:31 -0700 (PDT) Date: Mon, 17 May 2021 22:27:25 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Jaroslav Kysela , Takashi Iwai , Greg Kroah-Hartman , Oliver Neukum , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Vasily Khoruzhick Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] sound: line6: Fix race condition in line6_probe Message-ID: <20210517132725.GA50495@hyeyoo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org syzbot reported general protection fault in midibuf_is_full. the cause is linemidi pointer in struct usb_line6 isn't properly initialized. the pointer isn't initialized because there is race condition in line6_probe. it calls line6_init_cap_control first, which submits urb. and then it initializes it's data using private_init function. so it's possible line6_data_received is called before it's data isn't initialized. Link: https://lkml.org/lkml/2021/5/17/543 Reported-by: syzbot+0d2b3feb0a2887862e06@syzkallerlkml..appspotmail.com Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- sound/usb/line6/driver.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index a030dd65eb28..2c183a2a30f0 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c @@ -788,17 +788,17 @@ int line6_probe(struct usb_interface *interface, line6_get_usb_properties(line6); + /* initialize device data based on device: */ + ret = private_init(line6, id); + if (ret < 0) + goto error; + if (properties->capabilities & LINE6_CAP_CONTROL) { ret = line6_init_cap_control(line6); if (ret < 0) goto error; } - /* initialize device data based on device: */ - ret = private_init(line6, id); - if (ret < 0) - goto error; - /* creation of additional special files should go here */ dev_info(&interface->dev, "Line 6 %s now attached\n", -- 2.25.1