26

Merge branch 'floppy' · torvalds/linux@47d6a76 · GitHub

 4 years ago
source link: https://github.com/torvalds/linux/commit/47d6a7607443ea43dbc4d0f371bf773540a8f8f4
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Merge branch 'floppy' · torvalds/linux@47d6a76 · GitHubPermalink

Browse files

Merge branch 'floppy'

Merge floppy ioctl verification fixes from Denis Efremov.

This also marks the floppy driver as orphaned - it turns out that Jiri
no longer has working hardware.

Actual working physical floppy hardware is getting hard to find, and
while Willy was able to test this, I think the driver can be considered
pretty much dead from an actual hardware standpoint.  The hardware that
is still sold seems to be mainly USB-based, which doesn't use this
legacy driver at all.

The old floppy disk controller is still emulated in various VM
environments, so the driver isn't going away, but let's see if anybody
is interested to step up to maintain it.

The lack of hardware also likely means that the ioctl range verification
fixes are probably mostly relevant to anybody using floppies in a
virtual environment.  Which is probably also going away in favor of USB
storage emulation, but who knows.

Will Decon reviewed the patches but I'm not rebasing them just for that,
so I'll add a

  Reviewed-by: Will Deacon <[email protected]>

here instead.

* floppy:
  MAINTAINERS: mark floppy.c orphaned
  floppy: fix out-of-bounds read in copy_buffer
  floppy: fix invalid pointer dereference in drive_name
  floppy: fix out-of-bounds read in next_valid_format
  floppy: fix div-by-zero in setup_format_params

torvalds

committed on Jul 18, 2019

2 parents 22051d9 + be2ece4 commit 47d6a7607443ea43dbc4d0f371bf773540a8f8f4
Showing with 34 additions and 5 deletions.
@@ -6321,9 +6321,8 @@ F: Documentation/devicetree/bindings/counter/ftm-quaddec.txt
F: drivers/counter/ftm-quaddec.c
FLOPPY DRIVER
M: Jiri Kosina <[email protected]>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/floppy.git
S: Odd fixes
S: Orphan
L: [email protected]
F: drivers/block/floppy.c
FMC SUBSYSTEM
@@ -2120,6 +2120,9 @@ static void setup_format_params(int track)
raw_cmd->kernel_data = floppy_track_buffer;
raw_cmd->length = 4 * F_SECT_PER_TRACK;
if (!F_SECT_PER_TRACK)
return;
/* allow for about 30ms for data transport per track */
head_shift = (F_SECT_PER_TRACK + 5) / 6;
@@ -3230,8 +3233,12 @@ static int set_geometry(unsigned int cmd, struct floppy_struct *g,
int cnt;
/* sanity checking for parameters. */
if (g->sect <= 0 ||
g->head <= 0 ||
if ((int)g->sect <= 0 ||
(int)g->head <= 0 ||
/* check for overflow in max_sector */
(int)(g->sect * g->head) <= 0 ||
/* check for zero in F_SECT_PER_TRACK */
(unsigned char)((g->sect << 2) >> FD_SIZECODE(g)) == 0 ||
g->track <= 0 || g->track > UDP->tracks >> STRETCH(g) ||
/* check if reserved bits are set */
(g->stretch & ~(FD_STRETCH | FD_SWAPSIDES | FD_SECTBASEMASK)) != 0)
@@ -3375,6 +3382,24 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
return 0;
}
static bool valid_floppy_drive_params(const short autodetect[8],
int native_format)
{
size_t floppy_type_size = ARRAY_SIZE(floppy_type);
size_t i = 0;
for (i = 0; i < 8; ++i) {
if (autodetect[i] < 0 ||
autodetect[i] >= floppy_type_size)
return false;
}
if (native_format < 0 || native_format >= floppy_type_size)
return false;
return true;
}
static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
unsigned long param)
{
@@ -3501,6 +3526,9 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int
SUPBOUND(size, strlen((const char *)outparam) + 1);
break;
case FDSETDRVPRM:
if (!valid_floppy_drive_params(inparam.dp.autodetect,
inparam.dp.native_format))
return -EINVAL;
*UDP = inparam.dp;
break;
case FDGETDRVPRM:
@@ -3698,6 +3726,8 @@ static int compat_setdrvprm(int drive,
return -EPERM;
if (copy_from_user(&v, arg, sizeof(struct compat_floppy_drive_params)))
return -EFAULT;
if (!valid_floppy_drive_params(v.autodetect, v.native_format))
return -EINVAL;
mutex_lock(&floppy_mutex);
UDP->cmos = v.cmos;
UDP->max_dtr = v.max_dtr;

28 comments on commit 47d6a76

I have at least one 720k 3.5" 34pin floppy drive and one 5.25" 1.2k floppy drive, although I would need to test them first... a 1440k 3.5" working drive would not be hard to scrounge up, either.

I would be happy to send them to your friend Jiri for cost of shipping (sorry, I can't cover that myself... I am of extremely limited financial means) to help continue this effort. I also have some floppy/HDD controller cards that may be of use, although all are ISA-16 interface, not PCI...

If you (or he) wants to get in touch with me, my email address is found by replacing 'star' with 'laser' in my username here, and appending Google's usual email service to the other end.

As an aside... I still have (and it still works) my first computer, and it's remarkably similar in spec to the machine you had at around the same time (c.1994 for me, about a year earlier for you, IIRC) that started it all... funny how that works.

I’ll spot you on the shipping costs provided it’s not exorbitant— that said what’s the audience here? Does anyone know how many people use a physical floppy drive aka what’s the impact of this?

there are still, old boxes that do boot from floppy drives.
I think I can find a PCI controller for the drives and send 3.5' and 5.25' anywhere.

I have a 1.44M 3.5" floppy drive in my old x86 machine (and it seems to work!) but I don't wanna part with it sob

I have many IDE floppy drives, if Jiri wants some.

Can also send a drive or two, but it's understandable the driver probably doesn't need much development any longer.

NOOOOOOOO!!! Now what will i use for swap space!! :)

I have a 3" Amstrad drive that works with an adaptor ribbon cable on a PC so I can occasionally write ZX Spectrum +3 DSK images to real disks using http://www.seasip.info/Unix/LibDsk/ - obscure use case but works nicely with Linux...

I have many IDE floppy drives, if Jiri wants some.

..pardon, but what?
IIRC FDD controllers use a 34-pin interface with a twist. :P (P unintended)
You instead mean a real IDE (that is, 40 pin) interface?

He might have a cache of Iomega ZIP drives (ha!) -- those were sort of popular back in the day, and the media looked like thick floppies, and the drives used the 40pin IDE interface when they were internal, as opposed to the external LPT and SCSI versions. I have two ZIP-100 drives in the closet.

I have to say, it makes me smile to see what I seem to have ignited with my offer here :) old hardware (and support for it) is worth preserving, specifically because it IS history. Those signs at the map kiosk at the mall ("You are here") really only tell half the story -- the other part that they don't say is "You've been here" and that's just as important.

Palladini replied on Jul 29, 2019

edited

I have built several computers in the past 3 years, an none of them have a floppy disk unit in them, although a couple of them had 2 DVD drives in them, and the latest computer I built has no DVD drive, because I built that computer for NAS use only And every one of them Computers has a Version of Linux Mint running on it

I, too, have built several computers in the past year. Well... three or four, anyhow, with the next one in progress. None of those have floppy drives, either.

However, I have also, in the past year, restored a 486 Toshiba and an unusually compact 286 system of some rarity called a "Carry I", and I have recently procured a 1987 Amstrad of unusual form factor, and all of /those/ machines have had floppy drives in them, and all three have had at least one drive replaced as well, in the time I've owned them. I'm also building a Win98 box for a friend of mine, and as I'm trying to be cheap, it will be given to that friend with external optical and floppy drives. USB, because that's what's compatible, but there you go.

thanks for this, i actually ran into these issues the other day and was trying to debug them.
i think a lot more people than most realise use old hardware like this, but tend not to go to upstream projects for support as we retrocomputing enthusiasts are often scoffed at when we do so.

I hope this post is not too far off topic.

I know what you mean. I also tinker with thin clients -- they make eeeeeexcelent low-power Linux desktops if you do it right. In 2015, I filed a bug report that I'm extremely proud of -- it led to support being fixed in the 'openchrome' graphics driver for an obscure VIA chipset that something like two computer make/models ever used (the VIA VX855 chipset -- found in the Wyse C-series and Clientron U720 aka Dell Optiplex FX130 etc) and a few other chipsets that operated similarly (I forget the full list now).

To this day, Debian and thus Ubuntu ships with the 0.3.3 version of 'openchrome' -- the version that caused me to file that report. Ubuntu /knows/ about the updated driver, because I freaking told them myself -- only to be /completely/ brushed off and ignored because "I should file a report with Debian, that's an upstream problem". IOW someone very plainly "just works there" and didn't want to be bothered to actually do their freaking job... needless to say, I never bothered to inform Debian, predicting I'd get the same sort of treatment.

As an aside, if you have one of those very unusual clients -- they're great machines as long as you don't mind that they're 32bit and ploddingly slow -- VIA CPUs are descendents of the Cyrix x86 subarchitecture (and debacle) and as such they don't do math very well -- because they're extraordinarily tiny -- about the size of a mass market fiction paperback, actually -- and they're fanless, /and/ they positively sip at the power socket -- I've run mine quite happily off an 18w Netgear wall wart... *ahem* if you have one, and you don't want to be stuck at the command line, go to Github and get yourself a modern copy of 'openchrome' -- and then, if you don't mind doing a favor for a random dude on the Internet, go tell Ubuntu and Debian both to go and properly fix their, er, stuff. (I'd use a different word starting with 's' but I'm in polite company here.)

To explain the Cyrix remark: Cyrix was an Intel competitor in the days of the 386, 486, and 1st gen Pentium CPUs... I don't remember if they made it to the Pentium II era but I'd be surprised if they got that far, let alone into the Pentium 3 arena. Their million-dollar idea, was to license everything /but/ the ALU from Intel's x86 line, and cook up their own silicon for the adding machine part -- and pass the savings onto customers. The only problem was, their new ALU design, er, stunk. It was far less capable than Intel's, and since everyone else was either Intel or a licensed competitor... Cyrix's customers very quickly went to those competitors and the company basically imploded on its own (lack of) brilliance. VIA bought the remains and (rather than fix ALU the problem) made the chips run at far more efficient power levels and sold them dirt cheap... go figure...

@starhawk64 "To this day" may be a bit of an exaggeration:

$ apt-cache policy xserver-xorg-video-openchrome
xserver-xorg-video-openchrome:
  Installed: 1:0.5.0-3
  Candidate: 1:0.5.0-3
  Version table:
     1:0.6.0-3+b1 103
        103 https://deb.debian.org/debian buster/main amd64 Packages
        102 https://deb.debian.org/debian testing/main amd64 Packages
        101 https://deb.debian.org/debian unstable/main amd64 Packages
 *** 1:0.5.0-3 500
        500 https://deb.debian.org/debian stretch/main amd64 Packages
        100 /var/lib/dpkg/status

If a bug exists in both Debian and Ubuntu, go to Debian first. They really are the upstream for Ubuntu, and updates to Debian packages will automatically propagate to the latest Ubuntu version in a few months, depending on where in the Ubuntu release cycle the update happens.

Well, that's nice to know... I had given up. I humbly retract my accusation and apologize for the incorrect Information.

Jesus Christ! Tell Jiri to post a hackerspace address to send him/her a working floppy drive for free so he/she can pick it up from there. Else if he/she is on Dallas area there is a huge warehouse liquidation of retro computers called "Computer Reset", there will find a ton of old floppies. At https://www.facebook.com/groups/627459117730981/ can find the opening schedule.

I still use 3.5" DD floppy disk to transfer info between my PC (with internal drive) and my Amstrad CPC, USB floppy drive are much more limited as internal ones.

I still use 3.5" DD floppy disk too !!

I've got one of those 8" monsters sitting around collecting dust... innocent

chusiang replied on Aug 1, 2019

edited

Wow, when I beginning the GNU/Linux at the university, I used the CD and USB Flash Disk, so I have not use the floppy on GNU/Linux yet. laughing

Linus Torvalds:已無開發人員維護 Linux 軟碟機驅動程式 | iThome

I have all the necessary hardware if somebody needs it.

I'm an R.F. design engineer, use several computers for various developments - most of them with a floppy drive or more. PLEASE KEEP the Linix drivers for the internal drives - there are more people using these than one might realise, since most are not "computer whizzes" but use reliable and safe systems (e.g. Linux boxen) for many tasks.

I don't think it's fair to ask a maintainer to keep working on something for free at the time they've decided to step down. It might be reasonable to reach out to him directly and offer to ship him floppy hardware for free, but from the commit description, it sounds like he's done.

The driver isn't going to disappear overnight. If it breaks in the future, you can report bugs and offer to test fixes, and that might be enough to keep it working in the future.

Yes, floppy drives are history! But there are still many historical computers out there that are maintained and kept alive by enthusiastic people. For these people Linux is the ideal platform to transfer images to floppy disks.
Please don't let the retro computer scene hang and don't let the old computers die.

and it's not just enthusiasts - computers with floppy drives are still heavily used in industrial and scientific applications.

goshhhy: this is very true - and many of these machines with working and used floppy drives aren't just in corners of universities or small dedicated companies - they are out there in outfits such as NASA, ESA, aerospace companies, pharmaceutical concerns, as well as other research organisations. Many of the applications using these systems and their floppy drives simply cannot be practically transported to other systems with different storage media such as USB sticks. I'm not suggesting we go back to using feather quills and ink to write our reports on vellum, just to keep the ability to use pen and paper.

I have lots of floppy disks. If Jiri need, I can it to him.

Please sign in to comment.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK