From: Krzysztof Kozlowski <krzk@kernel.org>
To: 胡连勤 <hulianqin@vivo.com>,
"Michael Nazzareno Trimarchi" <michael@amarulasolutions.com>,
"Prashanth K" <quic_prashk@quicinc.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "quic_jjohnson@quicinc.com" <quic_jjohnson@quicinc.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"opensource.kernel" <opensource.kernel@vivo.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH v9] usb: gadget: u_serial: Add null pointer check in gs_read_complete & gs_write_complete
Date: Mon, 2 Sep 2024 18:16:06 +0200 [thread overview]
Message-ID: <329f65dd-a23b-460f-85ee-84fe674fe97d@kernel.org> (raw)
In-Reply-To: <TYUPR06MB6217DE28012FFEC5E808DD64D2962@TYUPR06MB6217.apcprd06.prod.outlook.com>
On 29/08/2024 13:54, 胡连勤 wrote:
> From: Lianqin Hu <hulianqin@vivo.com>
>
> Considering that in some extreme cases, when the unbind operation
> is being executed, gserial_disconnect has already cleared gser->ioport,
> triggering a gadget reconfiguration at this time and gs_read_complete
> gets called afterwards, which results in accessing null pointer,
> add a null pointer check to prevent this situation.
>
...
>
> static void gs_write_complete(struct usb_ep *ep, struct usb_request *req)
> {
> - struct gs_port *port = ep->driver_data;
> + struct gs_port *port;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&serial_port_lock, flags);
> + port = ep->driver_data;
> +
> + if (!port) {
> + spin_unlock_irqrestore(&serial_port_lock, flags);
> + return;
> + }
>
> spin_lock(&port->port_lock);
> + spin_unlock(&serial_port_lock);
You pinged us for this after 4 days. This is damn v9 and still
unresolved comments from previous review.
Explain, how did you resolve Greg's comment about this unintuitive code:
https://lore.kernel.org/all/2024082251-grief-profanity-b0da@gregkh/
Pattern of immediacy, rush and impatience was used in one of latest big
messes (just google about harassing open source maintainers by some
random contributors).
I suggest go back to drawing board and improve the code instead of
making it spaghetti without explanation, even though we asked for that
explanation.
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-09-02 16:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 11:54 [PATCH v9] usb: gadget: u_serial: Add null pointer check in gs_read_complete & gs_write_complete 胡连勤
2024-09-02 14:38 ` 答复: " 胡连勤
2024-09-02 16:08 ` Krzysztof Kozlowski
2024-09-03 2:23 ` 答复: " 胡连勤
2024-09-03 4:58 ` gregkh
2024-09-03 11:49 ` 答复: " 胡连勤
2024-09-03 12:05 ` gregkh
2024-09-02 16:16 ` Krzysztof Kozlowski [this message]
2024-09-03 6:26 ` gregkh
2024-09-03 11:58 ` 答复: " 胡连勤
2024-09-03 12:06 ` gregkh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=329f65dd-a23b-460f-85ee-84fe674fe97d@kernel.org \
--to=krzk@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=hulianqin@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michael@amarulasolutions.com \
--cc=opensource.kernel@vivo.com \
--cc=quic_jjohnson@quicinc.com \
--cc=quic_prashk@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox