mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: "Bryan Wu" <cooloney@kernel.org>
Cc: "Jie Zhang" <jie.zhang@analog.com>,
	harvey.harrison@gmail.com, david-b@pacbell.net, greg@kroah.com,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] [usb/host]: use get/put_unaligned_* helpers to fix more potential unaligned issues.
Date: Thu, 15 May 2008 14:19:14 +0200	[thread overview]
Message-ID: <200805151419.16026.oliver@neukum.org> (raw)
In-Reply-To: <386072610805150254p6161627er9f99910066287f2f@mail.gmail.com>

Am Donnerstag 15 Mai 2008 11:54:51 schrieb Bryan Wu:
> On Thu, May 15, 2008 at 5:15 PM, Jie Zhang <jie.zhang@analog.com> wrote:
> > Oliver Neukum wrote:
> >>
> >> Am Donnerstag 15 Mai 2008 10:03:35 schrieb Jie Zhang:
> >>>
> >>> Oliver Neukum wrote:
> >>>>
> >>>> Am Donnerstag 15 Mai 2008 08:19:24 schrieb Bryan Wu:
> >>>>>
> >>>>> --- a/drivers/usb/host/uhci-hub.c
> >>>>> +++ b/drivers/usb/host/uhci-hub.c
> >>>>> @@ -253,7 +253,7 @@ static int uhci_hub_control(struct usb_hcd *hcd,
> >>>>> u16 typeReq, u16 wValue,
> >>>>>        switch (typeReq) {
> >>>>>          case GetHubStatus:
> >>>>> -               *(__le32 *)buf = cpu_to_le32(0);
> >>>>> +               put_unaligned_le32(0, buf);
> >>>>
> >>>> What is supposed to make all these changes a good idea?
> >>>>
> >>> Since buf might not be 4-byte aligned.
> >>
> >> It is. Please analyze the code before you use these access methods.
> >>
> > You are right. buf has been 4-byte aligned since 2.6.19. My patch was
> > written two years ago. Sorry for the noise I caused.
> >
> 
> I has keeping this patch for a long time.  Jie fixed this patch at
> 2006/09/20 in our svn:
> http://blackfin.uclinux.org/git/?p=readonly-mirrors/linux-kernel.git;a=commit;h=cb3da1243f84b37b53486c7e86da34565b4c5d92
> http://blackfin.uclinux.org/git/?p=readonly-mirrors/linux-kernel.git;a=commit;h=2559298f0dca2cffc0b87390b92a484004f0d85e
> 
> And a similar patch from David Miller was accept in ohci-hub.c
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=92164c5dd1ade33f4e90b72e407910de6694de49
> 
> Also because of the same issue, which was fixed by:
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=54bee6e1b455573658972510a76119f279db32b7
> 
> If other functions not only rh_call_control() call this hub_control()
> pointer and the buf is not 4-byte aligned,
> this bug will fire again without the unaligned API. This patch is
> safer for the caller, although not efficient.

This is not very nice. If we pass around unaligned pointers we should mark
those not catch errors later on.

	Regards
		Oliver

  reply	other threads:[~2008-05-15 12:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-15  6:19 Bryan Wu
2008-05-15  7:40 ` Oliver Neukum
2008-05-15  8:03   ` Jie Zhang
2008-05-15  8:09     ` Bryan Wu
2008-05-15  8:36     ` Oliver Neukum
2008-05-15  9:15       ` Jie Zhang
2008-05-15  9:54         ` Bryan Wu
2008-05-15 12:19           ` Oliver Neukum [this message]
2008-05-15 13:03             ` David Brownell
2008-05-15 13:27               ` Oliver Neukum
2008-05-15 14:28           ` Alan Stern
2008-05-16  0:33             ` [PATCH] usb: file-storage.c use unaligned access helpers Harvey Harrison
2008-05-16 14:32               ` Alan Stern
2008-05-16 18:09                 ` [RFC-PATCH] lib: add byteorder helpers for the aligned case Harvey Harrison
2008-05-17  0:35                   ` Alan Stern
2008-05-17  0:37                     ` Harvey Harrison
2008-05-15 15:37 ` [PATCH 1/1] [usb/host]: use get/put_unaligned_* helpers to fix more potential unaligned issues Harvey Harrison
2008-05-16  0:05 ` Andrew Morton

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=200805151419.16026.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=cooloney@kernel.org \
    --cc=david-b@pacbell.net \
    --cc=greg@kroah.com \
    --cc=harvey.harrison@gmail.com \
    --cc=jie.zhang@analog.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®