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=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no 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 6406FC433E0 for ; Tue, 7 Jul 2020 13:18:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34A952075B for ; Tue, 7 Jul 2020 13:18:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594127892; bh=cyNJ9qwwemY4pAbK1IlAj5ok8N/j5XNwwuq1OCBFkTc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=qWRjikTMBSwiEDA9KZ3NVGBiW41c1s7lWqbFmP8ugIOUJ+ByAJVqFCuEyvDlAZjXo yklP6X+2YInaVEkHnQn3B9zDKVRFWBbUOrh/xMF4vt3h5knowKg7bhw+79KDtzD+AO IqxlAUYr6YxjuHBop6BFH+WXhfIjfNpuTO4Pqzak= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726839AbgGGNSH (ORCPT ); Tue, 7 Jul 2020 09:18:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:49958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbgGGNSH (ORCPT ); Tue, 7 Jul 2020 09:18:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A17B02075B; Tue, 7 Jul 2020 13:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594127887; bh=cyNJ9qwwemY4pAbK1IlAj5ok8N/j5XNwwuq1OCBFkTc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Fz0rxZ+oVnk0uZQa8v9/0bbqeqiKNnJn0xNd79mhEOq/pjAwefuuyoD7O7hk9eOCn dHqNrF3BHouliVtJw8zVmTp9mI7QrePof8yOIDr7/qIN4iaWXpKkqeCU28H8ulZDaS Z4USTr4oR9u3a6FneiDpMIRNM2rQZf2TYBZMRUGk= Date: Tue, 7 Jul 2020 15:18:05 +0200 From: Greg Kroah-Hartman To: Kars Mulder Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Pavel Machek , David Laight , Kai-Heng Feng , Andy Shevchenko , Oliver Neukum Subject: Re: [PATCH v2] usb: core: fix quirks_param_set() writing to a const pointer Message-ID: <20200707131805.GB2890036@kroah.com> References: <2eb7-5f046f80-f7-5cdcc200@136674391> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2eb7-5f046f80-f7-5cdcc200@136674391> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Tue, Jul 07, 2020 at 02:51:02PM +0200, Kars Mulder wrote: > The function quirks_param_set() takes as argument a const char* pointer > to the new value of the usbcore.quirks parameter. It then casts this > pointer to a non-const char* pointer and passes it to the strsep() > function, which overwrites the value. > > Fix this by creating a copy of the value using kstrdup() and letting > that copy be written to by strsep(). > > Fixes: 027bd6cafd9a ("usb: core: Add "quirks" parameter for usbcore") > Signed-off-by: Kars Mulder > > --- > drivers/usb/core/quirks.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) What changed from v1? Always put that below the --- line like the documentation asks. Please fix up and resend a v3. thanks, greg k-h