Commit graph

401129 commits

Author SHA1 Message Date
Sachin Kamat 5576bc7bef mtd: nand: pxa3xx_nand: Remove redundant of_match_ptr
The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-11-06 23:32:46 -08:00
Sachin Kamat fea7b5697b mtd: nand: lpc32xx_slc: Remove redundant of_match_ptr
The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-11-06 23:32:45 -08:00
Sachin Kamat 6dcd592022 mtd: nand: lpc32xx_mlc: Remove redundant of_match_ptr
The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-11-06 23:32:45 -08:00
Jingoo Han 60d0dc7fa1 mtd: denali: remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-11-06 23:32:44 -08:00
Jingoo Han 4d47011b39 mtd: scb2_flash: remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-11-06 23:32:44 -08:00
Jingoo Han cd688920c5 mtd: pci: remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-11-06 23:32:43 -08:00
Jingoo Han fe7feb9983 mtd: intel_vr_nor: remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-11-06 23:32:42 -08:00
Alexander Sverdlin 2a46f83570 mtd: phram: Make phram 64-bit compatible
phram was 32-bit limited by design. Machines are growing up, but phram
module is still useful. Update it. The patch is bigger than minimum,
because simple_strtoul() is obsolete.

Tested on MIPS64 and compile-tested for PPC (32 bit).

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nsn.com>
Reviewed-by: Joern Engel <joern@logfs.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-11-06 23:32:37 -08:00
Sachin Kamat 14a95b8a23 mtd: diskonchip: Fix incorrect placement of __initdata
__initdata should be placed between the variable name and equal
sign for the variable to be placed in the intended section.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:07 -07:00
Flavio Silveira e6db7c8484 mtd: m25p80: Add support for ESMT F25L32PA
This flashchip is used in D-Link DIR-610 A1 router board
and maybe several others, yet is not kernel upstream.

So add support for it according to datasheet [0], making it easier
to support other boards using this flashchip in the future.

[0] http://www.esmt.com.tw/DB/manager/upload/F25L32PA.pdf

Signed-off-by: Flavio Silveira <fggs@terra.com.br>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:07 -07:00
Jingoo Han 14ac07856f mtd: plat-ram: Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:07 -07:00
Huang Shijie 963d1c285f mtd: nand: fix the wrong mtd->type for nand chip
Current code sets the mtd->type with MTD_NANDFLASH for both
SLC and MLC. So the jffs2 may supports the MLC nand, but in actually,
the jffs2 should not support the MLC.

This patch uses the nand_is_slc() to check the nand cell type,
and set the mtd->type with the right nand type.

After this patch, the jffs2 only supports the SLC nand.

The side-effect of this patch:
  Before this patch, the ioctl(MEMGETINFO) can only return with the
  MTD_NANDFLASH; but after this patch, the ioctl(MEMGETINFO) will
  return with the MTD_NANDFLASH for SLC, and MTD_MLCNANDFLASH for MLC.

  So the user applictions(such as mtd-utils) should also changes a little
  for this.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:07 -07:00
Huang Shijie e104f1e9da jffs2: do not support the MLC nand
We should not support the MLC nand for jffs2. So if the nand type is
MLC, we quit immediatly.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:07 -07:00
Huang Shijie f48372465f mtd: add MTD_MLCNANDFLASH case for mtd_type_show()
The current mtd_type_show() misses the MTD_MLCNANDFLASH case.
This patch adds the case for it, and also updates the ABI.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:06 -07:00
Huang Shijie 4f8a3ba700 mtd: mtd-abi: add a helper to detect the nand type
The helper is for user applications, and it is just a copy of
the kernel helper: mtd_type_is_nand();

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:06 -07:00
Huang Shijie 818b973929 mtd: nand: add a helper to detect the nand type
This helper detects that whether the mtd's type is nand type.

Now, it's clear that the MTD_NANDFLASH stands for SLC nand only.
So use the mtd_type_is_nand() to replace the old check method
to do the nand type (include the SLC and MLC) check.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:06 -07:00
Huang Shijie fda5b0e24d mtd: nand: add more comment for MTD_NANDFLASH/MTD_MLCNANDFLASH
In current code, the MTD_NANDFLASH is used to represent both the SLC and
MLC. It is confusing to us.

By adding an explicit comment about these two macros, this patch makes it
clear that:
	MTD_NANDFLASH    : stands for SLC NAND,
	MTD_MLCNANDFLASH : stands for MLC NAND (including TLC).

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:06 -07:00
Huang Shijie 7a2b89acf8 mtd: gpmi: rewrite the gpmi_ecc_write_oob() to support the jffs2
When we use the ECC info which is get from the nand chip's datasheet,
we may have some freed oob area now.

This patch rewrites the gpmi_ecc_write_oob() to implement the ecc.write_oob().
We also update the comment for gpmi_hw_ecclayout.

Yes! We can support the JFFS2 for the SLC nand now.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:06 -07:00
Huang Shijie 3723e93c64 mtd: nand: print out the cell information for nand chip
Print out the cell information for nand chip.

(Since the message is too long, this patch also splits the log
with two separate pr_info())

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:05 -07:00
Huang Shijie 13fbd17941 mtd: nand: set the cell information for ONFI nand
The current code does not set the SLC/MLC information for onfi nand.
(This makes that the kernel treats all the onfi nand as SLC nand.)

This patch fills the cell information for ONFI nands.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:05 -07:00
Huang Shijie 1c195e909c mtd: nand: add the "bits per cell" info for legacy ID NAND
The legacy ID NAND are all SLC.
This patch sets 1 to the @bits_per_cell for the legacy ID NAND,
which means they are all SLC.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:05 -07:00
Huang Shijie 7db906b79f mtd: nand: rename the cellinfo to bits_per_cell
The @cellinfo fields contains unused information, such as write caching,
internal chip numbering, etc. But we only use it to check the SLC or MLC.

This patch tries to make it more clear and simple, renames the @cellinfo
to @bits_per_cell.

In order to avoiding the bisect issue, this patch also does the following
changes:
  (0) add a macro NAND_CI_CELLTYPE_SHIFT to avoid the hardcode.

  (1) add a helper to parse out the cell type : nand_get_bits_per_cell()

  (2) parse out the cell type for extended-ID chips and the full-id nand chips.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:04 -07:00
Huang Shijie 1d0ed69ddd mtd: nand: add a helper to check the SLC/MLC nand chip
Add a helper to check if a nand chip is SLC or MLC.
This helper makes the code more readable.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:04 -07:00
Brian Norris 4ae7d228d6 mtd: nand: correct extemded param page error handling
If the ONFI extended parameter page gives codeword_size == 0, the
extended ECC information is corrupt and should not be used. Currently,
we (correctly) avoid using the information, but we don't report the
error to the caller, so the caller doesn't know that we didn't
initialize ecc_strength_ds and ecc_step_ds. Now the caller can warn the
user that it does not have sufficient information.

This also removes the false and useless "ONFI extended param page
detected" debug message (it was printed even on the aforementioned
corruption, and for the success case, we don't really want a print).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
2013-10-27 16:27:04 -07:00
Josh Wu 2a3d933a46 mtd: atmel_nand: use minimum ecc requirements of nand: ecc_{strength,step}_ds
Since ecc_{strength,step}_ds is introduced in nand_chip structure for
minimum ecc requirements. So we can use them directly and remove our
own get_onfi_ecc_param function.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:04 -07:00
Josh Wu 81f29b475d mtd: atmel_nand: add MODULE_DEVICE_TABLE for nfc driver
This patch also add a const keyword for the of_device_id of nfc.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:04 -07:00
Josh Wu e9d8da807d mtd: atmel_nand: remove #if defined(CONFIG_OF) around OF-specific code
Since the of specific code are declared in <linux/of_mtd.h> regardless
of CONFIG_OF. Remove the #if defined(CONFIG_OF) guard and use an
IS_ENABLED(CONFIG_OF) instead.

Thanks to Ezequiel Garcia's for this protype.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:03 -07:00
Paul Bolle 86bc7bddc9 mtd: onenand: omap: remove two unused functions
Nothing calls omap2_onenand_rephase(). And __adjust_timing() is only
called by omap2_onenand_rephase(). Remove these two unused functions.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:03 -07:00
Brian Norris c7f23a7063 mtd: nand: cleanup ONFI printed errors, warnings
The ONFI detection routine is too verbose in some cases and not verbose
enough in others. This patch refactors it to print only when there are
significant warnings/errors.

Probing in 16-bit mode:
  It is unnecessary to print until after the READID (address 20h)
  command. READID *has* to work properly in whatever bus width
  configuration we are in, or else no identification mode works. So we
  can silence some useless warnings on systems which come up in 16-bit
  mode and do not even respond with an O-N-F-I string.

Valid parameter page:
  Nobody needs to see this. Do we inform the user every time other
  hardware responds properly? Instead, add an error message if *no*
  uncorrupted parameter pages are found.

ONFI ECC:
  Most drivers don't yet use the reported minimum ECC values, so it
  shouldn't yet be a fatal condition if the extended parameter page is
  incorrect. But we should at least give a warning for the corner cases
  that we don't expect.

ONFI flash detected:
  Nobody needs to see this. This is the expected case, that we detect
  ONFI properly, or else it wasn't ONFI-compliant and is detected by
  some other routine.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Huang Shijie <b32955@freescale.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
2013-10-27 16:27:03 -07:00
Brian Norris 535ab90334 mtd: lpddr_cmds: make function static
do_xxlock() is only used locally. This silences a sparse warning:

drivers/mtd/lpddr/lpddr_cmds.c:706:5: warning: no previous prototype for 'do_xxlock' [-Wmissing-prototypes]

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:03 -07:00
Brian Norris 6b7368c230 mtd: onenand: remove unused variable assignments
These variable assignments are never used (the variables are either
never used or are overwritten before use). This resolves some compiler
warnings like the following:

    drivers/mtd/onenand/onenand_base.c: In function 'flexonenand_get_boundary':
    drivers/mtd/onenand/onenand_base.c:3532:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
    drivers/mtd/onenand/onenand_base.c: In function 'onenand_probe':
    drivers/mtd/onenand/onenand_base.c:3838:6: warning: variable 'maf_id' set but not used [-Wunused-but-set-variable]

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
2013-10-27 16:27:03 -07:00
Brian Norris aaadd9819a mtd: nand: remove obsolete 'ecclayout' field
This field is never used, except to print it out.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:03 -07:00
Brian Norris 53d66baef6 mtd: onenand: remove redundant offset check
The mtd_block_isbad() interface already checks for this.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:02 -07:00
Brian Norris 8c5194361d mtd: denali: make init function static
It's only used in this file.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:00 -07:00
Brian Norris be1ee7d881 mtd: dataflash: remove unused field
struct dataflash's 'partition' field is unused. Just remove it.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
2013-10-27 16:26:59 -07:00
Brian Norris 552fb55d6e mtd: nand: stop exporting nand_default_bbt
I removed the last non-nand_base users of this, and we shouldn't have
any more modules that need to access it. It's only non-static to share
between nand_base and nand_bbt.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:26:59 -07:00
Brian Norris 4fd18ae46d mtd: nandsim: don't call nand_default_bbt() directly
We want the default nand_chip.scan_bbt() function, so just use the
proper indirection.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:26:59 -07:00
Brian Norris 252026ab93 mtd: nand: lpc32xx_slc: don't call nand_default_bbt directly
This driver is doing some strange logic here. If it doesn't have
flash-based BBT enabled, it allows nand_scan_tail() to scan the BBT. But
if it is using flash-based BBT, it tells nand_scan_tail() to skip
scanning, then it immediately calls the default BBT scanning function
itself.

As I read it, this logic is equivalent to the default nand_scan_tail()
behavior without interfering with NAND_SKIP_BBTSCAN or calling
nand_default_bbt() directly at all.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:26:59 -07:00
Brian Norris 2ee41fa0ba nand: docg4: use nand_base's default BBT scan
There's no point in the low level driver doing the work that nand_base
already is doing; just let nand_base set the default BBT scanning
function.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Dunn <mikedunn@newsguy.com>
2013-10-27 16:26:59 -07:00
Ezequiel Garcia a6eaa2ae78 of_mtd: Add no-op stubs to support CONFIG_OF=n
Just like the rest of the subsystems, let's add the required no-op
functions to implement stubs when CONFIG_OF=n.

This prevents MTD drivers from having ugly ifdefs in their code,
and instead hide the ifdef monster in the header closet (far away
from people's sight).

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:26:58 -07:00
Lothar Waßmann d41f950e27 mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2013-10-27 16:26:58 -07:00
Linus Torvalds d255c59aab A few more last-minute regression fixes, prepared jointly by me and David
Woodhouse:
 
 * Revert pxa3xx to its old name to avoid breaking existing 'mtdparts=' boot
   strings.
 
 * Return GPMI NAND to its legacy ECC layout for backwards compatibility. We
   will revisit this in 3.13.
 
 A note from David on the latter fix: "This leaves a harmless cosmetic warning
 about an unused function. At this point in the cycle I really don't care."
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.10 (GNU/Linux)
 
 iQIcBAABAgAGBQJSaqh8AAoJEFySrpd9RFgtMh4P/2vl/DUnDAjawWmsBs0kwTH2
 e3/gy1msBQoBNZBQ5VBSw3woIKrfEyrgr/mZWYhPR5N/h1UhWHVySbITJ5m86ABz
 hCfgLiA7hUs36qP3zmezOS/eqyiVMasRDeeudC+sVIrVItJjbIRhw54DLaKyilKx
 F6bFGXBG2bsgI0m2/ZDARL5CzgF/B/DE6uwBvbjPBxBgTB2ATql+bO8J5CQwF4i+
 VGPDfRjCClJg93G/KQBaiABvgReNhNHDAPTj2VLGOUhynZ4faAaak7jdWMHvxUqZ
 JkcnIqewCRvAxRDja9LwU4UiNRRT34e631o3kqDSu86CH8qC1ioCQ8r0F9ISPyV8
 bzw3spVmrvrm/O2NDnykX1FR+YJkIsaSqD77YAib/FxRDNRd/Ihgxd+r/EaMXJY4
 o/vXlPvEw9xa85j24p0P3t0otzTR8N4HtMYO4ggZL/iZ85iVl2qi7++Q5VjEfloR
 ePnE9w7qwXsyGmJQC0PCadW8vtye1AwzRVSCIM0hu11vZj+/26Q4IlIcH6Xn1g68
 yW7fUse6pcBEVJz+xyndNhWHXEwQBkmIIGNgUJs7stvbLPfaXEnmK52v0JWcoQZ+
 3tPVQBER7AqdCHBaRvzBw4dbK+W5SiCXfVTytTlDJnyKk6n3rmNVjAZDcyp5m7K2
 OmGq40fKzIjPcmzbkzoR
 =3NKt
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-20131025' of git://git.infradead.org/linux-mtd

Pull final mtd fixes from Brian Norris:
 "A few more last-minute regression fixes, prepared jointly by me and
  David Woodhouse:

   - Revert pxa3xx to its old name to avoid breaking existing
     'mtdparts=' boot strings.

   - Return GPMI NAND to its legacy ECC layout for backwards
     compatibility.  We will revisit this in 3.13.

  A note from David on the latter fix: 'This leaves a harmless cosmetic
  warning about an unused function.  At this point in the cycle I really
  don't care.'"

* tag 'for-linus-20131025' of git://git.infradead.org/linux-mtd:
  mtd: gpmi: fix ECC regression
  mtd: nand: pxa3xx: Fix registered MTD name
2013-10-25 20:15:13 +01:00
Linus Torvalds f55ac56d5e Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs fixes (try two) from Al Viro:
 "nfsd performance regression fix + seq_file lseek(2) fix"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  seq_file: always update file->f_pos in seq_lseek()
  nfsd regression since delayed fput()
2013-10-25 18:16:47 +01:00
David Woodhouse 031e2777e0 mtd: gpmi: fix ECC regression
The "legacy" ECC layout used until 3.12-rc1 uses all the OOB area by
computing the ECC strength and ECC step size ourselves.

Commit 2febcdf84b ("mtd: gpmi: set the BCHs geometry with the ecc info")
makes the driver use the ECC info (ECC strength and ECC step size)
provided by the MTD code, and creates a different NAND ECC layout
for the BCH, and use the new ECC layout. This causes a regression:

   We can not mount the ubifs which was created by the old NAND ECC layout.

This patch fixes this issue by reverting to the legacy ECC layout.

We will probably introduce a new device-tree property to indicate that
the new ECC layout can be used. For now though, for the imminent 3.12
release, we just unconditionally revert to the 3.11 behaviour.

This leaves a harmless cosmetic warning about an unused function. At
this point in the cycle I really don't care.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
2013-10-25 10:09:43 -07:00
Gu Zheng 05e16745c0 seq_file: always update file->f_pos in seq_lseek()
This issue was first pointed out by Jiaxing Wang several months ago, but no
further comments:
https://lkml.org/lkml/2013/6/29/41

As we know pread() does not change f_pos, so after pread(), file->f_pos
and m->read_pos become different. And seq_lseek() does not update file->f_pos
if offset equals to m->read_pos, so after pread() and seq_lseek()(lseek to
m->read_pos), then a subsequent read may read from a wrong position, the
following program produces the problem:

    char str1[32] = { 0 };
    char str2[32] = { 0 };
    int poffset = 10;
    int count = 20;

    /*open any seq file*/
    int fd = open("/proc/modules", O_RDONLY);

    pread(fd, str1, count, poffset);
    printf("pread:%s\n", str1);

    /*seek to where m->read_pos is*/
    lseek(fd, poffset+count, SEEK_SET);

    /*supposed to read from poffset+count, but this read from position 0*/
    read(fd, str2, count);
    printf("read:%s\n", str2);

out put:
pread:
 ck_netbios_ns 12665
read:
 nf_conntrack_netbios

/proc/modules:
nf_conntrack_netbios_ns 12665 0 - Live 0xffffffffa038b000
nf_conntrack_broadcast 12589 1 nf_conntrack_netbios_ns, Live 0xffffffffa0386000

So we always update file->f_pos to offset in seq_lseek() to fix this issue.

Signed-off-by: Jiaxing Wang <hello.wjx@gmail.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-10-25 10:46:40 -04:00
Linus Torvalds 4208c47199 ARM: SoC fixes for 3.12-rc
There's really only one bugfix in this branch, which is a fix for timers on
 the integrator platform. Since Linus Walleij is resurrecting support for
 the platform it seems valuable to get the fix into 3.12 even though the
 regression has been around a while.
 
 The rest are a handful of maintainers updates. If you prefer to hold those
 until 3.13 then just merge the first patch on the branch which is the fix.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSakNMAAoJEIwa5zzehBx3KscQAJPKB+kZac8rFi/n/yVrJh0P
 125QnjrkzK8jIaC3u91sJxYxro54/lH272Joz/TwLWr3ppfJRshZsDZeU164+VlF
 9kgHPKGTJU//5R07uFdI29oDVoPbaCX70KaZ31Sevk8VVGsJYasaLeO0422bp4We
 xn7WXb6XySRaV1HrwIp8/TVtwvFP2zDet6A/2G8s0tmDP0Ls3pJM1BJHfDnDN5ZY
 xkrJwRO1BwJMeHpDO5Jo7i33Wvb27ORF6x31Lrs7JL/nUdge+we/VLTwElpyyTjU
 3cqpW84Mc2HLyKy3kg8339qVxQTRvWOcXY6A1yQKH/FGL8EuBu6UjfzNsrb3aQsZ
 GzrXaM0lTLTE5dSEodnKnctllJS6u4pW6HSYnaUzAD897L7gNNny/FTYq5N7zWsj
 lssFu93m/2JMY6sc//1u08cG3nPCj3R76Q/MDtG6sWOesbHw1WgPk3YRDF6IVP5R
 FEJxEeEWp/BVAXS9Na4833rDFruyfVfUxOvXkt9sBq2tb/B2dlw7em+agWJ50fQd
 JiQTJLnCJaIu7ee7+r/XtQVtTrIBhWPpB1DlTBJs/DXU4xmKGqtih0hyJD9oNkfn
 3dmfwFruJE/qaV3Y7PEI3dbBZsLY6UrQXED4+FMqD2XaOJqV0KQC35b6nXc1BNnS
 Q8NWToYnaeFAQIfakS3s
 =7MQ0
 -----END PGP SIGNATURE-----

Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC fixes from Olof Johansson:
 "There's really only one bugfix in this branch, which is a fix for
  timers on the integrator platform.  Since Linus Walleij is
  resurrecting support for the platform it seems valuable to get the fix
  into 3.12 even though the regression has been around a while.

  The rest are a handful of maintainers updates.  If you prefer to hold
  those until 3.13 then just merge the first patch on the branch which
  is the fix"

* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
  MAINTAINERS: Add maintainers entry for Rockchip SoCs
  MAINTAINERS: Tegra updates, and driver ownership
  MAINTAINERS: ARM: mvebu: add Sebastian Hesselbarth
  ARM: integrator: deactivate timer0 on the Integrator/CP
2013-10-25 11:49:23 +01:00
Linus Torvalds 88829dfe4b Two important fixes
- Fix long standing memory leak in the (rarely used) public key support
 - Fix large file corruption on 32 bit architectures
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIcBAABCgAGBQJSaX/HAAoJENaSAD2qAscKdpQQAI6Rvsv5y/Gj+8/9rCUnNYhw
 8YWYkOko2+cyGl6ro+nIm2nmKOuaGrjijvubOjOAe4WkMzS0EyJjku/9NT3S6KzC
 SqHC0ZeZf0jaFC9zUkUN69RY9m96Ak94HAagXO3Qm39DCSj8xijxODOVnVzkEs2x
 ylOU8OgRbD/AIDzmLxgHaOtuAmQ0GNvbVoYK6ZErVmOMENU2/67iH3OsyGD4OFpr
 Oaq1i8m7rxPmwv3QNSGhXSK6EScqs2jgM4aPWx3aG+OhYv6sGWkL8jJgPS/uSUBc
 ttD1Ou/d9yyvZPDFd9wmiHhenbCVbEdl6JAIS8zKv4NkSQ3V7AVWwAoe6JMfbREo
 U+Om7FwGLgKlZ/19+IxBMGTITuOjUkKq97vJMiYbXuWzdrZSflv5GiGGKbxchmnA
 CnfYaN1HYVcpLsbXoDTBomML7VTtbifgmY0diUJ2aJ1eTg86Gs1DXjhnuLF70Jjd
 dfuYfOKkJguuRfZ50yrpWfEQ0iOudXI1v+PrramLof33lNKWI8XeKjgDxyUrAjOZ
 UjFT639EXIRzYDIOCPZicQKdNO3BRziKi1cSnXQQp9cNTMs6/FIxK2zrQmjgqvww
 Hwj+M6czLs45lbfjQIxi3FlEAYYdXBQwrEiAu4cmt9j1bxIZnwIa7Fu0bXSxphfD
 dUo0GN7CkF45BkNvotFX
 =74EV
 -----END PGP SIGNATURE-----

Merge tag 'ecryptfs-3.12-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs

Pull ecryptfs fixes from Tyler Hicks:
 "Two important fixes
   - Fix long standing memory leak in the (rarely used) public key
     support
   - Fix large file corruption on 32 bit architectures"

* tag 'ecryptfs-3.12-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs:
  eCryptfs: fix 32 bit corruption issue
  ecryptfs: Fix memory leakage in keystore.c
2013-10-25 07:32:01 +01:00
Ezequiel Garcia 18a84e935e mtd: nand: pxa3xx: Fix registered MTD name
In a recent commit:

  commit f455578dd9
  Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
  Date:   Mon Aug 12 14:14:53 2013 -0300

  mtd: nand: pxa3xx: Remove hardcoded mtd name

  There's no advantage in using a hardcoded name for the mtd device.
  Instead use the provided by the platform_device.

The MTD name was changed to use the one provided by the platform_device.
However, this can be problematic as some users want to set partitions
using the kernel parameter 'mtdparts', where the name is needed.

Therefore, to avoid regressions in users relying in 'mtdparts' we revert
the change and use the previous one 'pxa3xx_nand-0'.

While at it, let's put a big comment and prevent this change from happening
ever again.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-24 14:44:28 -07:00
Colin Ian King 43b7c6c6a4 eCryptfs: fix 32 bit corruption issue
Shifting page->index on 32 bit systems was overflowing, causing
data corruption of > 4GB files. Fix this by casting it first.

https://launchpad.net/bugs/1243636

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reported-by: Lars Duesing <lars.duesing@camelotsweb.de>
Cc: stable@vger.kernel.org # v3.11+
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2013-10-24 12:36:30 -07:00
Linus Torvalds e6036c0b88 Assorted md bug-fixes for 3.12.
All tagged for -stable releases too.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQIVAwUAUmimOjnsnt1WYoG5AQIOOBAArscYUmZCaAhcug32NnPqQHousVdW2gA/
 IqgNJYtaRCvMjb1xs7/6YVZIPI9ngr4GHAccjsh9Een+9eS4i81YByh6TW7+tzub
 SaQZpCgusaEktPFpO49k0Vj9+KQXo5LA54fDya6Y7mPftn5z+UAqxdlUrSbRsG7j
 YCXNvqVB4CH3zt9h/lae1cBTRu22Z5P9EGGrKLOH0WJLVNrjwOS5oCpRjHvG55pO
 DPeY8U/v50+0zqixwZm1gH+7PcPcNTraYzZzX9gY0FvUET8gMIRlTPT5JZWolzem
 i5PRSvhQothDfmun1kn7glapnsCQIenR9F/8ApKBMyrnNIOFhut6eXYSVbZsQeZO
 uRrgdB/crU3w1XlKgjEJJ2+RXOS29PCvjSuzfgG2CvyqZN8cVbrUf+Vjb0ejOG1j
 VGF8zoliXb47gWZY8SfASKGDZQtBEWvrw4W2gCd4M47yuS2HSExbshaeRXkjth1Z
 7h/2G5Q7+BNewN/OSmcAoxycBNkCjLouIDt7AS9IKF6Rao3As3Mz6XQCcwffM/Id
 +MgTAgIsYT3eMLswt/lkrziOP+YIl2lAruRo0l1fs76Si7ihztRQZ38ApOhS8s6G
 KV2/P3temH6T8sqKlg3orTN1VH+UfAm/8EsgOJSqjo3jbdpGzpHmOMlkGjdx/Bey
 TmZI+aPw16U=
 =hWWG
 -----END PGP SIGNATURE-----

Merge tag 'md/3.12-fixes' of git://neil.brown.name/md

Pull md bugfixes from Neil Brown:
 "Assorted md bug-fixes for 3.12.

  All tagged for -stable releases too"

* tag 'md/3.12-fixes' of git://neil.brown.name/md:
  raid5: avoid finding "discard" stripe
  raid5: set bio bi_vcnt 0 for discard request
  md: avoid deadlock when md_set_badblocks.
  md: Fix skipping recovery for read-only arrays.
2013-10-24 07:45:34 +01:00